Rate This Document
Findability
Accuracy
Completeness
Readability

Installing Glance

Glance provides a catalog service for storing and querying virtual drive images of VM instances. Nova computing service components can use this service when VM instances are running. Install Glance on the controller node.

  1. Create a database, a service credential, and API endpoints.
    1. Log in to the database as the root user.
      mysql -u root -p
    2. In the database, create a Glance database and grant permissions.
      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'; 

      Replace GLANCE_DBPASS with the password of the Glance database user as required. The password cannot contain the characters including #@$ and can contain the special characters including &=-_.+!*()

    1. Exit the database.
      exit
    2. Create a service credential.
      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

      The password cannot contain the characters including #@$ and can contain the special characters including &=-_.+!*()

    3. Create API endpoints for the image service.
      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
  1. Install the software package.
    yum install openstack-glance
  2. Configure Glance.
    1. Modify the /etc/glance/glance-api.conf file.
      vi /etc/glance/glance-api.conf
    2. Press i to enter the insert mode and add the following content:
      [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/
    • The [database] field is used to configure the database parameters.
    • The [keystone_authtoken] and [paste_deploy] fields are used to configure the identity authentication service entry.
    • The [glance_store] field is used to configure the image file storage.
    • GLANCE_DBPASS indicates the password of the Glance database. Replace it with the actual password.
    • GLANCE_PASSWORD is the password of the Glance user. Replace it with the actual password.
    1. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  3. Synchronize the database.
    su -s /bin/sh -c "glance-manage db_sync" glance
  4. Start the service.
    systemctl enable openstack-glance-api.service 
    systemctl start openstack-glance-api.service
  5. Check whether Glance is successfully installed.
    1. Download the image.
      wget https://download.cirros-cloud.net/0.5.2/cirros-0.5.2-aarch64-disk.img --no-check-certificate
    2. Upload the cirros image to the image service.
      source ~/.admin-openrc 
      openstack image create --disk-format qcow2 --container-format bare --file cirros-0.5.2-aarch64-disk.img --public cirros
    3. Confirm the image upload and verify the attributes.
      openstack image list
    4. Delete the created cirros image.
      openstack image delete cirros