Use slot_list_collapse() on the final list returned by query-device-slots. This way we combine similar entries from different buses.
For example, a machine with multiple IDE buses with no devices would return a single entry like this: { "available":true, "count":10, "device-types":["ide-device"], "hotpluggable":false, "opts":[ {"option":"unit","values":[[0,1]]}, {"option":"bus","values":["ide.4","ide.3","ide.5","ide.0","ide.1"]} ], "opts-complete":true } Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- qdev-monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qdev-monitor.c b/qdev-monitor.c index 785f4af..edc6e34 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -673,7 +673,8 @@ DeviceSlotInfoList *qmp_query_device_slots(Error **errp) SlotListState s = { .next = &s.result }; object_child_foreach_recursive(qdev_get_machine(), enumerate_bus, &s); - return s.result; + + return slot_list_collapse(s.result); } -- 2.9.4