summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJán Tomko <jtomko@redhat.com>2012-12-13 14:08:00 +0100
committerJiri Denemark <jdenemar@redhat.com>2012-12-13 16:39:38 +0100
commitd94b501b7bffd8a2e30ecc2928b679251e8ef80e (patch)
tree6117a4eeb895957d196021a05c64aec568e0f822
parent64f0e145c1b930cd294651a212da0fed60299523 (diff)
downloadlibvirt-d94b501b7bffd8a2e30ecc2928b679251e8ef80e.tar.gz
virsh: don't lie about reconnection in vshReconnect
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.
-rw-r--r--tools/virsh.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/virsh.c b/tools/virsh.c
index b4829a34df..9845b1259d 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -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)