From: Peter Krempa Date: Wed, 26 Feb 2025 11:44:02 +0000 (+0100) Subject: qemu: Report disk bus as reported by agent in virDomainGetGuestInfo X-Git-Tag: v11.2.0-rc1~317 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=89a57e7fe092b5726bc333373d46960b790de0a0;p=thirdparty%2Flibvirt.git qemu: Report disk bus as reported by agent in virDomainGetGuestInfo KubeVirt decided to report this to the users. In order to allow them to use proper APIs expose the field as well. Resolves: https://issues.redhat.com/browse/RHEL-80688 Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index f159c40631..baced15dec 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -2999,6 +2999,7 @@ returned: * ``disk..serial`` - optional disk serial number * ``disk..alias`` - the device alias of the disk (e.g. sda) * ``disk..guest_alias`` - optional alias assigned to the disk +* ``disk..guest_bus`` - bus type as reported by the guest *--interface* returns: * ``if.count`` - the number of interfaces defined on this domain diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index ae15ab1e5a..05101756a1 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -13273,6 +13273,7 @@ virDomainSetVcpu(virDomainPtr domain, * "disk..alias" - the device alias of the disk (e.g. sda) * "disk..guest_alias" - optional alias assigned to the disk, on Linux * this is a name assigned by device mapper + * "disk..guest_bus" - disk bus as reported by the guest OS * * VIR_DOMAIN_GUEST_INFO_HOSTNAME: * Returns information about the hostname of the domain. The typed diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 3b8b2c0a1e..86b945d9b9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19278,6 +19278,15 @@ qemuAgentDiskInfoFormatParams(qemuAgentDiskInfo **info, param_name, diskdef->dst) < 0) return; } + + if (address->bus_type) { + g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, + "disk.%zu.guest_bus", i); + + if (virTypedParamsAddString(params, nparams, maxparams, + param_name, address->bus_type) < 0) + return; + } } if (info[i]->alias) {