Ubuntu 14.04
Sponsored Link

OpenStack Icehouse : Use Storage (LVM)
2014/05/30
 
It's possible to use the Virtual Storage provided by Cinder if an Instance needs more disks.
Configure Virtual storage with LVM on here. It needs there are some free spaces in Volume Groups on Storage Node.
                                      +------------------+
                             10.0.0.35| [ Storage Node ] |
+------------------+            +-----+   Cinder-Volume  |
| [ Control Node ] |            | eth0|                  |
|     Keystone     |10.0.0.30   |     +------------------+
|      Glance      |------------+
|     Nova API     |eth0        |     +------------------+
|    Cinder API    |            | eth0| [ Compute Node ] |
+------------------+            +-----+   Nova Compute   |
                             10.0.0.51|                  |
                                      +------------------+

[1] Create a volume group for Cinder on Storage Node.
root@storage:~#
pvcreate /dev/sdb1

Physical volume "/dev/sdb1" successfully created
root@storage:~#
vgcreate -s 32M vg_volume01 /dev/sdb1

Volume group "vg_volume01" successfully created
[2] Configure Cinder Volume on Storage.
root@storage:~#
vi /etc/cinder/cinder.conf
# line 6: change to the volume group name just created above

volume_group =
vg_volume01
# add follows in the [DEFAULT] section

volume_driver = cinder.volume.drivers.lvm.LVMISCSIDriver
root@storage:~#
sed -i '1iinclude /var/lib/cinder/volumes/*' /etc/tgt/targets.conf

root@storage:~#
service tgt restart

tgt stop/waiting
tgt start/running, process 3587
root@storage:~#
service cinder-volume restart

cinder-volume stop/waiting
cinder-volume start/running, process 7350
[3] For example, create a virtual disk "disk01" with 10GB. It's OK to work on any node. (This example is on Control Node)
root@dlp ~(keystone)#
cinder create --display_name disk01 10

+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|     attachments     |                  []                  |
|  availability_zone  |                 nova                 |
|       bootable      |                false                 |
|      created_at     |      2014-05-29T10:56:38.420132      |
| display_description |                 None                 |
|     display_name    |                disk01                |
|      encrypted      |                False                 |
|          id         | 5b79be5a-d46b-4f7e-92b0-4694aa0e96f9 |
|       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 |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| 5b79be5a-d46b-4f7e-92b0-4694aa0e96f9 | available |    disk01    |  10  |     None    |  false   |             |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
[4] Attach the virtual disk to an Instance.
For the exmaple below, the disk is connected as "/dev/vdb". It's possible to use it as a storage to create a file system on it.
root@dlp ~(keystone)#
nova list

+-----------+---------------+---------+------------+-------------+-----------------------+
| ID        | Name          | Status  | Task State | Power State | Networks              |
+-----------+---------------+---------+------------+-------------+-----------------------+
| 34664048- | Ubuntu_Trusty | SHUTOFF | -          | Shutdown    | sharednet1=10.0.0.201 |
+-----------+---------------+---------+------------+-------------+-----------------------+

root@dlp ~(keystone)#
nova volume-attach Ubuntu_Trusty 5b79be5a-d46b-4f7e-92b0-4694aa0e96f9 auto

+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/vdb                             |
| id       | 5b79be5a-d46b-4f7e-92b0-4694aa0e96f9 |
| serverId | 34664048-98d3-44f5-8f72-9c6efcd27834 |
| volumeId | 5b79be5a-d46b-4f7e-92b0-4694aa0e96f9 |
+----------+--------------------------------------+
Matched Content
 
Tweet