]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virsh: use vshReconnect for non-default connections too
authorJán Tomko <jtomko@redhat.com>
Thu, 13 Dec 2012 13:08:01 +0000 (14:08 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 13 Dec 2012 15:39:38 +0000 (16:39 +0100)
For non-default connections (specified by the environment variable or
the command line option) we call virConnectOpenAuth without registering
the vshCatchDisconnect callback.

This calls vshReconnect instead which takes care of it.

tools/virsh.c

index 9845b1259da175b30d819513c25a9019f89abd8f..465cb444e9aac0c061a18e954ba6c66f0fd5864e 100644 (file)
@@ -2189,10 +2189,7 @@ vshInit(vshControl *ctl)
     ctl->eventLoopStarted = true;
 
     if (ctl->name) {
-        ctl->conn = virConnectOpenAuth(ctl->name,
-                                       virConnectAuthPtrDefault,
-                                       ctl->readonly ? VIR_CONNECT_RO : 0);
-
+        vshReconnect(ctl);
         /* Connecting to a named connection must succeed, but we delay
          * connecting to the default connection until we need it
          * (since the first command might be 'connect' which allows a
@@ -2201,7 +2198,6 @@ vshInit(vshControl *ctl)
          */
         if (!ctl->conn) {
             vshReportError(ctl);
-            vshError(ctl, "%s", _("failed to connect to the hypervisor"));
             return false;
         }
     }