Ubuntu 16.04
Sponsored Link

OpenStack Newton : Use Cinder Storage (Multi-Backend)2016/11/20

 
It's possible to use Virtual Storages provided by Cinder if an Instance needs more disks.
Configure Virtual storage with NFS and GlusterFS Multi-Backend on here.
                                      +------------------+           +------------------+
                             10.0.0.50| [ Storage Node ] |  10.0.0.61|                  |
+------------------+            +-----+   Cinder-Volume  |     +-----+   GlusterFS #1   |
| [ Control Node ] |            | eth0|                  |     | eth0|                  |
|     Keystone     |10.0.0.30   |     +------------------+     |     +------------------+
|      Glance      |------------+------------------------------+
|     Nova API     |eth0        |     +------------------+     |     +------------------+
|    Cinder API    |            | eth0| [ Compute Node ] |     | eth0|                  |
+------------------+            +-----+   Nova Compute   |     +-----+   GlusterFS #2   |
                             10.0.0.51|                  |  10.0.0.62|                  |
                                      +------------------+     |     +------------------+
                                                               |
                                                               |     +------------------+
                                                               | eth0|                  |
                                                               +-----+        NFS       |
                                                            10.0.0.40|                  |
                                                                     +------------------+
[1]
NFS server is required to be running on your LAN, refer to here.
On this example, configure "/storage" directory on "nfs.srv.world" as a shared directory.
[2]
GlusterFS server is required to be running on your LAN, refer to here.
This example uses a replication volume "vol_replica" provided by "glfs01" and "glfs02".
[3] Configure Storage Node.
root@storage:~#
apt-get -y install nfs-common glusterfs-client
root@storage:~#
vi /etc/cinder/cinder.conf
# add follows in the [DEFAULT] section

enabled_backends = nfs,glusterfs
# add to the end

[nfs]
volume_driver = cinder.volume.drivers.nfs.NfsDriver
volume_backend_name = NFS
nfs_shares_config = /etc/cinder/nfs_shares
nfs_mount_point_base = $state_path/mnt_nfs
[glusterfs]
volume_driver = cinder.volume.drivers.glusterfs.GlusterfsDriver
volume_backend_name = GlusterFS
glusterfs_shares_config = /etc/cinder/glusterfs_shares
glusterfs_mount_point_base = $state_path/mnt_glusterfs
root@storage:~#
vi /etc/cinder/nfs_shares
# create new : specify NFS shared directories

nfs.srv.world:/storage
root@storage:~#
vi /etc/cinder/glusterfs_shares
# create new : specify GlusterFS volumes

glfs01.srv.world:/vol_replica
root@storage:~#
chmod 640 /etc/cinder/nfs_shares /etc/cinder/glusterfs_shares

root@storage:~#
chgrp cinder /etc/cinder/nfs_shares /etc/cinder/glusterfs_shares

root@storage:~#
systemctl restart cinder-volume

[4] Configure Compute Node to mount NFS and GlusterFS volumes.
root@node01:~#
apt-get -y install nfs-common glusterfs-client
root@node01:~#
vi /etc/nova/nova.conf
# add to the end

[cinder]
os_region_name = RegionOne
root@node01:~#
systemctl restart nova-compute

[5] Create volume types. It's OK to work on any node. (This example is on Control Node)
# set environment variable first

root@dlp ~(keystone)#
echo "export OS_VOLUME_API_VERSION=2" >> ~/keystonerc

root@dlp ~(keystone)#
source ~/keystonerc
root@dlp ~(keystone)#
openstack volume type create nfs

+---------------------------------+--------------------------------------+
| Field                           | Value                                |
+---------------------------------+--------------------------------------+
| description                     | None                                 |
| id                              | 1eb9a09f-a36d-4a84-9ca7-ef57ce6a8720 |
| is_public                       | True                                 |
| name                            | nfs                                  |
| os-volume-type-access:is_public | True                                 |
+---------------------------------+--------------------------------------+

[root@dlp ~(keystone)]#
openstack volume type create glusterfs

+---------------------------------+--------------------------------------+
| Field                           | Value                                |
+---------------------------------+--------------------------------------+
| description                     | None                                 |
| id                              | bd578fd0-73c5-47a8-8f58-022f94673836 |
| is_public                       | True                                 |
| name                            | glusterfs                            |
| os-volume-type-access:is_public | True                                 |
+---------------------------------+--------------------------------------+

[root@dlp ~(keystone)]#
openstack volume type list

+--------------------------------------+-----------+
| ID                                   | Name      |
+--------------------------------------+-----------+
| bd578fd0-73c5-47a8-8f58-022f94673836 | glusterfs |
| 1eb9a09f-a36d-4a84-9ca7-ef57ce6a8720 | nfs       |
+--------------------------------------+-----------+
[6] Create volumes with specifying volume types.
[root@dlp ~(keystone)]#
openstack volume create --type nfs --size 10 disk_nfs

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2016-11-22T07:51:37.165607           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | c54acf2b-0c33-412a-9317-026e44adfc35 |
| migration_status    | None                                 |
| multiattach         | False                                |
| name                | disk_nfs                             |
| properties          |                                      |
| replication_status  | disabled                             |
| size                | 10                                   |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | nfs                                  |
| updated_at          | None                                 |
| user_id             | b48cbdf1975f4fd3987f83a100cc9162     |
+---------------------+--------------------------------------+

[root@dlp ~(keystone)]#
openstack volume create --type glusterfs --size 10 disk_glusterfs

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2016-11-22T07:51:53.701516           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | 7e1379a0-aada-461b-bc1c-129b9a718c83 |
| migration_status    | None                                 |
| multiattach         | False                                |
| name                | disk_glusterfs                       |
| properties          |                                      |
| replication_status  | disabled                             |
| size                | 10                                   |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | glusterfs                            |
| updated_at          | None                                 |
| user_id             | b48cbdf1975f4fd3987f83a100cc9162     |
+---------------------+--------------------------------------+

[root@dlp ~(keystone)]#
openstack volume list

+----------------------+----------------+-----------+------+-------------+
| ID                   | Display Name   | Status    | Size | Attached to |
+----------------------+----------------+-----------+------+-------------+
| 7e1379a0-aada-461b-  | disk_glusterfs | available |   10 |             |
| bc1c-129b9a718c83    |                |           |      |             |
| c54acf2b-0c33-412a-9 | disk_nfs       | available |   10 |             |
| 317-026e44adfc35     |                |           |      |             |
+----------------------+----------------+-----------+------+-------------+
[7] The Configuration is all OK. Attach volumes to instances like follows.
[root@dlp ~(keystone)]#
openstack server list

+--------------------+-------------+---------+--------------------+------------+
| ID                 | Name        | Status  | Networks           | Image Name |
+--------------------+-------------+---------+--------------------+------------+
| 94afe31b-659b-4f61 | Ubuntu_1604 | SHUTOFF | int_net=192.168.10 | Ubuntu1604 |
| -bfd4-380bf440b510 |             |         | 0.9, 10.0.0.207    |            |
+--------------------+-------------+---------+--------------------+------------+

[root@dlp ~(keystone)]#
openstack server add volume Ubuntu_1604 disk_nfs

[root@dlp ~(keystone)]#
openstack server add volume Ubuntu_1604 disk_glusterfs
# the status of attached disk turns "in-use" like follows

[root@dlp ~(keystone)]#
openstack volume list

+--------------------+----------------+--------+------+--------------------+
| ID                 | Display Name   | Status | Size | Attached to        |
+--------------------+----------------+--------+------+--------------------+
| 7e1379a0-aada-     | disk_glusterfs | in-use |   10 | Attached to        |
| 461b-bc1c-         |                |        |      | Ubuntu_1604 on     |
| 129b9a718c83       |                |        |      | /dev/vdc           |
| c54acf2b-0c33-412a | disk_nfs       | in-use |   10 | Attached to        |
| -9317-026e44adfc35 |                |        |      | Ubuntu_1604 on     |
|                    |                |        |      | /dev/vdb           |
+--------------------+----------------+--------+------+--------------------+
Matched Content