qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [for-2.9 6/8] qapi-schema: SocketAddressFl


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [for-2.9 6/8] qapi-schema: SocketAddressFlat variants 'vsock' and 'fd'
Date: Thu, 30 Mar 2017 08:14:02 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 03/30/2017 01:55 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> On 03/29/2017 11:45 AM, Markus Armbruster wrote:
>>> Note that the new variants are impossible in qemu_gluster_glfs_init(),
>>> because the gconf->server can only come from qemu_gluster_parse_uri()
>>> or qemu_gluster_parse_json(), and neither can create anything but
>>> 'tcp' or 'unix'.
>>>
>>> Signed-off-by: Markus Armbruster <address@hidden>
>>> ---
>>>  block/gluster.c  |  2 ++
>>>  qapi-schema.json | 19 ++++++++-----------
>>>  2 files changed, 10 insertions(+), 11 deletions(-)
>>
>>> +# This is just like SocketAddress, except it's a flat union rather
>>> +# than a simple union.  Nicer because it avoids nesting (i.e. more {})
>>> +# on the wire.
>>>  #
>>>  # Since: 2.9
>>>  ##
>>>  { 'union': 'SocketAddressFlat',
>>>    'base': { 'type': 'SocketAddressFlatType' },
>>>    'discriminator': 'type',
>>> -  'data': { 'unix': 'UnixSocketAddress',
>>> -            'inet': 'InetSocketAddress' } }
>>> +  'data': { 'inet': 'InetSocketAddress',
>>> +            'unix': 'UnixSocketAddress',
>>> +            'vsock': 'VsockSocketAddress',
>>> +            'fd': 'String' } }
>>
>> Can we make 'fd':'str'?  That would be even less pointless nesting on
>> the wire.
> 
> I guess it's wrapped in an object here to keep the door open for
> future extensions.  Perhaps also for symmetry.

And I just reminded myself of the restrictions on flat unions:

"A flat union definition avoids nesting on the wire, and specifies a
set of common members that occur in all variants of the union.  The
'base' key must specify either a type name (the type must be a
struct, not a union), or a dictionary representing an anonymous type.
All branches of the union must be complex types, "

So the end result is that as written, you pass "addr":{"type":"fd",
"str":"name_of_fd"}; and we can't use 'fd':'str' in the schema after all.

With the fix that Max pointed out,
Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]