]> xenbits.xensource.com Git - libvirt.git/commit
snapshot: allow reuse of existing files in disk snapshot
authorEric Blake <eblake@redhat.com>
Mon, 9 Jan 2012 18:57:46 +0000 (11:57 -0700)
committerEric Blake <eblake@redhat.com>
Tue, 10 Jan 2012 18:53:23 +0000 (11:53 -0700)
commit4e9953a426b44b40c5e0890abb73e0f90c454da5
tree2bb89c64d08bee67e3d1ef13e158e39198984ebe
parent529e4a5006c7888b7c8f35e27c4eb8f713ae718a
snapshot: allow reuse of existing files in disk snapshot

When disk snapshots were first implemented, libvirt blindly refused
to allow an external snapshot destination that already exists, since
qemu will blindly overwrite the contents of that file during the
snapshot_blkdev monitor command, and we don't like a default of
data loss by default.  But VDSM has a scenario where NFS permissions
are intentionally set so that the destination file can only be
created by the management machine, and not the machine where the
guest is running, so that libvirt will necessarily see the destination
file already existing; adding a flag will allow VDSM to force the file
reuse without libvirt complaining of possible data loss.

https://bugzilla.redhat.com/show_bug.cgi?id=767104

* include/libvirt/libvirt.h.in (virDomainSnapshotCreateFlags): Add
VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT.
* src/libvirt.c (virDomainSnapshotCreateXML): Document it.  Add
note about partial failure.
* tools/virsh.c (cmdSnapshotCreate, cmdSnapshotCreateAs): Add new
flag.
* tools/virsh.pod (snapshot-create, snapshot-create-as): Document
it.
* src/qemu/qemu_driver.c (qemuDomainSnapshotDiskPrepare)
(qemuDomainSnapshotCreateXML): Implement the new flag.
include/libvirt/libvirt.h.in
src/libvirt.c
src/qemu/qemu_driver.c
tools/virsh.c
tools/virsh.pod