openstack lvm and cinder

If you do not specify a volume group, cinder will create his own volume group
called cinder-volumes and use loopback devices for physical volumes.
If you do create and specify a volume group, you should specify the volume group
to be the default LVM volume group for cinder.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
in cinder.conf
[Default]
volume_group=small
volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
---
#
# Options defined in cinder.volume.drivers.lvm
#

# Name for the VG that will contain exported volumes (string
# value)
volume_group=small
---
[lvm]
volume_group=small
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

fdisk -l | grep sd
Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 sectors
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 33554431 16264192 8e Linux LVM
Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors

pvcreate /dev/sdb
vgcreate small /dev/sdb

openstack-config --set /etc/cinder/cinder.conf DEFAULT volume_group small
openstack-config --set /etc/cinder/cinder.conf DEFAULT volume_driver cinder.volume.drivers.lvm.LVMISCSIDriver

cinder create --display-name myvolume 1
list the id of the volume
cinder list
list the id's of the instances
nova list

attach the volume to an instance
nova volume-attach ba3ecb1c-53d4-4bea-b3db-d4099e204484 7d9034a8-7dce-447d-951b-5d4f7b947897 auto

On the instance you can use /dev/vdb as a local drive.

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.