[PATCH 2/8] virQEMUCapsProbeQMPDeviceProperties: Switch to local implementation

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

 



Reimplement device property detection directly rather than using
virQEMUCapsProbeQMPGenericProps in preparation for changes to the
detection code.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index dadbef32a2..5e72dead45 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2610,11 +2610,27 @@ static int
 virQEMUCapsProbeQMPDeviceProperties(virQEMUCapsPtr qemuCaps,
                                     qemuMonitorPtr mon)
 {
-    return virQEMUCapsProbeQMPGenericProps(qemuCaps,
-                                           mon,
-                                           virQEMUCapsDeviceProps,
-                                           G_N_ELEMENTS(virQEMUCapsDeviceProps),
-                                           qemuMonitorGetDeviceProps);
+    size_t i;
+
+    for (i = 0; i < G_N_ELEMENTS(virQEMUCapsDeviceProps); i++) {
+        virQEMUCapsObjectTypeProps *device = virQEMUCapsDeviceProps + i;
+        VIR_AUTOSTRINGLIST values = NULL;
+        int nvalues;
+
+        if (device->capsCondition >= 0 &&
+            !virQEMUCapsGet(qemuCaps, device->capsCondition))
+            continue;
+
+        if ((nvalues = qemuMonitorGetDeviceProps(mon, device->type, &values)) < 0)
+            return -1;
+
+        virQEMUCapsProcessStringFlags(qemuCaps,
+                                      device->nprops,
+                                      device->props,
+                                      nvalues, values);
+    }
+
+    return 0;
 }


-- 
2.26.2





[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