Openstack Liberty Lab Part 4: Configure Glance Image Service

The
You can support us by downloading this article in PDF format via the link below.

Download the guide in PDF format

turn off
The

The
The

Glance is an imaging service that enables users to discover, register, and retrieve virtual machine images.
I assume that you have installed the glance openstack image service in Part 1 of this experimental series. If not, please go back and do it again. The link can be found from the content introduced so far:

Openstack Liberty Lab Part 1: Setting up the network and all prerequisites

Openstack Liberty Lab Part 2: Install the Openstack software package

Openstack Liberty Lab Part 3: Configure Keystone Identity Service

The steps to configure the Glance image service are:

  1. Add users and databases needed for glance service.
[[email protected] ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 17
Server version: 5.5.44-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. 
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. 
MariaDB [(none)]> create database glance;
Query OK, 1 row affected (0.00 sec) 
MariaDB [(none)]> grant all privileges on glance.* to [email protected]'localhost' identified by 'moonstack';
Query OK, 0 rows affected (0.00 sec) 
MariaDB [(none)]> grant all privileges on glance.* to [email protected]'%' identified by 'moonstack';
Query OK, 0 rows affected (0.00 sec) 
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

moonstack: Replace with the required browsing user password.

  1. Add glance user and assign user Admin role:
[[email protected] ~]# openstack user create --domain default --project service --password moonstack glance
+--------------------+----------------------------------+
| Field | Value | 
+--------------------+----------------------------------+
| default_project_id | 9c3ec09f5e08442eb211612f99cd22ad |
| domain_id | default |
| enabled | True |
| id | 468470e8892343779e638e97d151197f | 
| name | glance |
+--------------------+----------------------------------+
[[email protected] ~]# openstack role add --project service --user glance admin 
[[email protected] ~]#
  1. Crete at a glance service items
[[email protected] ~]# openstack service create --name glance --description "OpenStack Image service" image 
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Image service |
| enabled | True |
| id | a55210ba42074c36856d49a90cd5795d |
| name | glance |
| type | image |
+-------------+----------------------------------+

[[email protected] ~]# 
  1. Create endpoints for saccade image services; internal, administrator, and public:
[[email protected] ~]# export controller=192.168.1.60 
[[email protected] ~]# openstack endpoint create --region RegionOne image public http://$controller:9292 
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 23fd8f981f504d7e9cce0df5a5a865a5 | 
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | a55210ba42074c36856d49a90cd5795d |
| service_name | glance | 
| service_type | image |
| url | http://192.168.1.60:9292 |
+--------------+----------------------------------+
[[email protected] ~]# openstack endpoint create --region RegionOne image internal http://$controller:9292 
+--------------+-------------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------------+
| enabled | True |
| id | 2405df88c0024905b381dedec31af38e |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | a55210ba42074c36856d49a90cd5795d |
| service_name | glance |
| service_type | image |
| url | http://192.168.1.60:9292 | 
+--------------+---------------------------------------------------+
[[email protected] ~]# openstack endpoint create --region RegionOne image admin http://$controller:9292 
+--------------+-------------------------------------------+
| Field | Value | 
+--------------+-------------------------------------------+
| enabled | True |
| id | 681d673dc4384fb09874e41b1f40e9d1 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | a55210ba42074c36856d49a90cd5795d |
| service_name | glance |
| service_type | image |
| url | http://192.168.1.60:9292 |
+--------------+--------------------------------------------+
[[email protected]ntroller ~]#
  1. Confirm the settings:
[[email protected] ~]# openstack service list
+----------------------------------+----------+----------+
| ID | Name | Type |
+----------------------------------+----------+----------+
| 4d3aa109aa534ceb92187549a5e728bf | keystone | identity |
| a55210ba42074c36856d49a90cd5795d | glance | image |
+----------------------------------+----------+----------+
[[email protected] ~]# openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+--------------------------------+
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+----------------------------------+-----------+--------------+--------------+---------+-----------+--------------------------------+
| 23fd8f981f504d7e9cce0df5a5a865a5 | RegionOne | glance | image | True | public | http://192.168.1.60:9292 |
| 2405df88c0024905b381dedec31af38e| RegionOne | glance | image | True | internal | http://192.168.1.60:9292 |
| 651d5f5fc4bb4d6db1b74b217b6fcda5 | RegionOne | keystone | identity | True | public | http://192.168.1.60:5000/v2.0 |
| 681d673dc4384fb09874e41b1f40e9d1 | RegionOne | glance | image | True | admin | http://192.168.1.60:9292 |
| 81b112cbfbd949578262a4fd3ebce9fd | RegionOne | keystone | identity | True | admin | http://192.168.1.60:35357/v2.0 |
| f714e382f39748afaf8bd2d5e0054c24 | RegionOne | keystone | identity | True | internal | http://192.168.1.60:5000/v2.0 |
+----------------------------------+-----------+--------------+--------------+---------+-----------+--------------------------------+
[[email protected] ~]#
  1. Overview configuration,
  • Write /etc/glance/glance-registry.conf configuration:
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf database connection mysql://glance:[email protected]/glance
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://192.168.1.60:5000
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_url http://192.168.1.60:35357
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_plugin password
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_domain_id default
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken user_domain_id default
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_name service
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken username glance
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken password moonstack
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf DEFAULT notification_driver noop
  • Write to /etc/glance/glance-api.conf file
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf database  connection  mysql://glance:[email protected]/glance
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  auth_uri http://192.168.1.60:5000
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  auth_url http://192.168.1.60:35357
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  auth_plugin  password
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  project_domain_id  default
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  user_domain_id default
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  project_name service
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  username glance
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  password  moonstack
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf glance_store default_store file
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf DEFAULT notification_driver noop
[[email protected] ~]# 

Moonstone in the keystone_authtoken part: Replace with the password you selected for the glance user in the identity service. 192.168.1.60: IP address of the server/controller monthly stack of the database section: equivalent to the password you selected for the Image service database

  1. Fill the image service database:
[[email protected] ~]# su -s /bin/sh -c "glance-manage db_sync" glance
  1. Start the imaging service and configure it to start when the system boots:
[[email protected] ~]# systemctl enable openstack-glance-api.service openstack-glance-registry.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.service to /usr/lib/systemd/system/openstack-glance-registry.service.
[[email protected] ~]# 
[[email protected] ~]# systemctl start openstack-glance-api.service openstack-glance-registry.service

Check the status of openstack-glance-api.service and openstack-glance-registry.service

[[email protected] ~]#Systemctl status openstack-glance-api.service openstack-glance-registry.service ● openstack-glance-api.service – OpenStack image service (codename Glance) API server is loaded: loaded (/usr/lib/systemd/system/ openstack -glance-api.service; enabled; vendor preset: disabled) Activity: Active since Monday 2016-03-28 18:25:58 EAT (running); Main PID before 25s: 27278 (glance -api) CGroup: /system.slice/openstack-glance-api.service

├─27278/ usr / bin / python2 / usr / bin /glance-api├─27300/ usr / bin / python2 / usr / bin /glance-api├─27301/ usr / bin / python2 / usr / bin / glance- api├─27302/ usr / bin / python2 / usr / bin /glance-api└─27303/ usr / bin / python2 / usr / bin / glance-api

March 28 18:25:56 Controller systemd[1]: Starting the OpenStack image service (codename Glance) API server…Mar 28 18:25:57 controller glance-api[27278]: Cannot find the handler for the recording program “oslo_config.cfg” March 28 18:25:58 controller systemd[1]: Started the OpenStack Image Service (codename Glance) API server. ●openstack-glance-registry.service – OpenStack image service (codename Glance) registry server is loaded: loaded (/usr/lib/systemd/system/openstack-glance-registry.service; enabled; vendor presets: (Disabled) Activity: The activity (running) has been eaten since Monday, March 28, 2016; 26s before the main PID: 27279 (glance-registry) CGroup: /system.slice/openstack-glance-registry.service

├─27279/ usr / bin / python2 / usr / bin /glance-registry├─27296/ usr / bin / python2 / usr / bin /glance-registry├─27297/ usr / bin / python2 / usr / bin / glance- Registration form├─27298/ usr / bin / python2 / usr / bin /glance-registry└─27299/ usr / bin / python2 / usr / bin / glance-registry

March 28 18:25:56 Controller systemd[1]: Starting the OpenStack image service (codename Glance) registry server… Mar 28 18:25:57 controller glance-registry[27279]: Cannot find the handler for the recording program “oslo_config.cfg” March 28 18:25:57 controller systemd[1]: Started the OpenStack Image Service (codename Glance) registry server

We have successfully configured the Glance image service. In the next tutorial, we will add the image that Glance will store. We will manually create a glance image of CentOS and Ubuntu.

Previous:

Openstack Liberty Lab Part 3: Configure Keystone Identity Service

Next article:

Openstack Liberty Lab Part 5: Configure Nova Computing Service

The
You can support us by downloading this article in PDF format via the link below.

Download the guide in PDF format

turn off
The

The
The

Sidebar