Lvm – libvirt: difference in exposing LVM logical volumes VS libvirt storage pools

kvm-virtualizationlibvirtlvm

I started learning how to create a good virtualization stack with libvirt. I have created a LVM Volume Group that exposes a device block made of a Linux RAID. My idea is to give a Logical Volume to each virtual machine, but a person suggested me to use storage pools instead, like

<pool type='logical'>
  <name>VG_foo</name>
  <uuid>foo</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <device path='/dev/md2'/>
    <name>vg_foo</name>
    <format type='lvm2'/>
  </source>
  <target>
    <path>/dev/vg_foo</path>
    <permissions>
      <mode>0755</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

I have read libvirt storage documentation but I did not understand the difference

Best Answer

The effect of both of these is the same, but in one case you are doing everything manually, and in the other case, libvirt is able to do everything for you.

With the storage pool defined, libvirt is able to create and manage volumes in that pool. Without the storage pool defined, you must manually create and manage the volumes outside of libvirt.

Note that a block device does not have to be part of a storage pool in order for a virtual machine managed by libvirt to use it. But if it is not, then you must manage it yourself.

Related Topic