From: Michal Privoznik <mprivozn@redhat.com> The virDomainGetGuestInfo() API is exposed as 'guestinfo' command. Introduce new --devices option for it to reflect introduction of VIR_DOMAIN_GUEST_INFO_DEVICES type. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- docs/manpages/virsh.rst | 17 +++++++++++++---- tools/virsh-domain.c | 6 ++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index a10d29e0ea..6803bbb57a 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3277,7 +3277,7 @@ guestinfo :: guestinfo domain [--user] [--os] [--timezone] [--hostname] [--filesystem] - [--disk] [--interface] + [--disk] [--interface] [--devices] Print information about the guest from the point of view of the guest agent. Note that this command requires a guest agent to be configured and running in @@ -3289,9 +3289,9 @@ Success is always reported in this case. You can limit the types of information that are returned by specifying one or more flags. Available information types flags are *--user*, *--os*, -*--timezone*, *--hostname*, *--filesystem*, *--disk*, *--interface* and *--load*. -If an explicitly requested information type is not supported by the guest agent -at that point, the processes will provide an exit code of 1. +*--timezone*, *--hostname*, *--filesystem*, *--disk*, *--interface*, *--load* +and *--devices*. If an explicitly requested information type is not supported +by the guest agent at that point, the processes will provide an exit code of 1. Note that depending on the hypervisor type and the version of the guest agent running within the domain, not all of the following information may be @@ -3374,6 +3374,15 @@ returned: * ``load.5m`` - average load in guest for last 5 minutes * ``load.15m`` - average load in guest for last 15 minutes +*--devices* returns: +* ``device.count`` - the number of devices that info is returned for +* ``device.<num>.driverName`` - name of the driver associated with device +* ``device.<num>.driverDate`` - driver release date in seconds since the epoch +* ``device.<num>.driverVersion`` - version of the driver associated with the device +* ``device.<num>.idType`` - device identification type (e.g. pci) +* ``device.<num>.pciVendor`` - vendor ID for PCI device +* ``device.<num>.pciDevice`` - device ID for PCI device + guestvcpus ---------- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 688df75f81..0a36575626 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -13763,6 +13763,10 @@ static const vshCmdOptDef opts_guestinfo[] = { .type = VSH_OT_BOOL, .help = N_("report load averages information"), }, + {.name = "devices", + .type = VSH_OT_BOOL, + .help = N_("report devices information"), + }, {.name = NULL} }; @@ -13792,6 +13796,8 @@ cmdGuestInfo(vshControl *ctl, const vshCmd *cmd) types |= VIR_DOMAIN_GUEST_INFO_INTERFACES; if (vshCommandOptBool(cmd, "load")) types |= VIR_DOMAIN_GUEST_INFO_LOAD; + if (vshCommandOptBool(cmd, "devices")) + types |= VIR_DOMAIN_GUEST_INFO_DEVICES; if (!(dom = virshCommandOptDomain(ctl, cmd, NULL))) return false; -- 2.54.0