[libvirt] [PATCH] virt-admin: Fix the error when an invalid URI has been provided

Martin Kletzander mkletzan at redhat.com
Tue Aug 9 19:52:17 UTC 2016

On Tue, Aug 09, 2016 at 04:21:39PM +0200, Erik Skultety wrote:
>After commit 9d479dd1 fiddled with the cmdConnect's output which used to be a
>bit more verbose prior to the mentioned commit, the program flow would result
>in a quite confusing error if an invalid URI has been provided:
>    error: Failed to connect to the admin server
>    Connected to the admin server
>    error: <some error>
>The problem is that the commit mentioned above relied on the fact that
>connect routine always succeeds which is not true.
>Signed-off-by: Erik Skultety <eskultet at redhat.com>
> tools/virt-admin.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>diff --git a/tools/virt-admin.c b/tools/virt-admin.c
>index 2ae05da..513054b 100644
>--- a/tools/virt-admin.c
>+++ b/tools/virt-admin.c
>@@ -351,7 +351,7 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
>     }
>     vshAdmReconnect(ctl);
>-    if (!connected)
>+    if (!connected && priv->conn)
>         vshPrint(ctl, "%s\n", _("Connected to the admin server"));

I can't believe how different the virsh and virt-admin clients are.
That's what I was worried about.  Anyway, ACK for now, but it'd be nice
to fix some of the differences.

It also must've sounded weird when I was referring to this patch in our
conversation like it's ACKed and I didn't even bother ACKing.  That's
because I didn't get the "mail not delivered" message until now.  Sorry
for that, my bad.

>     return !!priv->conn;
>libvir-list mailing list
>libvir-list at redhat.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160809/4d9f1741/attachment-0001.sig>

More information about the libvir-list mailing list