]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virQEMUCapsProbeQMPDeviceProperties: Switch to local implementation
authorPeter Krempa <pkrempa@redhat.com>
Wed, 6 May 2020 15:12:12 +0000 (17:12 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 May 2020 04:55:00 +0000 (06:55 +0200)
Reimplement device property detection directly rather than using
virQEMUCapsProbeQMPGenericProps in preparation for changes to the
detection code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_capabilities.c

index dadbef32a233e0c3772b730602747a6eed270384..5e72dead452460016eef834fd39065261c42a4ee 100644 (file)
@@ -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;
 }