]> git.ipfire.org Git - thirdparty/libvirt.git/commit
snapshot: better virsh handling of missing current, parent
authorEric Blake <eblake@redhat.com>
Fri, 30 Sep 2011 15:45:43 +0000 (09:45 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 4 Oct 2011 20:36:24 +0000 (14:36 -0600)
commit64703c03fc252e45b0eb80f169d4c32d33c45ce1
treef931dc24b77aa3f046430703e8a268d0b6185a5f
parentae37001d786692217c0506d46d067b1a5db08cd6
snapshot: better virsh handling of missing current, parent

Previously, virsh 'snapshot-parent' and 'snapshot-current' were
completely silent in the case where the code conclusively proved
there was no parent or current snapshot, but differed in exit
status; this silence caused some confusion on whether the commands
worked.  Furthermore, commit d1be48f introduced a regression where
snapshot-parent would leak output about an unknown function, but
only on the first attempt, when talking to an older server that
lacks virDomainSnapshotGetParent.  This changes things to consistenly
report an error message and exit with status 1 when no snapshot
exists, and to avoid leaking unknown function warnings when using
fallbacks.

* tools/virsh.c (vshGetSnapshotParent): Alter signature, to
distinguish between real error and missing parent.  Don't pollute
last_error on success.
(cmdSnapshotParent): Adjust caller.  Always output message on
failure.
(cmdSnapshotList): Adjust caller.
(cmdSnapshotCurrent): Always output message on failure.
tools/virsh.c