]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Clear vsh last error during virshCommandOptVolBy
authorJohn Ferlan <jferlan@redhat.com>
Mon, 16 Apr 2018 15:40:23 +0000 (11:40 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 17 Apr 2018 15:19:13 +0000 (11:19 -0400)
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>
tools/virsh-volume.c

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