On 12/07/2010 09:00 AM, Philipp Hahn wrote:
Hello,
I just encountered a problem with the current snapshot implementation for
qemu/kvm: To revert back to a snapshot, the domain description must closely
match the domain description when the snapshot was created. If the ram-size
doesn't match or the VM now contains fewer CPUs or contains additional disks,
kvm will either not load the snapshot or the machine will be broken
afterwarts.
Is this a known problem?
Are you referring to a disk snapshot, created via 'virsh snapshot' on a
qcow2 image, or a memory snapshot, created via 'virsh save'? The latter
_does_ save the guest XML as part of the snapshot, and 'virsh restore'
uses that saved XML rather than the current domain definition to resume
the guest.
Without looking into the implementation details I think saving the full domain
description instead of just a reference to the domain uuid as part of the
snapshot description would work better.
So it sounds like you are talking about the 'virsh snapshot' family of
commands. Indeed, there's probably quite a bit of work to do in that
code to make it more reliable.
Or am I supposed to save the domain
description myself in addition the the data saved
in /var/lib/libvirt/qemu/snapshot/$DOMAIN_NAME/$SNAPSHOT_NAME.xml. I think
this is very important feature, because when you - for example - notice that
you need additional disk space and would like to include an additional block
device, this is your ideal time to take a snapshot you can revert to when you
do something wrong.
I think we are hitting on more fundamental issues. Right now, the
'virsh snapshot' family of commands is geared towards qcow2 images, and
relies heavily on the qcow2 internal snapshotting feature. It would be
nice to enhance that to support other means of snapshotting (such as raw
disk images stored on an lvm partition or using btrfs file cloning), as
well as making live snapshots possible (by capturing memory as well as
disk images, or even coordinating with the guest to quiesce its file
systems so that restoring from a snapshot is less likely to restore a
file system in an inconsistent state).
Looking at VMware I see that reverting a VM there will not only revert the
disks and ram back to the saved state, but also the description including
name, ram size, etc.
Any comment or advise is appreciated.
Likewise - I'm hoping to look into this more myself, and any thoughts or
requirements that people can think of that should drive a decent
snapshot design should be brought up sooner rather than later.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org