Quantcast
Channel: Lingesh, Author at UnixArena
Viewing all articles
Browse latest Browse all 369

Openstack – Installing & Configuring Glance – Part 4

$
0
0

This article will guide you to configure the Image service on Openstack. Openstack image service has been development and maintained in the name of Glance. Glance service enables users/customers  to discover , register and retrieve virtual machine images. Virtual machine images can be stored in normal file-systems like ext3 ,ext4 or it can be stored it in object storage systems like swift. In this article , we will use the local file-system as glance storage. Image service consists below listed components.

  • glance-api :  Accepts Image API calls for vm image discovery, retrieval, and storage.
  • glance-registry. Stores images, processes, and retrieves metadata about images. Metadata includes items such as size and type.
  • Database – Glance service require database to store the image metadata. You can either use MySQL or SQlite database.
  • Storage repository – Image service (glance) supports many storage repositories including normal file-systems , Object storage, RADOS block devices , HTTP and Amazon S3 .

In short, openstack Glance service works like a  registry service for virtual disk images. Using glance service,  openstack users can add new instance images (Ex:RHEL , SUSE , Windows Server , Ubunutu) , snapshot of image from existing instance and launch the instance using the snapshot.

In our environment , Controller node will host the glance service.  So login to the Openstack controller node and begin the glance installation.

 

 

Install the Image Service:

 

1.Install glance image service components on openstack controller node.

root@OSCTRL-UA:/var/lib# apt-get install glance python-glanceclient
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  glance-api glance-common glance-registry python-boto python-cinderclient
  python-concurrent.futures python-glance python-glance-store python-httplib2
  python-ipaddr python-json-patch python-json-pointer python-jsonpatch
  python-oslo.vmware python-osprofiler python-retrying python-simplegeneric
  python-simplejson python-suds python-swiftclient python-warlock python-wsme
Suggested packages:
  python-ceph
The following NEW packages will be installed:
  glance glance-api glance-common glance-registry python-boto
  python-cinderclient python-concurrent.futures python-glance
  python-glance-store python-glanceclient python-httplib2 python-ipaddr
  python-json-patch python-json-pointer python-jsonpatch python-oslo.vmware
  python-osprofiler python-retrying python-simplegeneric python-simplejson
  python-suds python-swiftclient python-warlock python-wsme
0 upgraded, 24 newly installed, 0 to remove and 17 not upgraded.
Need to get 1,667 kB of archives.
After this operation, 12.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:23 http://in.archive.ubuntu.com/ubuntu/ trusty/main python-concurrent.futures all 2.1.6-3 [32.8 kB]
Get:24 http://in.archive.ubuntu.com/ubuntu/ trusty/main python-httplib2 all 0.8-2build1 [35.4 kB]
Fetched 1,667 kB in 12s (136 kB/s)
Selecting previously unselected package python-simplejson.
(Reading database ... 95790 files and directories currently installed.)
Preparing to unpack .../python-simplejson_3.3.1-1ubuntu6_amd64.deb ...
Unpacking python-simplejson (3.3.1-1ubuntu6) ...
Selecting previously unselected package python-cinderclient.
Preparing to unpack .../python-cinderclient_1%3a1.1.0-0ubuntu1~cloud0_all.deb ...
Unpacking python-cinderclient (1:1.1.0-0ubuntu1~cloud0) ...
Selecting previously unselected package python-glance-store.
Preparing to unpack .../python-glance-store_0.1.8-1ubuntu2~cloud0_all.deb ...
Unpacking python-glance-store (0.1.8-1ubuntu2~cloud0) ...
Selecting previously unselected package python-json-pointer.
Preparing to unpack .../python-json-pointer_1.0-2build1_all.deb ...
Unpacking python-json-pointer (1.0-2build1) ...
Selecting previously unselected package python-jsonpatch.
Preparing to unpack .../python-jsonpatch_1.3-4_all.deb ...
Unpacking python-jsonpatch (1.3-4) ...
Selecting previously unselected package python-json-patch.
Preparing to unpack .../python-json-patch_1.3-4_all.deb ...
Unpacking python-json-patch (1.3-4) ...
Selecting previously unselected package python-suds.
Setting up python-swiftclient (1:2.3.0-0ubuntu1~cloud0) ...
Setting up python-glance (1:2014.2.3-0ubuntu1~cloud1) ...
Setting up glance-common (1:2014.2.3-0ubuntu1~cloud1) ...
Adding system user `glance' (UID 112) ...
Adding new user `glance' (UID 112) with group `glance' ...
Not creating home directory `/var/lib/glance'.
Setting up glance-api (1:2014.2.3-0ubuntu1~cloud1) ...
glance-api start/running, process 4146
Setting up glance-registry (1:2014.2.3-0ubuntu1~cloud1) ...
glance-registry start/running, process 4181
Setting up python-glanceclient (1:0.14.0-0ubuntu1~cloud0) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up glance (1:2014.2.3-0ubuntu1~cloud1) ...
root@OSCTRL-UA:/var/lib#

 

2. Edit the glance-api & glance-registry configuration files to update the MySQL  DB information.  As I said earlier, glance service required DB to storage the information. please refer part 2 to see the password database.

root@OSCTRL-UA:/var/lib# egrep "database|mysql:" /etc/glance/glance-api.conf  |grep -v "#"
[database]
connection = mysql://glance:glancedb123@OSCTRL-UA/glance
root@OSCTRL-UA:/var/lib#

root@OSCTRL-UA:~# egrep "database|mysql:" /etc/glance/glance-registry.conf  |grep -v "#"
[database]
connection = mysql://glance:glancedb123@OSCTRL-UA/glance
root@OSCTRL-UA:~#

  • Password- glancedb123
  • Controller Node – OSCTRL-UA

 

3.Configure the glance image service to use RabbitMQ  (Message Broker). Update the RabbitMQ host , password information on glance-api.conf. For pre-configured password , please refer part 2.

root@OSCTRL-UA:~# grep rabbit /etc/glance/glance-registry.conf
rpc_backend = rabbit
# Configuration options if sending notifications via rabbitmq (these are
rabbit_host = OSCTRL-UA
rabbit_port = 5672
rabbit_use_ssl = false
rabbit_userid = guest
rabbit_password = rabbit123
rabbit_virtual_host = /
rabbit_notification_exchange = glance
rabbit_notification_topic = notifications
rabbit_durable_queues = False
root@OSCTRL-UA:~#


root@OSCTRL-UA:~# grep rabbit /etc/glance/glance-api.conf
rpc_backend = rabbit
# Configuration options if sending notifications via rabbitmq (these are
rabbit_host = OSCTRL-UA
rabbit_port = 5672
rabbit_use_ssl = false
rabbit_userid = guest
rabbit_password = rabbit123
rabbit_virtual_host = /
rabbit_notification_exchange = glance
rabbit_notification_topic = notifications
rabbit_durable_queues = False
root@OSCTRL-UA:~#

 

Please remove if there is any sqlite tables .

# rm /var/lib/glance/glance.sqlite

 

4. Create the Database & users for  Glance on mysql.

root@OSCTRL-UA:~# mysql -u root -pstack
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 36
Server version: 5.5.44-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE glance;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glancedb123';
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glancedb123';
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

 

5. Create the necessary tables for glance service using the below command.

root@OSCTRL-UA:~# su -s /bin/sh -c "glance-manage db_sync" glance
root@OSCTRL-UA:~#

 

Preparing keystone service for glance:

 

6. Export the variable or create the file like below & source it. (To reduce the command length. Otherwise you need to provide the below credentials on all the commands)

root@OSCTRL-UA:~# cat admin.rc
export OS_USERNAME=admin
export OS_PASSWORD=admin123
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://OSCTRL-UA:35357/v2.0
root@OSCTRL-UA:~#
root@OSCTRL-UA:~# source admin.rc

 

7. Create the glance user on keystone . This user will be used to authenticate with keystone service.

root@OSCTRL-UA:~# keystone user-create --name=glance --pass=glance123 --email=glance@unixarena.com
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |       glance@unixarena.com       |
| enabled  |               True               |
|    id    | e19954b08ac34e39b5f8b87001910734 |
|   name   |              glance              |
| username |              glance              |
+----------+----------------------------------+
root@OSCTRL-UA:~#

 

8. Add admin role to the glance user.

root@OSCTRL-UA:~# keystone user-role-add --user=glance --tenant=service --role=admin
root@OSCTRL-UA:~#

 

Configure image service to use keystone:

 

9. Configure the image service to use keystone server by editing the glance configuration files like below.

root@OSCTRL-UA:~# grep -A9 keystone_authtoken /etc/glance/glance-api.conf
[keystone_authtoken]
auth_uri = http://OSCTRL-UA:5000
auth_host = OSCTRL-UA
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = glance123
revocation_cache_time = 10
root@OSCTRL-UA:~#


root@OSCTRL-UA:~# grep -A9  keystone_authtoken /etc/glance/glance-registry.conf
[keystone_authtoken]
auth_uri = http://OSCTRL-UA:5000
auth_host = OSCTRL-UA
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = glance123
revocation_cache_time = 10

root@OSCTRL-UA:~#

 

10. Set the flavour as keystone on both glance configuration files.

root@OSCTRL-UA:~# grep -A8 paste_deploy /etc/glance/glance-registry.conf
[paste_deploy]
# Name of the paste configuration file that defines the available pipelines
#config_file = glance-registry-paste.ini

# Partial name of a pipeline in your paste configuration file with the
# service name removed. For example, if your paste section name is
# [pipeline:glance-registry-keystone], you would configure the flavor below
# as 'keystone'.
flavor=keystone
root@OSCTRL-UA:~#



root@OSCTRL-UA:~# grep -A8 paste_deploy /etc/glance/glance-api.conf
[paste_deploy]
# Name of the paste configuration file that defines the available pipelines
#config_file = glance-api-paste.ini

# Partial name of a pipeline in your paste configuration file with the
# service name removed. For example, if your paste section name is
# [pipeline:glance-api-keystone], you would configure the flavor below
# as 'keystone'.
flavor=keystone
root@OSCTRL-UA:~#

 

Click Next Page to Continue …….

 

The post Openstack – Installing & Configuring Glance – Part 4 appeared first on UnixArena.


Viewing all articles
Browse latest Browse all 369

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>