OpenStack Icehouse : Use Virtual Storage(LVM)2014/06/26 |
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 # add follows in the [DEFAULT] section volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
volume_group = vg_volume01 sed -i '1iinclude /var/lib/cinder/volumes/*' /etc/tgt/targets.conf [root@storage ~]# /etc/rc.d/init.d/tgtd start Starting SCSI target daemon: [ OK ] [root@storage ~]# chkconfig tgtd on [root@storage ~]# /etc/rc.d/init.d/openstack-cinder-volume restart Stopping openstack-cinder-volume: [ OK ] Starting openstack-cinder-volume: [ OK ] |
[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-06-27T00:49:17.444735 | | display_description | None | | display_name | disk01 | | encrypted | False | | id | e1765f7e-da1e-44df-91a4-05c9da980d2e | | 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 | +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+ | e1765f7e-da1e-44df-91a4-05c9da980d2e | 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 | +-----------+-----------+---------+------------+-------------+--------------------------+ | 90304be0- | CentOS_65 | SHUTOFF | - | Shutdown | sharednet1=192.168.100.2 | +-----------+-----------+---------+------------+-------------+--------------------------+[root@dlp ~(keystone)]# nova volume-attach CentOS_65 e1765f7e-da1e-44df-91a4-05c9da980d2e auto +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdb | | id | e1765f7e-da1e-44df-91a4-05c9da980d2e | | serverId | 90304be0-c9e7-4632-b39f-ac734a8bfb1e | | volumeId | e1765f7e-da1e-44df-91a4-05c9da980d2e | +----------+--------------------------------------+ |
Sponsored Link |
|