• E
    snapshot: prevent stranding snapshot data on domain destruction · 282fe1f0
    Eric Blake 提交于
    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.
    282fe1f0
esx_driver.c 151.7 KB