]> xenbits.xensource.com Git - libvirt.git/commitdiff
virt-admin: Don't tell everyone needlessly we're connected
authorMartin Kletzander <mkletzan@redhat.com>
Thu, 10 Mar 2016 05:34:03 +0000 (06:34 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Fri, 11 Mar 2016 11:58:41 +0000 (12:58 +0100)
There are cases when we don't want to tell the user we are connected.
That's for example when we first connect to the server without the
command 'connect' itself.  That helps to clear out output of first
command, mainly when running non-interactively.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
tools/virt-admin.c

index 60697e630d96254f012c44365a57a9cb7d4129ed..edb8690af4799c6e94a2be4367dad1f5375bb292 100644 (file)
@@ -120,8 +120,6 @@ vshAdmConnect(vshControl *ctl, unsigned int flags)
 
         if (priv->wantReconnect)
             vshPrint(ctl, "%s\n", _("Reconnected to the admin server"));
-        else
-            vshPrint(ctl, "%s\n", _("Connected to the admin server"));
     }
 
     return 0;
@@ -289,6 +287,7 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
 {
     const char *name = NULL;
     vshAdmControlPtr priv = ctl->privData;
+    bool connected = priv->conn;
 
     if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
         return false;
@@ -297,6 +296,8 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
     ctl->connname = vshStrdup(ctl, name);
 
     vshAdmReconnect(ctl);
+    if (!connected)
+        vshPrint(ctl, "%s\n", _("Connected to the admin server"));
 
     return !!priv->conn;
 }