From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR12o-0001rf-Ug for qemu-devel@nongnu.org; Wed, 03 Feb 2016 12:16:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aR12o-0001yP-01 for qemu-devel@nongnu.org; Wed, 03 Feb 2016 12:16:42 -0500 References: <1454517196-4560-1-git-send-email-mreitz@redhat.com> <1454517196-4560-3-git-send-email-mreitz@redhat.com> <20160203170609.GR30222@redhat.com> From: Max Reitz Message-ID: <56B235F2.1050005@redhat.com> Date: Wed, 3 Feb 2016 18:16:34 +0100 MIME-Version: 1.0 In-Reply-To: <20160203170609.GR30222@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9PxtToD0uTAbV9VGHfP730o8PregqTC4D" 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: "Daniel P. Berrange" Cc: Kevin Wolf , Paolo Bonzini , qemu-devel@nongnu.org, qemu-block@nongnu.org, Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --9PxtToD0uTAbV9VGHfP730o8PregqTC4D Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03.02.2016 18:06, Daniel P. Berrange wrote: > On Wed, Feb 03, 2016 at 05:33:16PM +0100, 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 >=20 > With my patch series that converts NBD to use QIOChannel, all the > entry points for client & server *do* take a SocketAddress struct > to provide address info. So internally the code does in fact allow > use of an FD, if there were a way to specify it a the QAPI level... >=20 > eg see >=20 > https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg04159.html >=20 >> - 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 option= s >> (like choosing between ipv4 and ipv6) which NBD does not support. >=20 > The *should* support ipv4 and ipv6 options for NBD. We should also make= > the port optional in the SocketAddress struct - I tried to do that prev= iously > but my patch was flawed, but we should revisit this. >=20 > So IMHO all the things you list above are reasons *for* using SocketAdd= ress > and not re-inventing it poorly with explicit host + port fields. That's good news, thanks! However, the issue remains that the NBD block driver expects flattened options which is syntactically incompatible to SocketAddress. Maybe the best way to address this would be to just make block/nbd.c directly accept a SocketAddress and keep the old flattened @host, @port, and @path options only as a legacy mapping to inet.host, inet.port, and unix.path. Anyway, I'll wait for your series to get merged, then. Max --9PxtToD0uTAbV9VGHfP730o8PregqTC4D 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 iQEcBAEBCAAGBQJWsjXyAAoJEDuxQgLoOKytEvkH/0kM3pexT2r/uioqOv9YcHUy HSXQ44Jv0koo+KNt+hOw/1X3wqjErohfWznSw2mas1tbuCNhTGY2oxmfK4h8whan TklqqeEf46XyQ9SH0Klyx4v0/nXkBTbrSv2eH+XICAq/ivgw3R1xWvQpwUpaPaFZ VMbB98xmsIGq8BBlJJxuEnlo/rxnFLstZe3Ue8B3U3wmIrV29kvIyWaKc8zSTJIT FMErgTKD6aWa6H2yoj25HrTESbrQ3kUgUUIb2rQXloY5tMSCJZz8eEQujSDbWATq RzkDCmVjLJ13cGahx0lDDqV4OFtCh1e52YrxijRcQw6MNpDgEnp7fQ1hJivlI48= =IFZ9 -----END PGP SIGNATURE----- --9PxtToD0uTAbV9VGHfP730o8PregqTC4D--