* tools/virsh.c (cmdSysinfo): New function.
(hostAndHypervisorCmds): Add it.
* tools/virsh.pod: Document it.
---
Implementing this before qemu support let me test the fallback cases.
tools/virsh.c | 33 ++++++++++++++++++++++++++++++++-
tools/virsh.pod | 5 +++++
2 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 1f820e8..be2cd67 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -8223,7 +8223,7 @@ cmdNodeDeviceReset (vshControl *ctl, const vshCmd *cmd)
}
/*
- * "hostkey" command
+ * "hostname" command
*/
static const vshCmdInfo info_hostname[] = {
{"help", N_("print the hypervisor hostname")},
@@ -8281,6 +8281,36 @@ cmdURI (vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
}
/*
+ * "sysinfo" command
+ */
+static const vshCmdInfo info_sysinfo[] = {
+ {"help", N_("print the hypervisor sysinfo")},
+ {"desc",
+ N_("output an XML string for the hypervisor sysinfo, if available")},
+ {NULL, NULL}
+};
+
+static int
+cmdSysinfo (vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
+{
+ char *sysinfo;
+
+ if (!vshConnectionUsability(ctl, ctl->conn))
+ return FALSE;
+
+ sysinfo = virConnectGetSysinfo (ctl->conn, 0);
+ if (sysinfo == NULL) {
+ vshError(ctl, "%s", _("failed to get sysinfo"));
+ return FALSE;
+ }
+
+ vshPrint (ctl, "%s", sysinfo);
+ VIR_FREE(sysinfo);
+
+ return TRUE;
+}
+
+/*
* "vncdisplay" command
*/
static const vshCmdInfo info_vncdisplay[] = {
@@ -10417,6 +10447,7 @@ static const vshCmdDef hostAndHypervisorCmds[] = {
{"hostname", cmdHostname, NULL, info_hostname},
{"nodeinfo", cmdNodeinfo, NULL, info_nodeinfo},
{"qemu-monitor-command", cmdQemuMonitorCommand, opts_qemu_monitor_command,
info_qemu_monitor_command},
+ {"sysinfo", cmdSysinfo, NULL, info_sysinfo},
{"uri", cmdURI, NULL, info_uri},
{NULL, NULL, NULL, NULL}
};
diff --git a/tools/virsh.pod b/tools/virsh.pod
index bfaa67e..a2ca384 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -132,6 +132,7 @@ group as an option. For example:
freecell NUMA free memory
hostname print the hypervisor hostname
qemu-monitor-command Qemu Monitor Command
+ sysinfo print the hypervisor sysinfo
uri print the hypervisor canonical URI
To display detailed information for a specific command, give its name as the
@@ -227,6 +228,10 @@ Prints the hypervisor canonical URI, can be useful in shell mode.
Print the hypervisor hostname.
+=item B<sysinfo>
+
+Print the XML representation of the hypervisor sysinfo, if available.
+
=item B<nodeinfo>
Returns basic information about the node, like number and type of CPU,
--
1.7.4