LVM on top of linux zfs to use Openstack with nova-volume
Did you ever wanted to know how to setup LVM on top of linux zfs to use Openstack with nova-volume? In this article i will describe this in a few easy steps based on my earlier mentioned how to about zfs on linux.
A common problem when using ZFS as storage for openstack is the lack of plugins that will cover as interface between nova-volume/cinder-volume and the block storage types. The volume service needs an LVM Volume group called nova-volumes as default.
In this how-to i will explain you step by step a workaround how to create an block storage device with zfs and get it into lvm.
- ZFS on Openstack
- nova-volume or cinder-volume
Create a ZFS filesystem you will later use as LVM Group:
zfs create -V 500G storage/your_new_volume
The -V switch defines the size of the new created file-system. Change “storage” to you pool name.
Lets see how it looks like:
Command Output: NAME USED AVAIL REFER MOUNTPOINT storage/your_new_volume 516G 1.78T 76K -
There you see your new created file-system without an mountpoint.
We now need to get its real device path:
Command output: /dev/zvol/storage/your_new_volume: symbolic link to `../../<strong>zd0</strong>'
So our real device path is: /dev/zd0
Let’s do the magic part:
losetup /dev/loop2 /dev/zd0
And create a partition on that device:
fdisk /dev/loop2 (and hit: n p 1 ENTER ENTER t 8e w)
Finally we can create our LVM volume group:
pvcreate /dev/loop2 vgcreate nova-volumes /dev/loop2
We now need to make clear that the loop device gets mounted on the next boot:
Modify the file called /etc/rc.local in your preferred editor and enter following:
exec losetup /dev/loop2 /dev/zd0
And that’s it!