]> git.ipfire.org Git - thirdparty/libvirt.git/commit
snapshot: properly revert qemu to offline snapshots
authorEric Blake <eblake@redhat.com>
Fri, 26 Aug 2011 22:17:41 +0000 (16:17 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 2 Sep 2011 18:30:11 +0000 (12:30 -0600)
commit25fb3ef1e1b9927c8f31285f4404620317b7f7db
tree9f1ca2a5f759b23e2189068dc2c5558e48fca2ee
parent88fe7a4ba5f793546ccb9d0dd77ca806d1bd0c61
snapshot: properly revert qemu to offline snapshots

Commit 5e47785 broke reverts to offline system checkpoint snapshots
with older qemu, since there is no longer any code path to use
qemu -loadvm on next boot.  Meanwhile, reverts to offline system
checkpoints have been broken for newer qemu, both before and
after that commit, since -loadvm no longer works to revert to
disk state without accompanying vm state.  Fix both of these by
using qemu-img to revert disk state.

Meanwhile, consolidate the (now 3) clients of a qemu-img iteration
over all disks of a VM into one function, so that any future
algorithmic fixes to the FIXMEs in that function after partial
loop iterations are dealt with at once.  That does mean that this
patch doesn't handle partial reverts very well, but we're not
making the situation any worse in this patch.

* src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Use
qemu-img rather than 'qemu -loadvm' to revert to offline snapshot.
(qemuDomainSnapshotRevertInactive): New helper.
(qemuDomainSnapshotCreateInactive): Factor guts...
(qemuDomainSnapshotForEachQcow2): ...into new helper.
(qemuDomainSnapshotDiscard): Use it.
src/qemu/qemu_driver.c