
On Thu, Oct 20, 2016 at 15:05:21 -0500, Eric Blake wrote:
On 10/20/2016 10:25 AM, Peter Krempa wrote:
[...]
+ continue; + } else if (STREQ(metatype, "object")) { + if (**query == '+') + basename = virQEMUCapsQMPSchemaObjectGetType(*query + 1, + "variants", + "case", base); + else + basename = virQEMUCapsQMPSchemaObjectGetType(*query, + "members", + "name", + base);
I'm a bit worried here. Qemu promises that a name should not disappear from a QMP command, but warns that between releases, locating that name may migrate from the 'names' array (always present) to the 'variants' array (present only under some circumstances), based on what else was added to the command in the meantime. I guess what that means is that when qemu re-does a type layout, it may mean that we need two separate query paths (one for the old layout, one for the new) to properly detect the existence of that capability under all versions of qemu. I don't think it is a show-stopper, but is something to be aware of.
This is very unpleasant to code against. Looking into all variants would certainly be wrong in some cases.i I think we can possibly add a '*' operator for the variant, which could iterate all the variants and find the first match. I've prepared the function for recursion as I wanted to implement the 'alternate's this way.