All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Wen Congyang <wency@cn.fujitsu.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Alberto Garcia <berto@igalia.com>,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	qemu block <qemu-block@nongnu.org>,
	Jiang Yunhong <yunhong.jiang@intel.com>,
	Dong Eddie <eddie.dong@intel.com>,
	qemu devel <qemu-devel@nongnu.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Gonglei <arei.gonglei@huawei.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Yang Hongyang <yanghy@cn.fujitsu.com>
Subject: Re: [Qemu-devel] [PATCH v3 1/5] support nbd driver in blockdev-add
Date: Mon, 14 Sep 2015 16:27:50 +0200	[thread overview]
Message-ID: <87r3m1krdl.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1441878905-5272-2-git-send-email-wency@cn.fujitsu.com> (Wen Congyang's message of "Thu, 10 Sep 2015 17:55:01 +0800")

Wen Congyang <wency@cn.fujitsu.com> writes:

> The NBD driver needs: filename, path or (host, port, exportname).
> It checks which key exists and decides use unix or inet socket.
> It doesn't recognize the key type, so we can't use union, and
> can't reuse InetSocketAddress.
>
> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  qapi/block-core.json | 42 ++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 40 insertions(+), 2 deletions(-)
>
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 11134a8..e68a59f 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -1376,12 +1376,14 @@
>  #
>  # @host_device, @host_cdrom: Since 2.1
>  #
> +# @nbd: Since 2.5
> +#
>  # Since: 2.0
>  ##
>  { 'enum': 'BlockdevDriver',
>    'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop',
>              'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
> -            'http', 'https', 'null-aio', 'null-co', 'parallels',
> +            'http', 'https', 'nbd', 'null-aio', 'null-co', 'parallels',
>              'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx',
>              'vmdk', 'vpc', 'vvfat' ] }
>  
> @@ -1797,6 +1799,42 @@
>              '*read-pattern': 'QuorumReadPattern' } }
>  
>  ##
> +# @BlockdevOptionsNBD
> +#
> +# Driver specific block device options for NBD
> +#
> +# @filename: #optional unix or inet path. The format is:
> +#            unix: nbd+unix:///export?socket=path or
> +#                  nbd:unix:path:exportname=export
> +#            inet: nbd[+tcp]://host[:port]/export or
> +#                  nbd:host[:port]:exportname=export
> +#
> +# @path: #optional filesystem path to use
> +#
> +# @host: #optional host part of the address
> +#
> +# @port: #optional port part of the address
> +#
> +# @ipv4: #optional whether to accept IPv4 addresses, default try both IPv4
> +#        and IPv6
> +#
> +# @ipv6: #optional whether to accept IPv6 addresses, default try both IPv4
> +#        and IPv6
> +#
> +# @export: #optional the NBD export name
> +#
> +# Since: 2.5
> +##
> +{ 'struct': 'BlockdevOptionsNBD',
> +  'data': { '*filename': 'str',
> +            '*path':     'str',
> +            '*host':     'str',
> +            '*port':     'str',
> +            '*ipv4':     'bool',
> +            '*ipv6':     'bool',
> +            '*export':   'str' } }
> +
> +##

I'm afraid this doesn't address Eric's review of your v2.

In v2, you had

    { 'struct': 'BlockdevOptionsNBD',
      'base': 'InetSocketAddress',
      'data': { '*export': 'str' } }

Eric observed that InetSocketAddress can represent a port range.  Since
NBD doesn't support a range, he suggested to have two types rather than
InetSocketAddress: one to represent a single port, and another one to
represent a port range.  He further suggested to make the single port
type a base type of the port range type.

Eric further observed that support for the nbd+unix transport was
missing, and suggested to have a union type combining the various
transports.

Instead of that, you simply replaced InetSocketAddress by a bunch of
optional arguments with (unspoken!) conditions, such as "either
filename, or path+host".  That's not how we want things done in the
schema.

If we decide we want types separate for single ports and port range, you
need those two types.  For either one, you need a union type combining
transports.  It already exists for port ranges: SocketAddress.  You need
to create the other.

We can then discuss names.  For me, InetSocketAddress and SocketAddress
strongly suggest single port.  I'd prefer naming the port range types
*AddressRange or something.

If we decide separate types for single port and port ranges aren't
worthwhile, you can simply use SocketAddress where your v2 used
InetSocketAddress.

Eric, how strongly do you feel about separating the two?

>  # @BlockdevOptions
>  #
>  # Options for creating a block device.
> @@ -1822,7 +1860,7 @@
>        'http':       'BlockdevOptionsFile',
>        'https':      'BlockdevOptionsFile',
>  # TODO iscsi: Wait for structured options
> -# TODO nbd: Should take InetSocketAddress for 'host'?
> +      'nbd':        'BlockdevOptionsNBD',
>  # TODO nfs: Wait for structured options
>        'null-aio':   'BlockdevOptionsNull',
>        'null-co':    'BlockdevOptionsNull',

  reply	other threads:[~2015-09-14 14:28 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10  9:55 [Qemu-devel] [PATCH v3 0/5] qapi: child add/delete support Wen Congyang
2015-09-10  9:55 ` [Qemu-devel] [PATCH v3 1/5] support nbd driver in blockdev-add Wen Congyang
2015-09-14 14:27   ` Markus Armbruster [this message]
2015-09-14 15:47     ` Eric Blake
2015-09-15  1:39       ` Wen Congyang
2015-09-15  7:37         ` Markus Armbruster
2015-09-15  8:01           ` Wen Congyang
2015-09-15 11:12             ` Markus Armbruster
2015-09-16  5:59               ` Wen Congyang
2015-09-16  8:21                 ` Markus Armbruster
2015-09-16  8:24                   ` Wen Congyang
2015-09-16 11:18                     ` Markus Armbruster
2015-09-16 14:53                       ` [Qemu-devel] [Qemu-block] " Eric Blake
2015-09-17  1:06                         ` Wen Congyang
2015-09-17  1:04                       ` [Qemu-devel] " Wen Congyang
2015-09-17  5:01                         ` Markus Armbruster
2015-09-15 13:03           ` Eric Blake
2015-09-15 13:26             ` Kevin Wolf
2015-09-15  2:20       ` Wen Congyang
2015-09-15  2:27         ` Wen Congyang
2015-09-15  3:46           ` Eric Blake
2015-09-15  3:58             ` Wen Congyang
2015-09-15 13:11               ` Eric Blake
2015-09-16  7:11                 ` Wen Congyang
2015-09-16 14:55                   ` Eric Blake
2015-09-10  9:55 ` [Qemu-devel] [PATCH v3 2/5] Add new block driver interface to add/delete a BDS's child Wen Congyang
2015-09-10  9:55 ` [Qemu-devel] [PATCH v3 3/5] quorum: implement bdrv_add_child() and bdrv_del_child() Wen Congyang
2015-09-10  9:55 ` [Qemu-devel] [PATCH v3 4/5] qmp: add monitor command to add/remove a child Wen Congyang
2015-09-10 10:04   ` Daniel P. Berrange
2015-09-10 10:34     ` Wen Congyang
2015-09-14 14:36   ` Markus Armbruster
2015-09-14 15:34     ` Kevin Wolf
2015-09-14 16:09       ` Markus Armbruster
2015-09-15  2:40     ` Wen Congyang
2015-09-15  7:49       ` Markus Armbruster
2015-09-15  7:57         ` Wen Congyang
2015-09-16  6:31         ` Wen Congyang
2015-09-16  8:29           ` Markus Armbruster
2015-09-14 15:37   ` Kevin Wolf
2015-09-15  2:33     ` Wen Congyang
2015-09-15  8:56     ` Alberto Garcia
2015-09-15  9:20       ` Kevin Wolf
2015-09-15  9:26         ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2015-09-10  9:55 ` [Qemu-devel] [PATCH v3 5/5] hmp: " Wen Congyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3m1krdl.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=berto@igalia.com \
    --cc=dgilbert@redhat.com \
    --cc=eddie.dong@intel.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wency@cn.fujitsu.com \
    --cc=yanghy@cn.fujitsu.com \
    --cc=yunhong.jiang@intel.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.