qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] nbd-server-add [was: [PATCH 2/2] nbd-client: enable TCP kee


From: Eric Blake
Subject: [Qemu-devel] nbd-server-add [was: [PATCH 2/2] nbd-client: enable TCP keepalive]
Date: Wed, 5 Jun 2019 15:11:16 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 6/5/19 2:48 PM, Eric Blake wrote:

> This also made me wonder if we should start a deprecation clock to
> improve the nbd-server-start command to use SocketAddress instead of
> SocketAddressLegacy.  If we revive Max's work on implementing a default
> branch for a union discriminator
> (https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg01682.html),
> we could have something like:

Re-reading that thread, I see that Markus was arguing for a slightly
different QAPI syntax than Max's proposal, basically:

> 
> { 'enum': 'NbdSocketAddressHack',
>   'data': [ 'legacy', 'inet', 'unix' ] }
> { 'struct': 'NbdServerAddrLegacy',
>   'data': { 'addr', 'SocketAddressLegacy' } }
> { 'union': 'NbdServerAddr',
>   'base': { 'type': 'NbdSocketAddressHack',
>             '*tls-creds': 'str',
>             '*tls-authz': 'str' },
>   'discriminator': 'type',
>   'default-variant': 'legacy',
>   'data': { 'legacy': 'NbdServerAddrLegacy',
>             'inet', 'InetSocketAddress',
>             'unix', 'UnixSocketAddress' } }
> { 'command', 'nbd-server-start', 'data': 'NbdServerAddr' }

{ 'union': 'NbdServerAddr',
  'base': { '*type': { 'type': 'NbdSocketAddressHack',
                       'default': 'legacy' },
            '*tls-creds', 'str', '*tls-authz', 'str' },
  'discriminator': 'type',
  'data': { 'legacy': 'NbdServerAddrLegacy',
            'inet', 'InetSocketAddress',
            'unix', 'UnixSocketAddress' } }

> 
> which should be backwards compatible with the existing:
> 
> { "execute": "nbd-server-start", "arguments": {
>     "tls-authz": "authz0",
>     "addr": { "type": "inet", "data": {
>       "host": "localhost", "port": "10809" } } } }
> 
> by relying on the discriminator's default expansion to:
> 
> { "execute": "nbd-server-start", "arguments": {
>     "tls-authz": "authz0",
>     "type": "legacy",
>     "addr": { "type": "inet", "data": {
>       "host": "localhost", "port": "10809" } } } }

But this part remains true - if a flat union has an optional
discriminator, then the discriminator must include a default value,
where omitting the discriminator then results in sane expansion, and
where a careful choice of discriminator default allows legacy syntax to
co-exist with new preferred syntax.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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