
On Tue, Jul 19, 2011 at 10:20:39PM -0600, Eric Blake wrote:
With this, it is possible to update the path to a disk backing image on either the save or restore action, without having to binary edit the XML embedded in the state file.
* src/qemu/qemu_driver.c (qemuDomainSaveInternal) (qemuDomainSaveImageOpen): Add parameter. (qemuDomainSaveFlags, qemuDomainManagedSave) (qemuDomainRestoreFlags, qemuDomainObjRestore): Update callers. ---
v2: new patch
Tested via:
virsh start dom virsh dumpxml dom > dom.xml ln /path/to/disk /path/to/disk2 ln /path/to/disk /path/to/disk3 edit dom.xml to change /path/to/disk to /path/to/disk2 virsh save dom dom.save --xml dom.xml check that xml embedded in binary dom.save did change cp dom.xml dom.xml2 edit dom.xml to change /path/to/disk2 to /path/to/disk3 edit dom.xml2 to break abi, such as removing entire cdrom <disk> element virsh restore dom.save --xml dom.xml2 => properly failed virsh restore dom.save --xml dom.xml virsh dumpxml dom - validate that /path/to/disk3 is in use
Which means it is now possible to do:
virsh dumpxml dom > dom.xml virsh save dom dom.save use qemu-img to create new qcow2 files with backing file of the original images alter dom.xml to reflect the new file names virsh restore dom.save --xml dom.xml
to externally manage disk snapshots causing changed file names.
Not quite where I wanted to be with snapshot support, but certainly a step in the right direction!
src/qemu/qemu_driver.c | 56 +++++++++++++++++++++++++++++++++-------------- 1 files changed, 39 insertions(+), 17 deletions(-)
Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|