Glance用于存储和检索虚拟机实例磁盘镜像。在虚拟机实例运行期间,Nova计算服务组件可以使用此服务。请在控制节点安装Glance。
1 | mysql -u root -p |
1 2 3 | CREATE DATABASE glance; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS'; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS'; |
将GLANCE_DBPASS替换为Glance数据库用户的密码,请根据实际需要进行设置。密码中请勿包含字符“#@$”,支持特殊字符“&=- _ . + ! * ()”。
1 | exit
|
source ~/.admin-openrc openstack user create --domain default --password-prompt glance openstack role add --project service --user glance admin openstack service create --name glance --description "OpenStack Image" image
密码中请勿包含字符“#@$”,支持特殊字符“&=- _ . + ! * ()”
openstack endpoint create --region RegionOne image public http://controller:9292 openstack endpoint create --region RegionOne image internal http://controller:9292 openstack endpoint create --region RegionOne image admin http://controller:9292
yum install openstack-glance
vi /etc/glance/glance-api.conf
[database] connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance [keystone_authtoken] www_authenticate_uri = http://controller:5000 auth_url = http://controller:5000 memcached_servers = controller:11211 auth_type = password project_domain_name = Default user_domain_name = Default project_name = service username = glance password = GLANCE_PASSWORD [paste_deploy] flavor = keystone [glance_store] stores = file,http default_store = file filesystem_store_datadir = /var/lib/glance/images/
su -s /bin/sh -c "glance-manage db_sync" glance
systemctl enable openstack-glance-api.service systemctl start openstack-glance-api.service
wget https://download.cirros-cloud.net/0.5.2/cirros-0.5.2-aarch64-disk.img --no-check-certificate
source ~/.admin-openrc openstack image create --disk-format qcow2 --container-format bare --file cirros-0.5.2-aarch64-disk.img --public cirros
openstack image list
openstack image delete cirros