The function was parsing 'qom-list-types' and then also calling function which parses 'device-list-properties' and also 'qom-list-properties'. Split it up into individual functions. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 51 ++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 2c6e36685e..dadbef32a2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2586,9 +2586,10 @@ virQEMUCapsProbeQMPGenericProps(virQEMUCapsPtr qemuCaps, return 0; } + static int -virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPObjectTypes(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) { int nvalues; char **values; @@ -2601,22 +2602,34 @@ virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps, nvalues, values); virStringListFreeCount(values, nvalues); - if (virQEMUCapsProbeQMPGenericProps(qemuCaps, - mon, - virQEMUCapsDeviceProps, - G_N_ELEMENTS(virQEMUCapsDeviceProps), - qemuMonitorGetDeviceProps) < 0) - return -1; + return 0; +} - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QOM_LIST_PROPERTIES) && - virQEMUCapsProbeQMPGenericProps(qemuCaps, - mon, - virQEMUCapsObjectProps, - G_N_ELEMENTS(virQEMUCapsObjectProps), - qemuMonitorGetObjectProps) < 0) - return -1; - return 0; +static int +virQEMUCapsProbeQMPDeviceProperties(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) +{ + return virQEMUCapsProbeQMPGenericProps(qemuCaps, + mon, + virQEMUCapsDeviceProps, + G_N_ELEMENTS(virQEMUCapsDeviceProps), + qemuMonitorGetDeviceProps); +} + + +static int +virQEMUCapsProbeQMPObjectProperties(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) +{ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QOM_LIST_PROPERTIES)) + return 0; + + return virQEMUCapsProbeQMPGenericProps(qemuCaps, + mon, + virQEMUCapsObjectProps, + G_N_ELEMENTS(virQEMUCapsObjectProps), + qemuMonitorGetObjectProps); } @@ -5061,7 +5074,11 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0) return -1; - if (virQEMUCapsProbeQMPDevices(qemuCaps, mon) < 0) + if (virQEMUCapsProbeQMPObjectTypes(qemuCaps, mon) < 0) + return -1; + if (virQEMUCapsProbeQMPDeviceProperties(qemuCaps, mon) < 0) + return -1; + if (virQEMUCapsProbeQMPObjectProperties(qemuCaps, mon) < 0) return -1; if (virQEMUCapsProbeQMPMachineTypes(qemuCaps, type, mon) < 0) return -1; -- 2.26.2