[libvirt] [PATCH] virsh: Clear vsh last error during virshCommandOptVolBy

John Ferlan posted 1 patch 5 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180416155551.30377-1-jferlan@redhat.com
Test syntax-check passed
tools/virsh-volume.c | 2 ++
1 file changed, 2 insertions(+)
[libvirt] [PATCH] virsh: Clear vsh last error during virshCommandOptVolBy
Posted by John Ferlan 5 years, 11 months ago
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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index bacbec0d27..9d6ebd2325 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -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
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: Clear vsh last error during virshCommandOptVolBy
Posted by Peter Krempa 5 years, 11 months ago
On Mon, Apr 16, 2018 at 11:55:51 -0400, John Ferlan wrote:
> 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 | 2 ++
>  1 file changed, 2 insertions(+)

ACK
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list