OpenStack Juno : Use Virtual Storages(Multi-Backend)2015/01/12 |
It's possible to use the Virtual Storage 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.
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.
This example uses a replication volume "vol_replica" provided by "gfs01" and "gfs02".
|
[3] | Configure Storage Node. |
# install from EPEL
[root@storage ~]#
yum --enablerepo=epel -y install nfs-utils glusterfs glusterfs-fuse
[root@storage ~]#
vi /etc/cinder/cinder.conf # add follows in the [DEFAULT] section enabled_backends=nfs,glusterfs
[nfs]
volume_driver=cinder.volume.drivers.nfs.NfsDriver volume_backend_name=NFS nfs_shares_config=/etc/cinder/nfs_shares nfs_mount_point_base=/var/lib/cinder/nfs
[glusterfs]
volume_driver=cinder.volume.drivers.glusterfs.GlusterfsDriver volume_backend_name=GlusterFS glusterfs_shares_config=/etc/cinder/glusterfs_shares glusterfs_mount_point_base=/var/lib/cinder/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 gfs01.srv.world:/vol_replica chmod 640 /etc/cinder/nfs_shares [root@storage ~]# chgrp cinder /etc/cinder/nfs_shares [root@storage ~]# mkdir /var/lib/cinder/nfs [root@storage ~]# chown cinder. /var/lib/cinder/nfs [root@storage ~]# chmod 640 /etc/cinder/glusterfs_shares [root@storage ~]# chgrp cinder /etc/cinder/glusterfs_shares [root@storage ~]# mkdir /var/lib/cinder/glusterfs [root@storage ~]# chown cinder. /var/lib/cinder/glusterfs [root@storage ~]# systemctl restart openstack-cinder-volume |
[4] | Configure Compute Node to mount NFS and GlusterFS volumes. |
# install from EPEL
[root@node01 ~]#
yum --enablerepo=epel -y install nfs-utils glusterfs glusterfs-fuse
[root@node01 ~]#
vi /etc/nova/nova.conf # add follows in the [DEFAULT] section volume_drivers="nfs=nova.virt.libvirt.volume.LibvirtNFSVolumeDriver, glusterfs=nova.virt.libvirt.volume.LibvirtGlusterfsVolumeDriver" systemctl restart openstack-nova-compute |
[5] | Create volume types. |
[root@dlp ~(keystone)]# cinder type-create nfs +--------------------------------------+------+ | ID | Name | +--------------------------------------+------+ | 1a9f4e84-6b17-405b-8153-283a6623b8f1 | nfs | +--------------------------------------+------+[root@dlp ~(keystone)]# cinder type-create glusterfs +--------------------------------------+-----------+ | ID | Name | +--------------------------------------+-----------+ | 9bcb19f3-e91e-4d6b-8b83-cb59c9b45a2f | glusterfs | +--------------------------------------+-----------+[root@dlp ~(keystone)]# cinder type-list +--------------------------------------+-----------+ | ID | Name | +--------------------------------------+-----------+ | 1a9f4e84-6b17-405b-8153-283a6623b8f1 | nfs | | 9bcb19f3-e91e-4d6b-8b83-cb59c9b45a2f | glusterfs | +--------------------------------------+-----------+ |
[6] | Associates volume types set in [5] and names set in cinder.conf. |
[root@dlp ~(keystone)]# cinder type-key nfs set volume_backend_name=NFS [root@dlp ~(keystone)]# cinder type-key glusterfs set volume_backend_name=GlusterFS [root@dlp ~(keystone)]# cinder extra-specs-list +--------------------------------------+-----------+----------------------------------------+ | ID | Name | extra_specs | +--------------------------------------+-----------+----------------------------------------+ | 1a9f4e84-6b17-405b-8153-283a6623b8f1 | nfs | {u'volume_backend_name': u'NFS'} | | 9bcb19f3-e91e-4d6b-8b83-cb59c9b45a2f | glusterfs | {u'volume_backend_name': u'GlusterFS'} | +--------------------------------------+-----------+----------------------------------------+ |
[7] | Create volumes with specifying volume types. |
[root@dlp ~(keystone)]# cinder create --display_name disk_nfs --volume-type nfs 10 +---------------------+--------------------------------------+ | Property | Value | +---------------------+--------------------------------------+ | attachments | [] | | availability_zone | nova | | bootable | false | | created_at | 2015-01-12T14:20:29.830582 | | display_description | None | | display_name | disk_nfs | | encrypted | False | | id | 980dd6f0-eefa-4234-847c-14d07008624e | | metadata | {} | | size | 10 | | snapshot_id | None | | source_volid | None | | status | creating | | volume_type | nfs | +---------------------+--------------------------------------+[root@dlp ~(keystone)]# cinder create --display_name disk_glusterfs --volume-type glusterfs 10 +---------------------+--------------------------------------+ | Property | Value | +---------------------+--------------------------------------+ | attachments | [] | | availability_zone | nova | | bootable | false | | created_at | 2015-01-12T14:20:44.268581 | | display_description | None | | display_name | disk_glusterfs | | encrypted | False | | id | a4ddc65b-3d3b-44c6-a0bd-4cc9a64cdc9d | | metadata | {} | | size | 10 | | snapshot_id | None | | source_volid | None | | status | creating | | volume_type | glusterfs | +---------------------+--------------------------------------+[root@dlp ~(keystone)]# cinder list +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | 980dd6f0-eefa-4234-847c-14d07008624e | available | disk_nfs | 10 | nfs | false | | | a4ddc65b-3d3b-44c6-a0bd-4cc9a64cdc9d | available | disk_glusterfs | 10 | glusterfs | false | | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ |
[8] | The Configuration is all OK. Attach volumes to instances like follows. |
[root@dlp ~(keystone)]# nova list +-----------+-----------+---------+------------+-------------+-----------------------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+---------+------------+-------------+-----------------------------------+ | df11d64d- | CentOS_70 | SHUTOFF | - | Shutdown | int_net=192.168.100.6, 10.0.0.201 | +-----------+-----------+---------+------------+-------------+-----------------------------------+[root@dlp ~(keystone)]# nova volume-attach CentOS_70 980dd6f0-eefa-4234-847c-14d07008624e auto +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdb | | id | 980dd6f0-eefa-4234-847c-14d07008624e | | serverId | df11d64d-dd72-4d1a-bf0a-5cd764c2f863 | | volumeId | 980dd6f0-eefa-4234-847c-14d07008624e | +----------+--------------------------------------+[root@dlp ~(keystone)]# nova volume-attach CentOS_70 a4ddc65b-3d3b-44c6-a0bd-4cc9a64cdc9d auto +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdc | | id | a4ddc65b-3d3b-44c6-a0bd-4cc9a64cdc9d | | serverId | df11d64d-dd72-4d1a-bf0a-5cd764c2f863 | | volumeId | a4ddc65b-3d3b-44c6-a0bd-4cc9a64cdc9d | +----------+--------------------------------------+ # the status of attached disk turns "in-use" like follows [root@dlp ~(keystone)]# cinder list +--------------------------------------+--------+----------------+------+-------------+----------+--------------------------------------+ | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+--------+----------------+------+-------------+----------+--------------------------------------+ | 980dd6f0-eefa-4234-847c-14d07008624e | in-use | disk_nfs | 10 | nfs | false | df11d64d-dd72-4d1a-bf0a-5cd764c2f863 | | a4ddc65b-3d3b-44c6-a0bd-4cc9a64cdc9d | in-use | disk_glusterfs | 10 | glusterfs | false | df11d64d-dd72-4d1a-bf0a-5cd764c2f863 | +--------------------------------------+--------+----------------+------+-------------+----------+--------------------------------------+ |
Sponsored Link |
|