On 11/18/20 9:45 AM, Eduardo Habkost wrote: > On Wed, Nov 18, 2020 at 02:53:26PM +0100, Markus Armbruster wrote: > [...] >> Another way to skin this cat: >> >> {"available": {"kvm": { extra properties... }, >> "tcg": ..., >> "xen": ...}, >> "active": "kvm"} > > How would this structure be represented in the QAPI schema? > > In other words, how do I say "Dict[str, AccelInfo]" in QAPIese?
{'type':'AvailAccel', 'data': { '*kvm': 'KvmExtraProps', '*tcg': 'TcgExtraProps', '*xen': 'XenExtraProps', '*hax': 'HaxExtraProps' } } {'command':'query-accel', 'returns': { 'available': 'AvailAccel', 'active': 'strOrEnum' } } where adding a new accelerator then adds a new optional member to AvailAccel as well as possibly a new enum member if 'active' is driving by an enum instead of 'str'. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org