]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tools: virsh: Reset error when keepalive registration fails
authorPeter Krempa <pkrempa@redhat.com>
Thu, 12 Nov 2020 13:31:57 +0000 (14:31 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 13 Nov 2020 10:12:30 +0000 (11:12 +0100)
We try to enable keepalive oportunistically. If it's not supported by
the connection driver and it was not explicitly requested we keep the
error object set and can report it in some cases accidentally:

 --- stdout ---
 TEST: /home/pipo/libvirt/tests/virsh-self-test
       !                                        1   FAILED
 --- stderr ---
 error: parameter 'target' of command 'attach-disk' must be listed before optional parameters
 error: this function is not supported by the connection driver: virConnectSetKeepAlive
 -------

Clear the stored libvirt error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/virsh.c

index 954778b6268989e1ac934023965d980c70b2fdd6..a6bfbbbb87ea00450b770e47e88631e568676b33 100644 (file)
@@ -176,6 +176,7 @@ virshConnect(vshControl *ctl, const char *uri, bool readonly)
         }
         vshDebug(ctl, VSH_ERR_INFO, "%s",
                  _("Failed to setup keepalive on connection\n"));
+        vshResetLibvirtError();
     }
 
  cleanup: