CREATE DATABASE glance;GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';FLUSH PRIVILEGES;source admin-openrc.shkeystone user-create --name glance --pass GLANCE_PASSkeystone user-role-add --user glance --tenant service --role adminkeystone service-create --name glance --type image --description "OpenStack Image Service"keystone endpoint-create --service-id $(keystone service-list | awk '/ image / {print $2}') --publicurl https://controller:9292 --internalurl https://controller:9292 --adminurl https://controller:9292 --region regionOneyum install openstack-glance python-glanceclient
[database]
connection = mysql://glance:GLANCE_DBPASS@controller/glance
[keystone_authtoken]
auth_uri = https://controller:5000/v2.0
identity_uri = https://controller:35357
admin_tenant_name = service
admin_user = glance
admin_password = GLANCE_PASS
[paste_deploy]
flavor = keystone
[DEFAULT]
verbose = True
database、keystone_authtoken、paste_deploy 區段同上;DEFAULT 同樣啟用 verbose = True。
su -s /bin/sh -c "glance-manage db_sync" glance
systemctl enable openstack-glance-api openstack-glance-registry --now
mkdir /tmp/images && cd /tmp/images
wget https://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img
source admin-openrc.sh
glance image-create --name "cirros-0.3.3-x86_64" --file cirros-0.3.3-x86_64-disk.img --disk-format qcow2 --container-format bare --is-public True --progress
glance image-list
rm -r /tmp/images
若 glance image-list 顯示狀態 active,即代表映像服務部署成功。