On Wed, Nov 18, 2020 at 12:28:45PM +0100, Kevin Wolf wrote: > Am 18.11.2020 um 09:36 hat Markus Armbruster geschrieben: > > >> >> [...] Even better would be > > >> >> returning an array of KvmInfo with information on all supported > > >> >> accelerators at once, rather than making the user call this command > > >> >> once > > >> >> per name. > > >> > > > >> > Maybe. It would save us the work of answering the question > > >> > above, but is this (querying information for all accelerators at > > >> > once) going to be a common use case? > > >> > > >> I recommend to scratch the query-accel parameter, and return information > > >> on all accelerators in this build of QEMU. Simple, and consistent with > > >> similar ad hoc queries. If a client is interested in just one, fishing > > >> it out of the list is easy enough. > > >> > > > > > > Works for me. I'll then leave KvmInfo as is and will introduce AccelInfo > > > with two fields: name and enabled. enabled will be true only for > > > currently active accelerator. > > > > Please document that at most on result can have 'enabled': true. > > This doesn't feel right. > > If I understand right, the proposal is to get a result like this: > > [ { 'name': 'kvm', 'enabled': true }, > { 'name': 'tcg', 'enabled': false }, > { 'name': 'xen', 'enabled': false } ] > > The condition that only one field can be enabled would only be in the > documentation instead of being enforced. > > Instead, consider a response like this: > > { 'available': [ 'kvm', 'tcg', 'xen' ], > 'active': 'kvm' } > > This is not only shorter, but also makes sure that only one accelerator > can be reported as active.
I guess this can be extended with a union to report extra props for the accelerator, discriminated on the 'active' field eg { 'available': [ 'kvm', 'tcg', 'xen' ], 'active': 'kvm', 'data': { "allow-nested": true, } } Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|