virsh: Add support for VIR_DOMAIN_GUEST_INFO_DEVICES

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>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik committed 2026-08-17 14:20:41 +02:00
1 parent af5db68758
commit a634a99a07
2 files changed
+19 -4

No files matched your search

+13 -4
View File
@@ -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 (in decimal)
* ``device.<num>.pciDevice`` - device ID for PCI device (in decimal)
guestvcpus
----------
+6
View File
@@ -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;