QEMU plans to deprecate 'query-events' as it's non-extensible. Events are also described by 'query-qmp-schema' so we can use that one instead. This patch adds detection of events to virQEMUCapsProbeQMPSchemaCapabilities using the same structure declaring them for the old approach (virQEMUCapsEvents). This is possible as the name is the same in the QMP schema and our detector supports that trivially. For any complex queries virQEMUCapsQMPSchemaQueries can be used in the future. For now we still call 'query-events' and discard the result so that it's obvious that the tests pass. This will be cleaned up later. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7f3f87c48d..9c79511b1d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2123,6 +2123,12 @@ virQEMUCapsProbeQMPEvents(virQEMUCapsPtr qemuCaps, if ((nevents = qemuMonitorGetEvents(mon, &events)) < 0) return -1; + /* we can probe events also from the QMP schema so we can skip this here */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_QMP_SCHEMA)) { + virStringListFreeCount(events, nevents); + return 0; + } + virQEMUCapsProcessStringFlags(qemuCaps, ARRAY_CARDINALITY(virQEMUCapsEvents), virQEMUCapsEvents, @@ -4138,6 +4144,14 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCapsPtr qemuCaps, virQEMUCapsSet(qemuCaps, entry->flag); } + /* probe also for basic event support */ + for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsEvents); i++) { + entry = virQEMUCapsEvents + i; + + if (virQEMUQAPISchemaPathExists(entry->value, schema)) + virQEMUCapsSet(qemuCaps, entry->flag); + } + virHashFree(schema); return 0; } -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list