[libvirt] [PATCH] virsh: Don't output node frequency if unknown

Martin Kletzander mkletzan at redhat.com
Fri Jul 10 09:07:08 UTC 2015

Commit ed8155eafbff5c5ca0bdfe84a8388f58b718c2f9 documented that
mhz field in virNodeInfo might be 0 if the frequency is unknown.  Modify
virsh to know about that.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
 tools/virsh-host.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 66f7fd9e62e4..7a223931b152 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -606,7 +606,8 @@ cmdNodeinfo(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
     vshPrint(ctl, "%-20s %s\n", _("CPU model:"), info.model);
     vshPrint(ctl, "%-20s %d\n", _("CPU(s):"), info.cpus);
-    vshPrint(ctl, "%-20s %d MHz\n", _("CPU frequency:"), info.mhz);
+    if (info.mhz)
+        vshPrint(ctl, "%-20s %d MHz\n", _("CPU frequency:"), info.mhz);
     vshPrint(ctl, "%-20s %d\n", _("CPU socket(s):"), info.sockets);
     vshPrint(ctl, "%-20s %d\n", _("Core(s) per socket:"), info.cores);
     vshPrint(ctl, "%-20s %d\n", _("Thread(s) per core:"), info.threads);

More information about the libvir-list mailing list