[libvirt-users] libvirt, snapshots, LVM, and existing VMs

Hello, I am running libvirt 0.8.3 with a couple VMs using a LVM VG that I had previously setup on my host. I did not use the storage pool functionality of libvirt to create the VG in the first place ('pool-list' is empty). Now I want to be able to take snapshots of the VMs. Having read this previous post [1] on the mailing list, I gather that libvirt does indeed support taking snapshots of VMs on an LVM. I suppose I need to create storage pool that includes the <backingStore> element. However, I am not sure how to go about creating this pool and making my existing VMs utilize it. Is what I am trying to do even possible? If so, what is the proper way to go about doing it? Best, Casey Link [1] http://www.redhat.com/archives/libvir-list/2009-February/msg00196.html

于 2011年01月23日 16:01, Casey Link 写道:
Hello,
I am running libvirt 0.8.3 with a couple VMs using a LVM VG that I had previously setup on my host. I did not use the storage pool functionality of libvirt to create the VG in the first place ('pool-list' is empty).
Now I want to be able to take snapshots of the VMs. Having read this previous post [1] on the mailing list, I gather that libvirt does indeed support taking snapshots of VMs on an LVM. I suppose I need to create storage pool that includes the<backingStore> element. However, I am not sure how to go about creating this pool and making my existing VMs utilize it.
Is what I am trying to do even possible? If so, what is the proper way to go about doing it?
How to create the logical pool, refer to: http://libvirt.org/git/?p=libvirt.git;a=tree;f=tests/storagepoolxml2xmlin;h=... How to create the logical volume with backing store, refer to: http://libvirt.org/git/?p=libvirt.git;a=tree;f=tests/storagevolxml2xmlin;h=e... Hope it helps. Regards Osier
Best, Casey Link
[1] http://www.redhat.com/archives/libvir-list/2009-February/msg00196.html
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

Thanks for the info. Those xml files will be invaluable.
How to create the logical pool, refer to: http://libvirt.org/git/?p=libvirt.git;a=tree;f=tests/storagepoolxml2xmlin;h=...
Looking at the pool-logical*.xml, pool-logical.xml will not harm an existing data on disk, correct? Whereas pool-logical-create.xml will attempt to create a new VG (and could cause data loss)?
How to create the logical volume with backing store, refer to: http://libvirt.org/git/?p=libvirt.git;a=tree;f=tests/storagevolxml2xmlin;h=e...
Since I already have LVM setup, and an active VG should I just omit the following from my logical vol xml? <source> <device path='/dev/sda2'> <extent start='31440502784' end='33520877568'/> </device> </source> <capacity>2080374784</capacity> <allocation>2080374784</allocation> You can understand I'm somewhat hesitant to do this, as I don't want to destroy or overwrite any existing data. Best, Casey

On 24/01/2011, at 2:49 PM, Casey Link wrote: <snip>
You can understand I'm somewhat hesitant to do this, as I don't want to destroy or overwrite any existing data.
Um, do you have enough spare space to make a full backup of the existing volume somewhere first? Just from the point of view that it's generally a really bad idea to use Actual Data (without a backup) for learning with. :)

How to create the logical pool, refer to: http://libvirt.org/git/?p=libvirt.git;a=tree;f=tests/storagepoolxml2xmlin;h=...
How to create the logical volume with backing store, refer to: http://libvirt.org/git/?p=libvirt.git;a=tree;f=tests/storagevolxml2xmlin;h=e...
Hi Osier, So, I have managed to setup an LVM backed pool (koth-main), and created volumes from this pool: vol-create-as --pool koth-main --name koth-foo-snap --capacity 2G vol-create-as --pool koth-main --name koth-foo --capacity 2G --backing-vol koth-foo-snap I then performed a virt-install, and after configuring the system attempted s snapshot, but as you can see it still doesn't work. I get the same error as before: snapshot-create koth-foo error: Requested operation is not valid: Disk '/dev/main/koth-foo' does not support snapshotting Did I miss a step? Best, Casey Below is the XML for the main volume: <volume> <name>koth-foo</name> <key>5er4qK-stqa-zzJn-Npbe-HOeH-aYfs-TULujB</key> <source> <device path='/dev/sda2'> <extent start='417685569536' end='419833053184'/> </device> </source> <capacity>2147483648</capacity> <allocation>2147483648</allocation> <target> <path>/dev/main/koth-foo</path> <permissions> <mode>0600</mode> <owner>0</owner> <group>6</group> </permissions> </target> <backingStore> <path>/dev/main/koth-foo-snap</path> <permissions> <mode>0660</mode> <owner>0</owner> <group>6</group> </permissions> </backingStore> </volume>

于 2011年01月30日 06:18, Casey Link 写道:
How to create the logical pool, refer to: http://libvirt.org/git/?p=libvirt.git;a=tree;f=tests/storagepoolxml2xmlin;h=...
How to create the logical volume with backing store, refer to: http://libvirt.org/git/?p=libvirt.git;a=tree;f=tests/storagevolxml2xmlin;h=e...
Hi Osier,
So, I have managed to setup an LVM backed pool (koth-main), and created volumes from this pool:
vol-create-as --pool koth-main --name koth-foo-snap --capacity 2G vol-create-as --pool koth-main --name koth-foo --capacity 2G --backing-vol koth-foo-snap
I then performed a virt-install, and after configuring the system attempted s snapshot, but as you can see it still doesn't work. I get the same error as before: snapshot-create koth-foo error: Requested operation is not valid: Disk '/dev/main/koth-foo' does not support snapshotting
Sorry for the late, qemu driver only supports domain snapshotting when the disks' driver type is "qcow2". e.g. <disk...> ...... <driver name="qemu" type="qcow2"/> ...... </disk>
Did I miss a step?
Best,
Casey
Below is the XML for the main volume:
<volume> <name>koth-foo</name> <key>5er4qK-stqa-zzJn-Npbe-HOeH-aYfs-TULujB</key> <source> <device path='/dev/sda2'> <extent start='417685569536' end='419833053184'/> </device> </source> <capacity>2147483648</capacity> <allocation>2147483648</allocation> <target> <path>/dev/main/koth-foo</path> <permissions> <mode>0600</mode> <owner>0</owner> <group>6</group> </permissions> </target> <backingStore> <path>/dev/main/koth-foo-snap</path> <permissions> <mode>0660</mode> <owner>0</owner> <group>6</group> </permissions> </backingStore> </volume>

Sorry for the late, qemu driver only supports domain snapshotting when the disks' driver type is "qcow2". e.g.
<disk...> ...... <driver name="qemu" type="qcow2"/> ...... </disk>
Ah, thanks. I assume this means I can't snapshot LVM backed domains at this time? That is, it isn't possible to use qcow2 and lvm at the same time? Best, Casey

于 2011年02月04日 01:02, Casey Link 写道:
Sorry for the late, qemu driver only supports domain snapshotting when the disks' driver type is "qcow2". e.g.
<disk...> ...... <driver name="qemu" type="qcow2"/> ...... </disk>
Ah, thanks. I assume this means I can't snapshot LVM backed domains at this time? That is, it isn't possible to use qcow2 and lvm at the same time?
Yes, actually we have a bug: https://bugzilla.redhat.com /show_bug.cgi?id=613557, :-) Regards Osier
participants (3)
-
Casey Link
-
Justin Clift
-
Osier Yang