]> xenbits.xensource.com Git - libvirt.git/commit
snapshot: prevent stranding snapshot data on domain destruction
authorEric Blake <eblake@redhat.com>
Fri, 12 Aug 2011 15:07:08 +0000 (09:07 -0600)
committerEric Blake <eblake@redhat.com>
Sat, 3 Sep 2011 03:57:33 +0000 (21:57 -0600)
commit282fe1f08c89189e36142fc2d12bae0175038bdd
treeab959f1776cebaf7fc0bebc0136a776f23a48a06
parentbd18b9670fd875db8734da4e62edcd027f612c00
snapshot: prevent stranding snapshot data on domain destruction

Just as leaving managed save metadata behind can cause problems
when creating a new domain that happens to collide with the name
of the just-deleted domain, the same is true of leaving any
snapshot metadata behind.  For safety sake, extend the semantic
change of commit b26a9fa9 to also cover snapshot metadata as a
reason to reject undefining an inactive domain.  A future patch
will make sure that shutdown of a transient domain automatically
deletes snapshot metadata (whether by destroy, shutdown, or
guest-initiated action).  Management apps of transient domains
should take care to capture xml of snapshots, if it is necessary
to recreate the snapshot metadata on a later transient domain
with the same name and uuid.

This also documents a new flag that hypervisors can choose to
support as a shortcut for taking care of the metadata as part of
the undefine process; however, nontrivial driver support for these
flags will be deferred to future patches.

Note that ESX and VBox can never be transient; therefore, they
do not have to worry about automatic cleanup after shutdown
(the persistent domain still remains); likewise they never
store snapshot metadata, so the undefine flag is trivial.
The nontrivial work remaining is thus in the qemu driver.

* include/libvirt/libvirt.h.in
(VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA): New flag.
* src/libvirt.c (virDomainUndefine, virDomainUndefineFlags):
Document new limitations and flag.
* src/esx/esx_driver.c (esxDomainUndefineFlags): Trivial
implementation.
* src/vbox/vbox_tmpl.c (vboxDomainUndefineFlags): Likewise.
* src/qemu/qemu_driver.c (qemuDomainUndefineFlags): Enforce
the limitations.
include/libvirt/libvirt.h.in
src/esx/esx_driver.c
src/libvirt.c
src/qemu/qemu_driver.c
src/vbox/vbox_tmpl.c