Openstack installation : Image Services – Glance.

Content from “openstack.org”, listed here with minor/no changes – just noting down what I did – online notes.

Create the database

CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '{password}';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '{password}';

As admin user create service credentials for glance user.

$ . admin-openrc

Create the glance user:

$ 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 and configure components

apt install --assume-yes glance

Edit the /etc/glance/glance-api.conf file and complete the following actions:
In the [database] section, configure database access:

[database]
connection = mysql+pymysql://glance:{password}@controller/glance
...

In the [keystone_authtoken] and [paste_deploy] sections, configure Identity service access: (Comment out or remove any other options in the [keystone_authtoken] section.)

[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 [glance_store] section, configure the local file system store and location of image files:

[glance_store]
...
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

Edit the /etc/glance/glance-registry.conf file and complete the following actions:

Note : The Glance Registry Service and its APIs have been DEPRECATED in the Queens release and are subject to removal at the beginning of the ā€˜Sā€™ development cycle, following the OpenStack standard deprecation policy.

In the [database] section, configure database access:

[database]
...
connection = mysql+pymysql://glance:{password}@controller/glance

In the [keystone_authtoken] and [paste_deploy] sections, configure Identity service access: ( Comment out or remove any other options in the [keystone_authtoken] section.)

[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

flavor = keystone

Populate the Image service database: (Ignore any deprecation messages)

#su -s /bin/sh -c "glance-manage db_sync" glance

Restart the Image services:

#service glance-registry restart
#service glance-api restart

Verify operation of the Image service using CirrOS, a small Linux image that helps you test your OpenStack deployment. Source the admin credentials to gain access to admin-only CLI commands

 $ . admin-openrc 

Download the source image:

$ wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img

Upload the image to the Image service using the QCOW2 disk format, bare container format, and public visibility so all projects can access it:

$ openstack image create "cirros" --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --container-format bare --public

$ openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| 7a53530c-020e-4b44-8248-3cf041609f82 | cirros | active |
+--------------------------------------+--------+--------+

About sandeep

Passionate about sharing information on "how to".
This entry was posted in Installation / How To, Notes and tagged , , , , , , , . Bookmark the permalink.