[libvirt] libvirtd and LVM snapshots

Nick Moffitt nick at zork.net
Wed Feb 11 13:51:13 UTC 2009


Daniel P. Berrange:
> http://libvirt.org/formatstorage.html#StorageVolBacking
> 
> This is currently support for Cow, QCow, QCow2, VMDK and LVM storage
> types. Some of these allow for the underling backing store to be 
> writable, others require that its readonly.

I tried the following under libvirt 0.6.0:

	vol = pool.createXML("""<volume type="block">
	<name>hurgle</name> <capacity>2147483648</capacity>
	<backingStore> <path>/dev/VMs/test-disk</path>
	<format>raw</format> </backingStore> </volume>""", 0)

It promptly created a volume, but not as a copy-on-write snapshot:
"dmsetup ls --target snapshot" shows nothing, and the image has none of
the data from the test-disk volume.

The pool I used to create these volumes is clearly LVM:

	virsh # pool-dumpxml VMs
	<pool type='logical'>
	  <name>VMs</name>
	  <uuid>bde8f8ed-7e65-8323-ea93-51223d86fedd</uuid>
	  <capacity>66433581056</capacity>
	  <allocation>2281701376</allocation>
	  <available>64151879680</available>
	  <source>
	    <name>VMs</name>
	    <format type='lvm2'/>
	  </source>
	  <target>
	    <path>/dev/VMs</path>
	    <permissions>
	      <mode>0700</mode>
	      <owner>0</owner>
	      <group>0</group>
	    </permissions>
	  </target>
	</pool>

You mentioned some constraints about permissions earlier, but I would
have expected that to raise an exception--vol is a valid volume object
and I can query it and mkfs it and so forth.  The test-disk volume is
completely quiescent and unmounted.  Do I need to prepare it in some
other way to make it suitable for livirt to use as the base of a
snapshot?

(Just for sanity's sake, I verified that libvirt.getVersion() returns
6000)

-- 
"Forget the damned motor car                          Nick Moffitt
and build cities for lovers and friends."            nick at zork.net
       -- Lewis Mumford




More information about the libvir-list mailing list