本文共 2219 字,大约阅读时间需要 7 分钟。
#先使用脚本登陆admin[root@controller ~]# . admin-openstack.sh
①创建glance user
openstack user create --domain default --password-prompt glance
②关联
openstack role add --project service --user glance admin
③创建glance service
openstack service create --name glance --description "OpenStack Image" image
④创建服务API
openstack endpoint create --region RegionOne image public
openstack endpoint create --region RegionOne image internal openstack endpoint create --region RegionOne image admin
[root@controller ~]# yum install openstack-glance -y
[root@controller ~]# vim /etc/glance/glance-api.conf
[database]connection = mysql+pymysql://glance:glance@controller/glance[keystone_authtoken]auth_uri = http://controller:5000auth_url = http://controller:35357memcached_servers = controller:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = glancepassword = glance[paste_deploy]flavor = keystone[glance_store]stores = file,httpdefault_store = filefilesystem_store_datadir = /var/lib/glance/images/
[root@controller ~]# vim /etc/glance/glance-registry.conf
[database]connection = mysql+pymysql://glance:glance@controller/glance[keystone_authtoken]auth_uri = http://controller:5000auth_url = http://controller:35357memcached_servers = controller:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = glancepassword = glance[paste_deploy]flavor = keystone
[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance[root@controller ~]# mysql -h controller -uglance -pglance -e "use glance;show tables;"
[root@controller ~]# systemctl enable openstack-glance-api.service openstack-glance-registry.service[root@controller ~]# systemctl start openstack-glance-api.service openstack-glance-registry.service
①下载测试镜像
[root@controller ~]# wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
②上传镜像到glance
openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public
③查看镜像列表
openstack image list
转载于:https://blog.51cto.com/lullaby/2170256