[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 01/28] qapi: Document type-safety considerati
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v5 01/28] qapi: Document type-safety considerations |
Date: |
Wed, 01 Apr 2015 09:36:39 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
On 04/01/2015 09:29 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> 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