Create database and grant privileges (from MySQL prompt)
CREATE DATABASE glance; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'commonpass'; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'commonpass'; FLUSH PRIVILEGES; exit
Create glance user
. admin-openrc openstack user create --domain default --password-prompt glance
Add the admin
role to the glance
user and service
project
openstack role add --project service --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-api.conf
Change the connection configuration in [database] section to
[database]
connection = mysql+pymysql://glance:commonpass@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 = service username = glance password = commonpass [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 +------------------+----------------------------------------------------------------------------------+ | Property | Value | +------------------+----------------------------------------------------------------------------------+ | checksum | 443b7623e27ecf03dc9e01ee93f67afe | | container_format | bare | | created_at | 2020-10-07T09:27:23Z | | disk_format | qcow2 | | id | 59924307-6b58-4bcf-8f8b-fb9666f5b2c6 | | min_disk | 0 | | min_ram | 0 | | name | cirros | | os_hash_algo | sha512 | | os_hash_value | 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e | | | 2161b5b5186106570c17a9e58b64dd39390617cd5a350f78 | | os_hidden | False | | owner | fff0b7a4d94448498d8703c8aa1a5d8b | | protected | False | | size | 12716032 | | status | active | | tags | [] | | updated_at | 2020-10-07T09:27:23Z | | virtual_size | Not available | | visibility | public | +------------------+----------------------------------------------------------------------------------+ glance image-list +--------------------------------------+--------+ | ID | Name | +--------------------------------------+--------+ | 59924307-6b58-4bcf-8f8b-fb9666f5b2c6 | cirros | +--------------------------------------+--------+