• E
    snapshot: add REVERT_FORCE to API · 3c797404
    Eric Blake 提交于
    Although reverting to a snapshot is a form of data loss, this is
    normally expected.  However, there are two cases where additional
    surprises (failure to run the reverted state, or a break in
    connectivity to the domain) can come into play.  Requiring extra
    acknowledgment in these cases will make it less likely that
    someone can get into an unrecoverable state due to a default revert.
    
    Also create a new error code, so users can distinguish when forcing
    would make a difference, rather than having to blindly request force.
    
    * include/libvirt/libvirt.h.in (VIR_DOMAIN_SNAPSHOT_REVERT_FORCE):
    New flag.
    * src/libvirt.c (virDomainRevertToSnapshot): Document it.
    * include/libvirt/virterror.h (VIR_ERR_SNAPSHOT_REVERT_RISKY): New
    error value.
    * src/util/virterror.c (virErrorMsg): Implement it.
    * tools/virsh.c (cmdDomainSnapshotRevert): Add --force to virsh.
    * tools/virsh.pod (snapshot-revert): Document it.
    3c797404
libvirt.c 468.0 KB