首页 > 代码库 > 5-openstack之glance
5-openstack之glance
5.1 glance的部署
[root@linux-node1~]# yum -y install openstack-glancepython-glance python-glanceclient Glance一定会链接数据库,glance一定会链接keystone,存储配置,配置到哪个地方
5.2 glance-api的配置
[root@linux-node1~]# grep ‘^[a-z]‘ /etc/glance/glance-api.conf verbose = true #开启debug日志 connection =mysql://glance:glance@192.168.56.11/glance #mysql数据库连接 #database模块 default_store =file #keystone_keystone_authtoken模块 filesystem_store_datadir= /var/lib/glance/images auth_uri = http://192.168.56.11:5000 auth_url = http://192.168.56.11:35357 memcached_servers= 192.168.56.11:11211 auth_type =password project_domain_name= default user_domain_name= default project_name =service username = glance password = glance driver = noop #不适用消息队列 flavor = keystone #paste_deploy模块
5.3 glance-registry配置
root@linux-node1~]# grep ‘^[a-z]‘ /etc/glance/glance-registry.conf connection =mysql://glance:glance@192.168.56.11/glance auth_uri =http://192.168.56.11:5000 auth_url =http://192.168.56.11:35357 memcached_servers= 192.168.56.11:11211 auth_type = password project_domain_name= default user_domain_name= default project_name =service username = glance password = glance flavor = keystone [root@linux-node1~]#
5.4 同步glance数据库
su -s/bin/sh -c "glance-manage db_sync" glance 检查数据库同步状况 [root@linux-node1~]# mysql -h 192.168.56.11 -uglance-pglance -e "use glance;showtables;" +----------------------------------+ |Tables_in_glance | +----------------------------------+ |artifact_blob_locations | |artifact_blobs | |artifact_dependencies | |artifact_properties | |artifact_tags | |artifacts | |image_locations | |image_members | |image_properties | |image_tags | |images | |metadef_namespace_resource_types | |metadef_namespaces | |metadef_objects | |metadef_properties | |metadef_resource_types | |metadef_tags | |migrate_version | |task_info | |tasks | +----------------------------------+ [root@linux-node1~]#
5.5 往keystone注册
5.5.1创建glance的域
[root@linux-node1~]# openstack user create --domain default --password=glance glance +---------------------+----------------------------------+ |Field | Value | +---------------------+----------------------------------+ |domain_id |d1d9728ef1d64905b1ebf54982dc7991 | |enabled | True | | id |7a0adc3305d24ea4bc1d1a8abb51b410 | |name | glance | |password_expires_at | None | +---------------------+----------------------------------+ [root@linux-node1~]#
5.5.2 为glance添加角色
openstack role add --project service --userglance admin
5.6 启动glance-api 和glance-registry
[root@linux-node1~]# systemctl enable openstack-glance-api Created symlinkfrom /etc/systemd/system/multi-user.target.wants/openstack-glance-api.serviceto /usr/lib/systemd/system/openstack-glance-api.service. [root@linux-node1~]# systemctl enable openstack-glance-registry Created symlinkfrom /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.serviceto /usr/lib/systemd/system/openstack-glance-registry.service. [root@linux-node1~]# [root@linux-node1~]# systemctl start openstack-glance-api [root@linux-node1~]# systemctl start openstack-glance-registry glance-registry9191端口 glance-api 9292端口
5.7创建对内,对外还有管理节点
[root@linux-node1~]# openstack service create --name glance --description "OpenStack Imagesservice" image +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description |OpenStack Images service | | enabled | True | | id | 2c60396cbd3d4421ad9d298263e0e733 | | name | glance | | type | image | +-------------+----------------------------------+ [root@linux-node1~]# [root@linux-node1~]# openstack endpoint create --regionRegionOne image public http://192.168.56.11:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 710081d984f54eb78b9dfa704c8f104f | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 2c60396cbd3d4421ad9d298263e0e733 | | service_name |glance | | service_type |image | | url | http://192.168.56.11:9292 | +--------------+----------------------------------+ [root@linux-node1~]# [root@linux-node1~]# openstack endpoint create --regionRegionOne image internal http://192.168.56.11:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 9c6260f82e0b49a2a32969e7108f704b | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 2c60396cbd3d4421ad9d298263e0e733 | | service_name |glance | | service_type |image | | url | http://192.168.56.11:9292 | +--------------+----------------------------------+ [root@linux-node1~]# openstack endpoint create --regionRegionOne image admin http://192.168.56.11:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 470c6e79c23c4a0188ef3099b62030ab | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 2c60396cbd3d4421ad9d298263e0e733 | | service_name |glance | | service_type |image | | url | http://192.168.56.11:9292 | +--------------+----------------------------------+
5.8 添加glance-api的调用版本号
在admin-openstack.shdemo-openstack.sh 里面要有 exportOS_IMAGE_API_VERSION=2
5.9 测试是否成功
[root@linux-node1~]# glance image-list +----+------+ | ID | Name | +----+------+ +----+------+ [root@linux-node1~]#
5.10 下载一个镜像测试
wgethttp://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
5.11 上传镜像到glance
openstack image create "cirros" \ --file cirros-0.3.4-x86_64-disk.img \ --disk-format qcow2 --container-format bare \ --public
5.12 再次查看镜像
[root@linux-node1~]# glance image-list +--------------------------------------+--------+ | ID | Name | +--------------------------------------+--------+ |2a71519f-59c6-4f11-994e-7d55c3e82110 | cirros | +--------------------------------------+--------+ [root@linux-node1~]#
5.13说明镜像存放的目录
[root@linux-node1images]# pwd /var/lib/glance/images [root@linux-node1images]# ls 2a71519f-59c6-4f11-994e-7d55c3e82110#id一样的 [root@linux-node1images]#
本文出自 “砖家博客” 博客,请务必保留此出处http://wsxxsl.blog.51cto.com/9085838/1883667
5-openstack之glance
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。