aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2012-03-16 15:23:00 -0600
committerEric Blake <eblake@redhat.com>2012-03-23 16:38:20 -0600
commit4d5533ca87e542e22a80bbab6ffe013742b117e6 (patch)
tree4847fab58fd46319aa34392a50bc40889f5377ce /include
parentsnapshot: add qemu capability for 'transaction' command (diff)
downloadlibvirt-4d5533ca87e542e22a80bbab6ffe013742b117e6.tar.gz
libvirt-4d5533ca87e542e22a80bbab6ffe013742b117e6.tar.bz2
libvirt-4d5533ca87e542e22a80bbab6ffe013742b117e6.zip
snapshot: add atomic create flag
Right now, it is appallingly easy to cause qemu disk snapshots to alter a domain then fail; for example, by requesting a two-disk snapshot where the second disk name resides on read-only storage. In this failure scenario, libvirt reports failure, but modifies the live domain XML in-place to record that the first disk snapshot was taken; and places a difficult burden on the management app to grab the XML and reparse it to see which disks, if any, were altered by the partial snapshot. This patch adds a new flag where implementations can request that the hypervisor make snapshots atomically; either no changes to XML occur, or all disks were altered as a group. If you request the flag, you either get outright failure up front, or you take advantage of hypervisor abilities to make an atomic snapshot. Of course, drivers should prefer the atomic means even without the flag explicitly requested. There's no way to make snapshots 100% bulletproof - even if the hypervisor does it perfectly atomic, we could run out of memory during the followup tasks of updating our in-memory XML, and report a failure. However, these sorts of catastrophic failures are rare and unlikely, and it is still nicer to know that either all snapshots happened or none of them, as that is an easier state to recover from. * include/libvirt/libvirt.h.in (VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC): New flag. * src/libvirt.c (virDomainSnapshotCreateXML): Document it. * tools/virsh.c (cmdSnapshotCreate, cmdSnapshotCreateAs): Expose it. * tools/virsh.pod (snapshot-create, snapshot-create-as): Document it.
Diffstat (limited to 'include')
-rw-r--r--include/libvirt/libvirt.h.in2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 8bb5c5754..499dcd451 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -3301,6 +3301,8 @@ typedef enum {
quiesce all mounted
file systems within
the domain */
+ VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC = (1 << 7), /* atomically avoid
+ partial changes */
} virDomainSnapshotCreateFlags;
/* Take a snapshot of the current VM state */