• E
    snapshot: allow recreation of metadata · af65695a
    Eric Blake 提交于
    The first two flags are essential for being able to replicate
    snapshot hierarchies across multiple hosts, which will come in
    handy for supervised migrations.  It also allows a management app
    to take a snapshot of a transient domain, save the metadata, stop
    the domain, recreate a new transient domain by the same name,
    redefine the snapshot, then revert to it.
    
    This is not quite as convenient as leaving the metadata behind
    after a domain is no longer around, but doing that has a few
    problems: 1. the libvirt API can only delete snapshot metadata
    if there is a valid domain handle to use to get to that snapshot
    object - if stale data is left behind without a domain, there is
    no way to request that the data be cleaned up. 2. creating a new
    domain with the same name but different uuid than the older
    domain where a snapshot existed cannot use the older snapshot
    data; this risks confusing libvirt, and forbidding the stale
    data is similar to the recent patch to forbid stale managed save.
    
    The first two flags might be useful on hypervisors with no metadata,
    but only for modifying the notion of the current snapshot;
    however, I don't know how to do that for ESX or VBox.
    
    The third flag is a convenience option, to combine a creation with
    a delete metadata into one step.  It is trivial for hypervisors
    with no metadata.
    
    The qemu changes will be involved enough to warrant a separate patch.
    
    * include/libvirt/libvirt.h.in
    (VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE)
    (VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)
    (VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA): New flags.
    * src/libvirt.c (virDomainSnapshotCreateXML): Document them, and
    enforce mutual exclusion.
    * src/esx/esx_driver.c (esxDomainSnapshotCreateXML): Trivial
    implementation.
    * src/vbox/vbox_tmpl.c (vboxDomainSnapshotCreateXML): Likewise.
    * docs/formatsnapshot.html.in: Document re-creation.
    af65695a
libvirt.c 457.1 KB