• E
    snapshot: allow reuse of existing files in disk snapshot · 4e9953a4
    Eric Blake 提交于
    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.
    4e9953a4
libvirt.c 509.2 KB