qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 2/2] qapi: Allow blockdev-add for NBD
Date: Wed,  3 Feb 2016 17:33:16 +0100	[thread overview]
Message-ID: <1454517196-4560-3-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1454517196-4560-1-git-send-email-mreitz@redhat.com>

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
- 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.

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

diff --git a/qapi/block-core.json b/qapi/block-core.json
index 33012b8..e1b8543 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1567,13 +1567,14 @@
 # Drivers that are supported in block device operations.
 #
 # @host_device, @host_cdrom: Since 2.1
+# @nbd: Since 2.6
 #
 # 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' ] }
 
@@ -2002,6 +2003,29 @@
             '*read-pattern': 'QuorumReadPattern' } }
 
 ##
+# @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.
+#
+# Since: 2.6
+##
+{ 'struct': 'BlockdevOptionsNbd',
+  'data': { '*host':    'str',
+            '*port':    'str',
+            '*path':    'str',
+            '*export':  'str' } }
+
+##
 # @BlockdevOptions
 #
 # Options for creating a block device.
@@ -2027,7 +2051,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',
-- 
2.7.0

  parent reply	other threads:[~2016-02-03 16:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 16:33 [Qemu-devel] [PATCH 0/2] qapi: Allow blockdev-add for NBD Max Reitz
2016-02-03 16:33 ` [Qemu-devel] [PATCH 1/2] block/nbd: Reject port parameter without host Max Reitz
2016-02-03 16:38   ` Eric Blake
2016-02-03 16:39     ` Max Reitz
2016-02-03 16:33 ` Max Reitz [this message]
2016-02-03 16:48   ` [Qemu-devel] [PATCH 2/2] qapi: Allow blockdev-add for NBD Eric Blake
2016-02-03 17:00     ` Max Reitz
2016-02-04 11:58     ` Paolo Bonzini
2016-02-03 17:06   ` Daniel P. Berrange
2016-02-03 17:16     ` Max Reitz
2016-02-04 12:01       ` Paolo Bonzini
2016-02-04 13:08     ` Kevin Wolf
2016-02-04 13:19       ` Daniel P. Berrange

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=1454517196-4560-3-git-send-email-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).