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

[libvirt] [PATCH] virsh: Add daemon version reporting



From: Michal Privoznik <mprivozn redhat com>

'virsh version' might report against which version of libvirtd is
running.
---
 tools/virsh.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index d98be1c..d3c3ce3 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -8620,6 +8620,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
     unsigned long libVersion;
     unsigned long includeVersion;
     unsigned long apiVersion;
+    unsigned long daemonVersion;
     int ret;
     unsigned int major;
     unsigned int minor;
@@ -8678,6 +8679,19 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
         vshPrint(ctl, _("Running hypervisor: %s %d.%d.%d\n"),
                  hvType, major, minor, rel);
     }
+
+    ret = virConnectGetLibVersion(ctl->conn, &daemonVersion);
+    if (ret < 0) {
+        vshError(ctl, "%s", _("failed to get the daemon version"));
+        return false;
+    }
+    major = daemonVersion / 1000000;
+    daemonVersion %= 1000000;
+    minor = daemonVersion / 1000;
+    rel = daemonVersion % 1000;
+    vshPrint(ctl, _("Running against daemon: %d.%d.%d\n"),
+             major, minor, rel);
+
     return true;
 }
 
-- 
1.7.5.rc3


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