mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
sysinfo: implement virsh support
* tools/virsh.c (cmdSysinfo): New function. (hostAndHypervisorCmds): Add it. * tools/virsh.pod: Document it.
This commit is contained in:
parent
5c8dedddcc
commit
c82be0530e
@ -8223,7 +8223,7 @@ cmdNodeDeviceReset (vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "hostkey" command
|
* "hostname" command
|
||||||
*/
|
*/
|
||||||
static const vshCmdInfo info_hostname[] = {
|
static const vshCmdInfo info_hostname[] = {
|
||||||
{"help", N_("print the hypervisor hostname")},
|
{"help", N_("print the hypervisor hostname")},
|
||||||
@ -8280,6 +8280,36 @@ cmdURI (vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
|||||||
return TRUE;
|
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
|
* "vncdisplay" command
|
||||||
*/
|
*/
|
||||||
@ -10417,6 +10447,7 @@ static const vshCmdDef hostAndHypervisorCmds[] = {
|
|||||||
{"hostname", cmdHostname, NULL, info_hostname},
|
{"hostname", cmdHostname, NULL, info_hostname},
|
||||||
{"nodeinfo", cmdNodeinfo, NULL, info_nodeinfo},
|
{"nodeinfo", cmdNodeinfo, NULL, info_nodeinfo},
|
||||||
{"qemu-monitor-command", cmdQemuMonitorCommand, opts_qemu_monitor_command, info_qemu_monitor_command},
|
{"qemu-monitor-command", cmdQemuMonitorCommand, opts_qemu_monitor_command, info_qemu_monitor_command},
|
||||||
|
{"sysinfo", cmdSysinfo, NULL, info_sysinfo},
|
||||||
{"uri", cmdURI, NULL, info_uri},
|
{"uri", cmdURI, NULL, info_uri},
|
||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -132,6 +132,7 @@ group as an option. For example:
|
|||||||
freecell NUMA free memory
|
freecell NUMA free memory
|
||||||
hostname print the hypervisor hostname
|
hostname print the hypervisor hostname
|
||||||
qemu-monitor-command Qemu Monitor Command
|
qemu-monitor-command Qemu Monitor Command
|
||||||
|
sysinfo print the hypervisor sysinfo
|
||||||
uri print the hypervisor canonical URI
|
uri print the hypervisor canonical URI
|
||||||
|
|
||||||
To display detailed information for a specific command, give its name as the
|
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.
|
Print the hypervisor hostname.
|
||||||
|
|
||||||
|
=item B<sysinfo>
|
||||||
|
|
||||||
|
Print the XML representation of the hypervisor sysinfo, if available.
|
||||||
|
|
||||||
=item B<nodeinfo>
|
=item B<nodeinfo>
|
||||||
|
|
||||||
Returns basic information about the node, like number and type of CPU,
|
Returns basic information about the node, like number and type of CPU,
|
||||||
|
Loading…
Reference in New Issue
Block a user