标签:
记录,方便查阅。
只需要在controller节点安装。
建立数据库;
mysql -uroot -p123456 -e "create database glance;grant all privileges on glance.* to ‘glance‘@‘192.168.23.11‘ identified by ‘glance‘; grant all privileges on glance.* to ‘glance‘@‘%‘ identified by ‘glance‘;"
创建keystone中的用户、服务等
source admin-openrc.sh #导入管理员变量 keystone user-create --name glance --pass glance --email admin@test.com keystone user-role-add --user glance --tenant service --role admin keystone service-create --name glance --type image --description "Openstack Image Service" keystone endpoint-create \
--service-id $(keystone service-list | awk ‘/ image / {print $2}‘) \
--publicurl http://controller:9292 \
--internalurl http://controller:9292 \
--adminurl http://controller:9292 \
--region regionOne
yum install openstack-glance python-glanceclient -y
编辑配置文件/etc/glance/glance-api.conf
[DEFAULT] verbose=True
notification_driver = noop #配置为noop,禁用notification(通知)
[database]
connection=mysql://glance:glance@controller/glance
[keystone_authtoken]
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = glance
admin_password = glance
[paste_deploy]
flavor=keystone
[glance_store] #镜像后端存储,使用本地文件系统
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
编辑配置文件registry.conf
[DEFAULT] verbose=True [database] connection=mysql://glance:glance@controller/glance [keystone_authtoken] auth_uri=http://controller:5000/v2.0 identity_uri=http://controller:35357 admin_tenant_name=service admin_user=glance admin_password=glance [paste_deploy] flavor = keystone
同步数据表:
glance-manage db_sync
检验数据表:
mysql -uglance -pglance -e ‘use glance;show tables;‘
+----------------------------------+ | Tables_in_glance | +----------------------------------+ | image_locations | | image_members | | image_properties | | image_tags | | images | | metadef_namespace_resource_types | | metadef_namespaces | | metadef_objects | | metadef_properties | | metadef_resource_types | | migrate_version | | task_info | | tasks | +----------------------------------+
启动和自启动:
systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service
debug模式启动:
glance-api --config-file=/etc/glance/glance-api.conf #出错,修改文件权限 chown glance:glance /var/log/glance/api.log chown glance:glance /var/lib/glance/images/
上传镜像并查看:
glance image-create --name cirros --is-public true --container-format bare --disk-format qcow2 < cirros-0.3.1-x86_64-disk.img
glance image-list
+--------------------------------------+---------+-------------+------------------+-----------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+---------+-------------+------------------+-----------+--------+
| 34ffca7a-3182-4f37-a364-9f6e5ae0a5b2 | cirros | qcow2 | bare | 13147648 | active |
+--------------------------------------+---------+-------------+------------------+-----------+--------+
至此,glance安装完成,存储采用本地文件存储。
上传的镜像路径在/var/lib/glance/images/下:
[root@controller ~]# ll -h /var/lib/glance/images/ 总用量 262M -rw-r-----. 1 glance glance 13M 4月 15 17:46 34ffca7a-3182-4f37-a364-9f6e5ae0a5b2
标签:
原文地址:http://www.cnblogs.com/yippee/p/4438804.html