From: Peter Krempa Date: Wed, 6 May 2020 15:12:12 +0000 (+0200) Subject: virQEMUCapsProbeQMPDeviceProperties: Switch to local implementation X-Git-Tag: v6.4.0-rc1~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be9771a1d24e62e445388b7806a801369218a85c;p=thirdparty%2Flibvirt.git virQEMUCapsProbeQMPDeviceProperties: Switch to local implementation Reimplement device property detection directly rather than using virQEMUCapsProbeQMPGenericProps in preparation for changes to the detection code. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- 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; }