[Tweet “This tutorial is on OpenStack’s Image Service Glance”]
This tutorial is on OpenStack’s Image Service Glance – its components and step-by-step guide to install and use Glance.
The OpenStack Image Service called Glance provides discovery, registration and delivery services for disk and server images.
It has the ability to copy (or snapshot) a server image and then to store it promptly. Stored images then can be used as templates to get new servers up and running quickly, and can also be used to store and catalog unlimited backups.
Virtual-machine images can be stored in various locations, including simple filesystems and object-storage systems such as OpenStack Object Storage (code named Swift).
Glance includes the following components:
❖ Glance-api: Accepts Image API calls for image discovery, retrieval and storage.
❖ Glance-registry: Stores, processes, and retrieves metadata for images. Metadata includes size, type and so on.
❖ Database: Stores image metadata and supports many backends, including MySQL, SQlite and mongodb.
❖ Storage repository: Supports normal file systems, RADOS block devices, Amazon S3 and HTTP for image storage.
a. Install Glance services.
#apt-get install glance python-glanceclient
b. Create database. Glance uses database to store information. In this case, we’ll use MySQL as the default.
> create database glance;
> grant all privileges on glance.* to glanceUser@localhost identified by ‘StrongPass’;
> grant all privileges on keystone.* to glanceUser@'%' identified by ‘StrongPass’;
c. Create Glance user and add the user to tenant service with admin role.
# keystone user-create --name=glance --pass=90b68569e6da --firstname.lastname@example.org
# keystone user-role-add --user=glance --tenant=service --role=admin
d. Register Glance service at Keystone.
# keystone service-create --name=glance --type=image --description="Glance Image Service"
e. Create Glance endpoint by using the the Glance service id as the service-id.
# keystone endpoint-create --service-id=a3f9c625a3b9443f8e66bf4e5de2349f --publicurl=http://192.168.100.10:9292 --internalurl=http://192.168.100.10:9292--adminurl=http://192.168.100.10:9292
f. Change database connection at Glance configuration and the Keystone user details.
g. Edit /etc/glance/glance-registry.conf and /etc/glance/glance-api.conf and change the database connection string.
sql_connection = mysql://glanceUser:StrongPass@localhost/glance
h. Now change Keystone authentication details under the [keystone_authentication] section:
auth_uri = http://192.168.100.10:5000
auth_host = 192.168.100.10
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = 90b68569e6da
Also change flavor to Keystone under the [paste_deploy] section:-
flavor = keystone
i. Edit /etc/glance/glance-registry-paste.ini and /etc/glance/glance-api-paste.ini and change [filter:authtoken].
j. Finally, restart Glance services.
# service glance-registry restart
# service glance-api restart