From 0f49f1dc6f447b136aaabe4903b7c7242478145f Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Fri, 10 Jul 2015 11:05:07 +0200 Subject: [PATCH] virsh: Don't output node frequency if unknown 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 --- tools/virsh-host.c | 3 ++- tools/virsh.pod | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 04ca1e5047..a3ffe0143f 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -637,7 +637,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); diff --git a/tools/virsh.pod b/tools/virsh.pod index bcfa165ada..5ee9a966ef 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -295,7 +295,8 @@ Print the XML representation of the hypervisor sysinfo, if available. Returns basic information about the node, like number and type of CPU, and size of the physical memory. The output corresponds to virNodeInfo structure. Specifically, the "CPU socket(s)" field means number of CPU -sockets per NUMA cell. +sockets per NUMA cell. The information libvirt displays is dependent +upon what each architecture may provide. =item B [I<--pretty>] -- GitLab