From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR0bx-0008WJ-Gh for qemu-devel@nongnu.org; Wed, 03 Feb 2016 11:48:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aR0bw-0003O7-Ce for qemu-devel@nongnu.org; Wed, 03 Feb 2016 11:48:57 -0500 References: <1454517196-4560-1-git-send-email-mreitz@redhat.com> <1454517196-4560-3-git-send-email-mreitz@redhat.com> From: Eric Blake Message-ID: <56B22F6E.5090308@redhat.com> Date: Wed, 3 Feb 2016 09:48:46 -0700 MIME-Version: 1.0 In-Reply-To: <1454517196-4560-3-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CwEH4q1Em0cxVQXt2jb2OUFD7orFNOlcL" Subject: Re: [Qemu-devel] [PATCH 2/2] qapi: Allow blockdev-add for NBD List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-block@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , qemu-devel@nongnu.org, Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --CwEH4q1Em0cxVQXt2jb2OUFD7orFNOlcL Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Max Reitz > --- > qapi/block-core.json | 28 ++++++++++++++++++++++++++-- > 1 file changed, 26 insertions(+), 2 deletions(-) >=20 > ## > +# @BlockdevOptionsNbd > +# > +# Driver specific block device options for NBD. Either of @host or @pa= th 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 use= d 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --CwEH4q1Em0cxVQXt2jb2OUFD7orFNOlcL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWsi9uAAoJEKeha0olJ0NqI98IAJyGHvCEAFKlgqBbdl6btlxG mlw7CiRJS1HGzZW0Nmz6lXkFYsrsHvn9p7isOSmzeVowa23ISgxE6SKdEiH+uezH kcMl7i9FT4AbF+eWXQe3RDAHb53MMWuEx/Fvx2aFRdzHi2Rzo0htAudcBWK1new/ u86P2PLKpFP+DVyPAPGmyHyT2I+oT17yUF+TOoD32lKr16D6tpMDGi2IT66HejB7 xDIdspk4WorWw3pW2UpdQNyt5LUN3wx3QwXq39U/3vwheB7atHpzt1/NohXWCfpq Vf0bLD8P4sEeuScD+2LeAjIAV1ij0MNTHIPZKZuUZwV+xao95ISDsyR9ttX44i0= =0Rk+ -----END PGP SIGNATURE----- --CwEH4q1Em0cxVQXt2jb2OUFD7orFNOlcL--