]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Report disk bus as reported by agent in virDomainGetGuestInfo
authorPeter Krempa <pkrempa@redhat.com>
Wed, 26 Feb 2025 11:44:02 +0000 (12:44 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 3 Mar 2025 14:08:19 +0000 (15:08 +0100)
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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
docs/manpages/virsh.rst
src/libvirt-domain.c
src/qemu/qemu_driver.c

index f159c40631ec5e55cc6c73ceb3fd8b7b54a26912..baced15dec660a2c6888fb7641ba70c439037786 100644 (file)
@@ -2999,6 +2999,7 @@ returned:
 * ``disk.<num>.serial`` -  optional disk serial number
 * ``disk.<num>.alias`` - the device alias of the disk (e.g. sda)
 * ``disk.<num>.guest_alias`` - optional alias assigned to the disk
+* ``disk.<num>.guest_bus`` - bus type as reported by the guest
 
 *--interface* returns:
 * ``if.count`` - the number of interfaces defined on this domain
index ae15ab1e5a940f6f09307599bcb9ec958c406cc3..05101756a15d607abda9179296e15712d9300601 100644 (file)
@@ -13273,6 +13273,7 @@ virDomainSetVcpu(virDomainPtr domain,
  *      "disk.<num>.alias" - the device alias of the disk (e.g. sda)
  *      "disk.<num>.guest_alias" - optional alias assigned to the disk, on Linux
  *                      this is a name assigned by device mapper
+ *      "disk.<num>.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
index 3b8b2c0a1edac881c0a1ba2a82c8ea9d97198e65..86b945d9b9b99f517ee1f2e489d3db8402189746 100644 (file)
@@ -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) {