]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: detect incomplete save files
authorEric Blake <eblake@redhat.com>
Tue, 30 Aug 2011 19:53:45 +0000 (13:53 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 2 Sep 2011 04:08:13 +0000 (22:08 -0600)
commit55d88def95d1215a2def15a9c2d393d2bd96a0aa
tree3ede34a1546787fa179d9825292a3532c8ee6cc4
parent449ae9c2f1d675785f9d336ddbef0695085779a6
qemu: detect incomplete save files

Several users have reported problems with 'virsh start' failing because
it was encountering a managed save situation where the managed save file
was incomplete.  Be more robust to this by using two different magic
numbers, so that newer libvirt can gracefully handle an incomplete file
differently than a complete one, while older libvirt will at least fail
up front rather than trying to load only to have qemu fail at the end.

Managed save is a convenience - it exists to preserve as much state
as possible; if the state was not preserved, it is reasonable to just
log that fact, then proceed with a fresh boot.  On the other hand,
user saves are under user control, so we must fail, but by making
the failure message distinct, the user can better decide how to handle
the situation of an incomplete save file.

* src/qemu/qemu_driver.c (QEMUD_SAVE_PARTIAL): New define.
(qemuDomainSaveInternal): Use it to mark incomplete images.
(qemuDomainSaveImageOpen, qemuDomainObjRestore): Add parameter
that controls what to do with partial images.
(qemuDomainRestoreFlags, qemuDomainSaveImageGetXMLDesc)
(qemuDomainSaveImageDefineXML, qemuDomainObjStart): Update callers.
Based on an initial idea by Osier Yang.
src/qemu/qemu_driver.c