[Openstack] LVM over LVM is acceptable?

Dean Troyer dtroyer at gmail.com
Mon Nov 26 20:52:16 UTC 2012


On Mon, Nov 26, 2012 at 6:51 AM, Lei Zhang <zhang.lei.fly at gmail.com> wrote:
> I creat a lvm named vol-0 and attach it to the machine com-0. After a period
> of time, the vol-0 is full and I want to extend it. At now, I have two
> solutions.

Nested LVM gets tricky so I want to be sure I am clear on your setup:

* Your host has a logical volume (LV) 'vol-0' that is attached to a VM
named 'com-0'.
* com-0 uses the attached logical volume (vol-0 on the host) as a
physical volume (PV) for its own LVM configuration.

> Because the vol-0 is manage by the LVM on the hoster. So I can extend the
> size of it by using lvextend. But I meet that the vm(com-0) can not be aware
> this. Should I make some extrac operations like reseize2fs? I have no ideas.

If vol-0 is used directly as a block device with a filesystem on it
(older Xen installs often did this) then a resize2fs is sufficient to
recognize the additional space.  It appears this is _not_ your
configuration, correct?

If vol-0 is used as a PV in com-0 then you can run pvresize inside
com-0 and have com-0's LVM recognize the additional space.

> In the vm (com-0), I can treat the vol-0 as a normal block device and create
> lvm on it. When need more space, the hoster can "plug" a new lvm
> device(vol-1) on it. In the vm, I can add it to the lvm. But I found another

Correct, this is another way to increase the space available to
cpm-0's volume groups.

> problem. Because the vol-* is not real block device, when I create lvm on
> it, the hoster is aware of it. The result is that on the hoster, another PV
> is created base on a lvm partition like bellow. I want to know, it is
> acceptable?

To fix this you need to adjust the filter on your host's
/etc/lvm/lvm.conf.  You can either reject any physical volumes found
for VMs:

    filter = ["r|/dev/cinder-volumes/.*", "a/.*/"]   # reject cinder
devices, alow everything else

or you can only look at particular divice files for physical devices:

    filter = ["a/dev/sd.*"]   # look only at SCSI disks for physical devices

That last one will likely need adjusting for your local block device names.

dt

-- 

Dean Troyer
dtroyer at gmail.com




More information about the Openstack mailing list