diff --git a/tools/virsh.c b/tools/virsh.c index 1f820e8b39..be2cd67622 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")}, @@ -8280,6 +8280,36 @@ cmdURI (vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) return TRUE; } +/* + * "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 */ @@ -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 bfaa67ec45..a2ca3844be 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 + +Print the XML representation of the hypervisor sysinfo, if available. + =item B Returns basic information about the node, like number and type of CPU,