]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virsh: don't lie about reconnection in vshReconnect
authorJán Tomko <jtomko@redhat.com>
Thu, 13 Dec 2012 13:08:00 +0000 (14:08 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 13 Dec 2012 15:39:38 +0000 (16:39 +0100)
Since we (ab)use vshReconnect for the default URI connection, if it
fails it might print 'Failed to reconnect to the hypervisor' even if we
were never connected before.

This changes it to only mention reconnection on the first try after
getting disconnected.

tools/virsh.c

index b4829a34df9def11c5622a704c3edd10c4f1afb3..9845b1259da175b30d819513c25a9019f89abd8f 100644 (file)
@@ -331,7 +331,10 @@ vshReconnect(vshControl *ctl)
                                    virConnectAuthPtrDefault,
                                    ctl->readonly ? VIR_CONNECT_RO : 0);
     if (!ctl->conn) {
-        vshError(ctl, "%s", _("Failed to reconnect to the hypervisor"));
+        if (disconnected)
+            vshError(ctl, "%s", _("Failed to reconnect to the hypervisor"));
+        else
+            vshError(ctl, "%s", _("failed to connect to the hypervisor"));
     } else {
         if (virConnectRegisterCloseCallback(ctl->conn, vshCatchDisconnect,
                                             NULL, NULL) < 0)