From d2d23aa2a6a605ad9bb838033681e4ead51b959a Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 12 Nov 2020 14:31:57 +0100 Subject: [PATCH] tools: virsh: Reset error when keepalive registration fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- tools/virsh.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/virsh.c b/tools/virsh.c index 954778b626..a6bfbbbb87 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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: