[PATCH] qemu: Report disk bus as reported by agent in virDomainGetGuestInfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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.<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
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.<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
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.48.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux