On 03/30/2017 01:55 AM, Markus Armbruster wrote: > Eric Blake <ebl...@redhat.com> 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 <arm...@redhat.com> >>> --- >>> 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 <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature