CentOS 6
Sponsored Link

OpenStack Havana - Use Virtual Storage(GlusterFS)2013/10/27

 
It's possible to use Virtual Storage provided by Cinder for Virtual Machine Instance.
This example shows to set to use GlusterFS for Virtual Storage.
[1]
Configure GlusterFS Server in your LAN first.
This example uses a replication volume "/vol01" provided by "gfs01" and "gfs02".
[2] Install some packages first.
[root@dlp ~(keystone)]#
yum --enablerepo=epel -y install glusterfs glusterfs-fuse  
# install from EPEL
[3] Configure Cinder
[root@dlp ~(keystone)]#
vi /etc/cinder/cinder.conf
# line 1161: uncomment

glusterfs_shares_config = /etc/cinder/glusterfs_shares
# line 1177: uncomment and change

glusterfs_mount_point_base =
/var/lib/cinder/mnt
# line 1757: uncomment and change

volume_driver = cinder.volume.drivers.
glusterfs.GlusterfsDriver
[root@dlp ~(keystone)]#
vi /etc/nova/nova.conf
# line 2014: uncomment

libvirt_volume_drivers=iscsi=nova.virt.libvirt.volume.LibvirtISCSIVolumeDriver,
iser=nova.virt.libvirt.volume.LibvirtISERVolumeDriver,
local=nova.virt.libvirt.volume.LibvirtVolumeDriver,
fake=nova.virt.libvirt.volume.LibvirtFakeVolumeDriver,
rbd=nova.virt.libvirt.volume.LibvirtNetVolumeDriver,
sheepdog=nova.virt.libvirt.volume.LibvirtNetVolumeDriver,
nfs=nova.virt.libvirt.volume.LibvirtNFSVolumeDriver,
aoe=nova.virt.libvirt.volume.LibvirtAOEVolumeDriver,
glusterfs=nova.virt.libvirt.volume.LibvirtGlusterfsVolumeDriver,
fibre_channel=nova.virt.libvirt.volume.LibvirtFibreChannelVolumeDriver,
scality=nova.virt.libvirt.volume.LibvirtScalityVolumeD
river

# line 2184: uncomment and change

glusterfs_mount_point_base =
/var/lib/cinder/mnt
[root@dlp ~(keystone)]#
vi /etc/cinder/glusterfs_shares
# create new : specify Gluster volume

gfs01.srv.world:/vol01
[root@dlp ~(keystone)]#
chmod 640 /etc/cinder/glusterfs_shares

[root@dlp ~(keystone)]#
chgrp cinder /etc/cinder/glusterfs_shares

[root@dlp ~(keystone)]#
mkdir /var/lib/cinder/mnt

[root@dlp ~(keystone)]#
chown cinder. /var/lib/cinder/mnt

[root@dlp ~(keystone)]#
/etc/rc.d/init.d/openstack-cinder-volume restart

Stopping openstack-cinder-volume: [ OK ]
Starting openstack-cinder-volume: [ OK ]
[root@dlp ~(keystone)]#
/etc/rc.d/init.d/openstack-nova-compute restart

Stopping openstack-nova-compute: [ OK ]
Starting openstack-nova-compute: [ OK ]
[4] For example, create a volume named "disk01", 10GB.
[root@dlp ~(keystone)]#
cinder create --display_name disk01 10

+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|     attachments     |                  []                  |
|  availability_zone  |                 nova                 |
|       bootable      |                false                 |
|      created_at     |      2013-10-28T08:18:53.352609      |
| display_description |                 None                 |
|     display_name    |                disk01                |
|          id         | 17e63a22-01aa-4467-9bfe-1408bed93f28 |
|       metadata      |                  {}                  |
|         size        |                  10                  |
|     snapshot_id     |                 None                 |
|     source_volid    |                 None                 |
|        status       |               creating               |
|     volume_type     |                 None                 |
+---------------------+--------------------------------------+

[root@dlp ~(keystone)]#
cinder list

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
|                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| 17e63a22-01aa-4467-9bfe-1408bed93f28 | available |    disk01    |  10  |     None    |  false   |             |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
[5] Attach the volume just created to Instance.
The following example just attached to the Instance as "/dev/vdb".
[root@dlp ~(keystone)]#
nova list

+--------------------------------------+-----------+---------+------------+-------------+--------------------+
| ID                                   | Name      | Status  | Task State | Power State | Networks           |
+--------------------------------------+-----------+---------+------------+-------------+--------------------+
| 7dc735d8-5206-4b0f-8016-41c5e1fe2381 | CentOS_64 | SHUTOFF | None       | Shutdown    | network01=10.1.0.2 |
+--------------------------------------+-----------+---------+------------+-------------+--------------------+

[root@dlp ~(keystone)]#
nova volume-attach CentOS_64 17e63a22-01aa-4467-9bfe-1408bed93f28 auto

+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/vdb                             |
| serverId | 7dc735d8-5206-4b0f-8016-41c5e1fe2381 |
| id       | 17e63a22-01aa-4467-9bfe-1408bed93f28 |
| volumeId | 17e63a22-01aa-4467-9bfe-1408bed93f28 |
+----------+--------------------------------------+
Matched Content