On 04/01/2015 09:29 AM, Markus Armbruster wrote: > Eric Blake <ebl...@redhat.com> writes: > > [...] >> === Union types === >>
>> + >> +A flat union definition specifies a complex type as its base, and >> +avoids nesting on the wire. In this case, the fields of the complex >> +type are included as top-level fields of the union dictionary in the >> +QMP wire format, and the 'discriminator' field must be the name of an >> +enum-typed member of the base type. An example definition is: >> >> { 'type': 'BlockdevCommonOptions', 'data': { 'readonly': 'bool' } } >> { 'union': 'BlockdevOptions', > 'base': 'BlockdevCommonOptions', > 'data': { 'raw': 'RawOptions', > 'qcow2': 'Qcow2Options' } } > > Where's 'discriminator'? Kevin already flagged this. I forgot to remove simple-with-base documentation in v5; it's already gone from my working copy of v6. > Resulting in this JSON object: > > { "driver": "qcow2", > "readonly": false, > "backing-file": "/some/place/my-image", > "lazy-refcounts": true } > > This actually matches the above example with the "data" wrapper peeled > off the variant part. Yep - with the bad intermediate stuff gone, the remaining stuff makes sense. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature