snapshot: virsh shorthand for operating on current snap
Rather than having to do: $ virsh snapshot-revert dom $(virsh snapshot-current dom --name) I thought it would be nice to do: $ virsh snapshot-revert dom --current I didn't add 'virsh snapshot-dumpxml --current' since we already have 'virsh snapshot-current' for the same task. snapshot-list accepted a name but did not require it, and that remains the case, with --current serving in place of that name. For all other commands, name used to be required, and can now be replaced by --current; I intentionally made it so that omitting both --current and a name is an error (having the absence of a name imply --current seems just a bit too magic, so --current must be explicit). I also had to keep snapshot-edit backwards-compatible, as the only command that already had a --current argument alongside a name, which still works to both edit a named snapshot and make it current. * tools/virsh.c (vshLookupSnapshot): New helper function. (cmdSnapshotEdit, cmdSnapshotList, cmdSnapshotParent) (cmdSnapshotDelete, cmdDomainSnapshotRevert): Use it, adding an option where needed. * tools/virsh.pod (snapshot-delete, snapshot-edit) (snapshot-list, snapshot-parent, snapshot-revert): Document use of --current. (snapshot-dumpxml): Mention alternative.
Showing
想要评论请 注册 或 登录