[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 22/21] virt-admin: Don't tell everyone needlessly we're connected



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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index bc9ae9366280..5ce35f8dd5d3 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -119,8 +119,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;
@@ -288,6 +286,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;
@@ -296,6 +295,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;
 }
--
2.7.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]