[Top][All Lists]

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

Re: [Qemu-block] [PATCH 2/2] qapi: Allow blockdev-add for NBD

From: Eric Blake
Subject: Re: [Qemu-block] [PATCH 2/2] qapi: Allow blockdev-add for NBD
Date: Wed, 3 Feb 2016 09:48:46 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 02/03/2016 09:33 AM, Max Reitz wrote:
> We have to introduce a new object (BlockdevOptionsNbd) for several
> reasons:
> - Neither of InetSocketAddress nor UnixSocketAddress alone is
>   sufficient, because both are supported
> - We cannot use SocketAddress because NBD does not support an fd,
>   and because it is not a flat union which BlockdevOptionsNbd is

Can we do it anyways, and just error out/document that fd is unsupported?

> - We cannot use a flat union of InetSocketAddress and
>   UnixSocketAddress because we would need some kind of discriminator
>   which we do not have; we could inline the UnixSocketAddress as a
>   string and then make it an 'alternate' type instead of a union, but
>   this will not work either, because:
> - InetSocketAddress itself is not suitable for NBD because the port is
>   not optional (which it is for NBD) and because it offers more options
>   (like choosing between ipv4 and ipv6) which NBD does not support.

That, and qapi doesn't (yet) support the use of a flat union as the
branch of yet another flat union.

I'd like to reach the point where we can have a flat union with an
implicit discriminator (if the discriminator was not present, the
require a default branch), but don't think it should hold up this patch.
I also think that future qapi improvements may make it possible to
retrofit this struct to make the mutual exclusion between host/file more
obvious during introspection, rather than just by documentation.

> Signed-off-by: Max Reitz <address@hidden>
> ---
>  qapi/block-core.json | 28 ++++++++++++++++++++++++++--
>  1 file changed, 26 insertions(+), 2 deletions(-)

>  ##
> +# @BlockdevOptionsNbd
> +#
> +# Driver specific block device options for NBD. Either of @host or @path 
> must be
> +# specified, but not both.
> +#
> +# @host:    #optional Connects to the given host using TCP.
> +#
> +# @port:    #optional Specifies the TCP port to connect to; may be used only 
> in
> +#           conjunction with @host. Defaults to 10809.
> +#
> +# @path:    #optional Connects to the given Unix socket path.
> +#
> +# @export:  #optional Name of the NBD export to open.

Maybe mention that the default is no export name.

> +#
> +# Since: 2.6
> +##
> +{ 'struct': 'BlockdevOptionsNbd',
> +  'data': { '*host':    'str',
> +            '*port':    'str',
> +            '*path':    'str',
> +            '*export':  'str' } }

I'm not entirely convinced this is the final representation we want, but
I can't immediately propose anything nicer.

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]