On the controller node :
Create database for Glance (Image) services (from MySQL prompt)
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit
Create an user account for glance service.
. admin-openrc
openstack user create --domain default --password-prompt glance
Add the admin
role to the glance
user / homelab project
openstack role add --project homelab --user glance admin
Create the glance
service entity
openstack service create --name glance --description "OpenStack Image" image
Create the Image service API endpoints
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
Install package
apt install -y glance
Update the configuration in /etc/glance/glance-api.conf
Change the connection configuration in [database] section to
[database]
connection = mysql+pymysql://glance:password@controller/glance
Add the following configurations in respective sections (observed that all configuration by default were commented – so just adding these)
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[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 = homelab
username = glance
password = password
[paste_deploy]
flavor = keystone
Populate the service database
su -s /bin/sh -c "glance-manage db_sync" glance
Restart the Image services
service glance-api restart
Verify image service operations – Download and add an image to repository
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
. admin-openrc
glance image-create --name "cirros" --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public
glance image-list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
| 59924307-6b58-4bcf-8f8b-fb9666f5b2c6 | cirros |
+--------------------------------------+--------+