How to integrate glusterfs with openstack glance ?

In this article I am going to show you the integration of glusterfs with Openstack glance. This setup is quite easy and similar like my previous article of glusterfs integration with cinder.

********************************************************Gluster Setup****************************************************

Step 1 : I have created on one volume on gluster with name vol2. This volume is replicated on two gluster nodes.

Step 2 : I checked the permission of glance user on openstack node using “id glance” command. I set the same user and group permission on volume on gluster node.

[root@Glusternode1 ~]# gluster vol set vol2  storage.owner-uid 161
volume set: success
[root@Glusternode1 ~]# gluster vol set vol2  storage.owner-gid 161
volume set: success

I turnoff the readdir-ahead option to avoid any issue while mounting using fuse.

[root@Glusternode1 ~]# gluster vol set vol2 readdir-ahead off
volume set: success

Step 3 : We have done with gluster part now next steps will be on openstack node.

*********************************************Openstack setup**************************************************************

Step 1 : We need to edit the glance configuration file to use the glusterfs as backend for it.

I took the backup of configuration file.

[root@node1 ~(keystone_admin)]# cp -p /etc/glance/glance-api.conf /var/tmp/

Step 2 : Edited the configuration file to use the glusterfs as backend to store the glance images.

I have done the below modification in configuration file.

[root@node1 ~(keystone_admin)]# diff /etc/glance/glance-api.conf /var/tmp/glance-api.conf
297c297
< filesystem_store_datadir=/mnt/gluster/glance/images/          <<<<<<<<<<<<<

> filesystem_store_datadir=/var/lib/glance/images/

Create directory and change the permissions of that directory.

[root@node1 ~(keystone_admin)]# mkdir -p /mnt/gluster/glance/images
[root@node1 ~(keystone_admin)]# chown -R glance:glance /mnt/gluster/glance/

Step 3 : After that restart the glance service to reflect the changes.

[root@node1 ~(keystone_admin)]# systemctl restart openstack-glance-api

Step 4 : Mount the glusterfs volume using fuse and we can add the entry in /etc/fstab to make it persistent.

[root@node1 ~(keystone_admin)]# mount -t glusterfs 192.168.111.84:/vol2 /mnt/gluster/

Step 5 : Upload two images using openstack gui. Checked the status from CLI.

[root@node1 ~(keystone_admin)]# glance image-list
+————————————–+————-+————-+——————+———+——–+
| ID                                   | Name        | Disk Format | Container Format | Size    | Status |
+————————————–+————-+————-+——————+———+——–+
| 3a446007-8db5-427b-9177-51e1192a7b67 | FirstImage  | vmdk        | bare             | 4824    | active |
| 3d844393-fc43-44f0-aff1-3fa48e669c00 | SecondImage | vmdk        | bare             | 7499776 | active |
+————————————–+————-+————-+——————+———+——–+

Step 6 : Checked the status on gluster node bricks we can see the uploaded images there as well.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s