On Fri, Aug 14, 2026 at 13:47:47 +0200, Michal Privoznik via Devel wrote:
From: Michal Privoznik <mprivozn@redhat.com>
QEMU guest agent has 'guest-get-devices` command, which returns information on guest devices (driver name, version, release date, and so on). In this commit the public API part is introduced.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- include/libvirt/libvirt-domain.h | 78 ++++++++++++++++++++++++++++++++ src/libvirt-domain.c | 5 ++ 2 files changed, 83 insertions(+)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index f4dfe9fb1a..874fc4b455 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -8867,6 +8867,83 @@ int virDomainSetLaunchSecurityState(virDomainPtr domain, */ # define VIR_DOMAIN_GUEST_INFO_LOAD_15M "load.15m"
+/** + * VIR_DOMAIN_GUEST_INFO_DEVICE_COUNT: + * + * The number of guest devices that detailed information is fetched for as + * unsigned int. + * + * Since: 12.7.0 + */ +# define VIR_DOMAIN_GUEST_INFO_DEVICE_COUNT "device.count" + +/** + * VIR_DOMAIN_GUEST_INFO_DEVICE_PREFIX: + * + * The parameter name prefix to access each device entry. Concatenate the + * prefix, the entry number formatted as an unsigned integer and one of the + * device suffix parameters to form a complete parameter name. + * + * Since: 12.7.0 + */ +# define VIR_DOMAIN_GUEST_INFO_DEVICE_PREFIX "device." + +/** + * VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_DRIVER_NAME: + * + * Name of the device driver (e.g. ``VirtIO Balloon Driver``) as a string. + * + * Since: 12.7.0 + */ +# define VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_DRIVER_NAME ".driverName" + +/** + * VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_DRIVER_DATE: + * + * Driver release date in seconds since the epoch (e.g. 1736726400000) as long long.
The example number seems to be in milliseconds (13 january 2025). QEMU documents the passed value as nanoseconds. You document it as seconds. So, which one is it? :D
+ * + * Since: 12.7.0 + */ +# define VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_DRIVER_DATE ".driverDate" + +/** + * VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_DRIVER_VERSION: + * + * Driver version (e.g. ``100.100.104.27100``) as a string. + * + * Since: 12.7.0 + */ +# define VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_DRIVER_VERSION ".driverVersion" + +/** + * VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_ID_TYPE: + * + * Device identification (e.g. ``pci``) as a string. + * + * Since: 12.7.0 + */ +# define VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_ID_TYPE ".idType" + +/** + * VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_PCI_VENDOR: + * + * PCI device (a device with VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_ID_TYPE equal + * to ``pci``) vendor id (e.g. 6900) as a unsigned int. + * + * Since: 12.7.0 + */ +# define VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_PCI_VENDOR ".pciVendor" + +/** + * VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_PCI_DEVICE: + * + * PCI device (a device with VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_ID_TYPE equal + * to ``pci``) device id (e.g. 4165) as a unsigned int. + * + * Since: 12.7.0 + */ +# define VIR_DOMAIN_GUEST_INFO_DEVICE_SUFFIX_PCI_DEVICE ".pciDevice"
Here it's okay since it's numeric, but in virsh we'll have to explicitly document that this is not in the usual hexadecimal format.