On 07/15/2014 08:28 AM, Ravi Samji wrote:
Hi All,
I'm having issue with creating LVM Volume via libvirt.
We are running libvirtd 1.2 with KVM.
We are creating Volume Group (VG01) outside of libvirt and defining a storage pool for
it.
Here is the StoragePool XML for the Volume Group created outside libvirt.
<pool type="logical">
<name>VG01</name>
<target>
<path>/dev/VG01</path>
</target>
</pool>
We are creating Logical Volume (ub_test01.img) through libvirt in the Volume Group
(VG01)
Here is the XML to create Storage Volume in LVM Storage Pool VG01.
<volume type="block">
<name>ub_test01.img</name>
<allocation>0</allocation>
<capacity unit="M">1</capacity>
If the allocation is not equal to the capacity, libvirt calls lvcreate with
the --virtualsize option, which creates this snapshot that should take up less
space.
For a regular volume, just omit the allocation element, or use the same values
for both.
<target>
<format type="lvm2" />
</target>
</volume>
When I create the Logical Volume from libvirt using above XML and run lvs command to list
logical volumes, this is what I see.
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
--------------- ------- ------- ------- ----------------------- ------- ------- -------
------- -------
foo VG01 -wi-a- 1.00g
ub_test01.img VG01 swi-a- 4.00m [ub_test01.img_vorigin] 0.20
root ops-02 -wi-ao 227.08g
swap_1 ops-02 -wi-ao 5.75g
As you see, ub_test01.img shows that it has an Origin indicating that it was created as a
snapshot, but, that Origin doesn't exist and wasn't specified.
I'd appreciate if you anyone can help me understand what is going on and/or describe
how to make libvirt create logical volumes not as a snapshot.
I'm happy to enable debugging to see what command libvirt is running to create the
volume if someone case describe how to enable debugging.
See
http://libvirt.org/logging.html
Jan