virsh: Clear vsh last error during virshCommandOptVolBy

https://bugzilla.redhat.com/show_bug.cgi?id=1529256

If one of the virStorageVolLookupBy{Key|Name|Path} succeeds and
we have a @vol, then clear the last libvirt error; otherwise, a
subsequent "other" failure may cause vshReportError to erroneously
report the wrong error as well as a reported 'vshError' error that
caused the failure.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2018-04-16 11:40:23 -04:00
parent 3527f9dde6
commit 0d6e834103

View File

@ -129,6 +129,8 @@ virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
else else
vshError(ctl, _("failed to get vol '%s', specifying --%s " vshError(ctl, _("failed to get vol '%s', specifying --%s "
"might help"), n, pooloptname); "might help"), n, pooloptname);
} else {
vshResetLibvirtError();
} }
/* If the pool was specified, then make sure that the returned /* If the pool was specified, then make sure that the returned