From 89a57e7fe092b5726bc333373d46960b790de0a0 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 26 Feb 2025 12:44:02 +0100 Subject: [PATCH] qemu: Report disk bus as reported by agent in virDomainGetGuestInfo MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- docs/manpages/virsh.rst | 1 + src/libvirt-domain.c | 1 + src/qemu/qemu_driver.c | 9 +++++++++ 3 files changed, 11 insertions(+) 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) { -- 2.47.3