The 13/03/13, Eric Blake wrote:
You might want to look into external snapshots as a more efficient
way
of taking guest snapshots.
I have guests with raw disks due to Windows performance issues. It would
very welcome to have minimal downtime as some disks are quiet large
(terabytes) and the allowed downtime window very short. Let's try external
snapshots for guest "VM" while running:
# cd virtuals/images
# virsh
virsh> snapshot-create-as VM snap1 "snap1 VM" --memspec
file=VM.save,snapshot=external --diskspec vda,snapshot=external,file=VM-snap1.img
Domain snapshot snap1 created
virsh> exit
# ls VM-snap1.img
ls: cannot access VM-snap1.img: No such file or directory
#
Ooch!
<investigating...>
# ls /VM-snap1.img
/VM-snap1.img
# ls /VM.save
/VM.save
#
Surprising! I would have expect files to be stored in virtuals/images. This is
not the point for now, let's continue.
# virsh snapshot-list VM
Name Creation Time State
------------------------------------------------------------
snap1 2013-03-14 12:20:01 +0100 running
#
USE CASE 1: restoring from backing file
=======================================
# virsh shutdown VM
I can't find a snapshot-* doing what I want (snapshot-revert expects to
revert a snapshot), trying restore.
# virsh restore /VM.save
Domain restored from /VM.save
# LANG=C virsh snapshot-list VM
Name Creation Time State
------------------------------------------------------------
snap1 2013-03-14 12:20:01 +0100 running
#
As we might expect, the snapshot is still there.
# virsh snapshot-delete VM snap1
error: Failed to delete snapshot snap1
error: unsupported configuration: deletion of 1 external disk snapshots not supported
yet
#
A bit annoying. Now, it seems that I have to manually delete garbage. Actually,
I've tried and I had to delete /VM.save, /VM-snap1.img,
/var/lib/libvirt/qemu/snapshot/VM/snap1.xml and restart libvirt (no snapshot-refresh).
USE CASE 2: the files are saved in another place, let's merge back the changes
==============================================================================
The idea is to merge VM-snap1.img back to VM.raw with minimal downtime. I can't
find a command for that, let's try manually.
# virsh managedsave VM
# qemu-img commit /VM-snap1.img
# rm /VM-snap1.img /VM.save
# virsh start VM
error: Failed to start domain VM
error: cannot open file 'VM-snap1.img': No such file or directory
# virsh edit VM
<virsh edit VM to come back to vda -> VM.raw>
# virsh start VM
error: Failed to start domain VM
error: cannot open file 'VM-snap1.img': No such file or directory
#
Looks like the complain comes from the xml state header.
# virsh save-image-edit /var/lib/libvirt/qemu/save/VM.save
<virsh edit VM to come back to vda -> VM.raw>
error: operation failed : new xml too large to fit in file
#
Stuck. :-/
--
Nicolas Sebrecht