Installing, Configuring, and Verifying Glance
Glance provides a catalog service for storing and querying virtual disk images of VM instances. Nova computing service components can use this service when VM instances are running.
Install, configure, and verify Glance on controller nodes.
Creating the Glance Database
- Access the MySQL database.
1mysql -u root -p
- Create a database for Glance.
1CREATE DATABASE glance;
- Grant proper access to the database, set the PASSWORD for accessing the database, and run the exit command to exit the database.
1 2
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '<PASSWORD>'; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '<PASSWORD>';

Creating Roles and Users
- Log in to the OpenStack CLI as the admin user.
1source /etc/keystone/admin-openrc
- Create the glance user.
1openstack user create --domain default --password-prompt glance
- Add the role to the project and user.
1openstack role add --project service --user glance admin

- Creates a service entity.
1openstack service create --name glance --description "OpenStack Image" image
- Create API endpoints of the Image service.
1openstack endpoint create --region RegionOne image public http://controller:9292

1 2
openstack endpoint create --region RegionOne image internal http://controller:9292 openstack endpoint create --region RegionOne image admin http://controller:9292

Installing and Configuring Glance
- Install Glance using Yum.
1yum -y install openstack-glance
- Edit the /etc/glance/glance-api.conf file.
- Configure database access in the [database] section.
1 2
[database] connection = mysql+pymysql://glance:<PASSWORD>@controller/glance
Set PASSWORD to the password for accessing the Glance database.
- Configure Identity service access in [keystone_authtoken] and [paste_deploy] sections.
1 2 3 4 5 6 7 8 9 10 11 12
[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 = <PASSWORD> [paste_deploy] flavor = keystone
PASSWORD indicates the password of the Glance user.
- In the [glance_store] section, configure the location where image files are stored in the local file system.
1 2 3 4
[glance_store] stores = file,http default_store = file filesystem_store_datadir = /var/lib/glance/images/
- Configure database access in the [database] section.
- Edit the /etc/glance/glance-registry.conf file and make the following changes:
- In the [database] section, configure database access.
1 2
[database] connection = mysql+pymysql://glance:<PASSWORD>@controller/glance
- Configure Identity service access in [keystone_authtoken] and [paste_deploy] sections.
1 2 3 4 5 6 7 8 9 10 11 12
[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 = <PASSWORD> [paste_deploy] flavor = keystone
- In the [database] section, configure database access.
- Populate the Image service database.
1su -s /bin/sh -c "glance-manage db_sync" glance

- Enable the Image service and configure it to start as the system boots.
1 2
systemctl enable openstack-glance-api.service openstack-glance-registry.service systemctl start openstack-glance-api.service openstack-glance-registry.service

Verifying Glance
- Source the admin credentials to gain access to admin-only CLI commands.
1source /etc/keystone/admin-openrc
- Download the image.
Go to the /var/lib/glance/images directory.
1wget https://download.cirros-cloud.net/0.5.2/cirros-0.5.2-arm-disk.img - Upload the image to Glance.
1openstack image create "cirros-0.5.2" --file cirros-0.5.2-arm-disk.img --disk-format qcow2 --container-format bare --public
- Confirm the uploaded image and its attributes.
1openstack image list
The image upload procedure is for reference only. In actual scenarios, you can create a VM image as required and upload the image to the controller node.
Parent topic: Installation and Verification