• Resources
  • Blog
  • (Tutorial) What is Glance and how to install and use Glance?

(Tutorial) What is Glance and how to install and use Glance?

[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.

Introduction

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.

Installing Glance


a. Install Glance services.

<i>#apt-get install glance python-glanceclient</i>

b. Create database. Glance uses database to store information. In this case, we’ll use MySQL as the default.

<i>#mysql</i>
<i>&gt; create database glance;</i>
<i>&gt; grant all privileges on glance.* to glanceUser@localhost identified by ‘StrongPass’;</i>
<i>&gt; grant all privileges on keystone.* to glanceUser@'%' identified by ‘StrongPass’;</i>

c. Create Glance user and add the user to tenant service with admin role.

<i># keystone user-create --name=glance --pass=90b68569e6da --email=glance@flux7.com</i>
<i># keystone user-role-add --user=glance --tenant=service --role=admin
 </i>

d. Register Glance service at Keystone.

<i># keystone service-create --name=glance --type=image --description="Glance Image Service"</i>

e. Create Glance endpoint by using the the Glance service id as the service-id.

<i># keystone endpoint-create --service-id=a3f9c625a3b9443f8e66bf4e5de2349f --publicurl=</i><a href="http://controller:9292/"><i>http://192.168.100.10:9292</i></a><i> --internalurl=http://192.168.100.10:9292--adminurl=http://192.168.100.10:9292</i>

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.

<i>sql_connection = mysql://glanceUser:StrongPass@localhost/glance</i>

h. Now change Keystone authentication details under the [keystone_authentication] section:

<i>[keystone_authtoken]</i>
<i>auth_uri = http://192.168.100.10:5000</i>
<i>auth_host = 192.168.100.10</i>
<i>auth_port = 35357</i>
<i>auth_protocol = http</i>
<i>admin_tenant_name = service</i>
<i>admin_user = glance</i>
<i>admin_password = 90b68569e6da</i>

Also change flavor to Keystone under the [paste_deploy] section:-

<i>[paste_deploy]</i>
<i>…</i>
<i>flavor = keystone</i>

i. Edit /etc/glance/glance-registry-paste.ini and /etc/glance/glance-api-paste.ini and change [filter:authtoken].

<i>[filter:authtoken]</i>
<i>paste.filter_factory=keystoneclient.middleware.auth_token:filter_factory</i>
<i>auth_host=192.168.100.10</i>
<i>admin_user=glance</i>
<i>admin_tenant_name=service</i>
<i>admin_password=90b68569e6da</i>

j. Finally, restart Glance services.

<i># service glance-registry restart</i>
<i># service glance-api restart</i>
March 20, 2014 / Openstack

 

 

Share the Post

 

 

About the Author

Flux7 Labs

Subscribe to Email Updates

Connect With Us