Received: from eggs.gnu.org ([2001:4830:134:3::10]:60665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO3I3-0003Qa-35 for qemu-devel@nongnu.org; Fri, 15 Jul 2016 09:36:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bO3I2-00034c-22 for qemu-devel@nongnu.org; Fri, 15 Jul 2016 09:36:27 -0400 From: Max Reitz References: <1468502894-18098-1-git-send-email-kwolf@redhat.com> <1468502894-18098-12-git-send-email-kwolf@redhat.com> <578805C8.2070904@redhat.com> Message-ID: Date: Fri, 15 Jul 2016 15:36:16 +0200 MIME-Version: 1.0 In-Reply-To: <578805C8.2070904@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="s6sVfgSF7G8gKe1eqGnMfsSJIrclitTIP" Subject: Re: [Qemu-devel] [PATCH v4 11/11] nbd-server: Allow node name for nbd-server-add List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Kevin Wolf , qemu-block@nongnu.org Cc: berto@igalia.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --s6sVfgSF7G8gKe1eqGnMfsSJIrclitTIP From: Max Reitz To: Eric Blake , Kevin Wolf , qemu-block@nongnu.org Cc: berto@igalia.com, qemu-devel@nongnu.org Message-ID: Subject: Re: [PATCH v4 11/11] nbd-server: Allow node name for nbd-server-add References: <1468502894-18098-1-git-send-email-kwolf@redhat.com> <1468502894-18098-12-git-send-email-kwolf@redhat.com> <578805C8.2070904@redhat.com> In-Reply-To: <578805C8.2070904@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 14.07.2016 23:36, Eric Blake wrote: > On 07/14/2016 07:28 AM, Kevin Wolf wrote: >> There is no reason why an NBD server couldn't be started for any node,= >> even if it's not on the top level. This converts nbd-server-add to >> accept a node-name. >> >> Note that there is a semantic difference between using a BlockBackend >> name and the node name of its root: In the former case, the NBD server= >> is closed on eject; in the latter case, the NBD server doesn't drop it= s >> reference and keeps the image file open this way. >> >> Signed-off-by: Kevin Wolf >> --- >> blockdev-nbd.c | 21 +++++++++------------ >> qapi/block.json | 4 ++-- >> 2 files changed, 11 insertions(+), 14 deletions(-) >> >> diff --git a/blockdev-nbd.c b/blockdev-nbd.c >> index c437d32..ca41cc6 100644 >> --- a/blockdev-nbd.c >> +++ b/blockdev-nbd.c >> @@ -145,7 +145,8 @@ void qmp_nbd_server_start(SocketAddress *addr, >> void qmp_nbd_server_add(const char *device, bool has_writable, bool w= ritable, >> Error **errp) >> { >> - BlockBackend *blk; >> + BlockDriverState *bs =3D NULL; >> + BlockBackend *on_eject_blk; >> NBDExport *exp; >> =20 >> if (!nbd_server) { >> @@ -158,26 +159,22 @@ void qmp_nbd_server_add(const char *device, bool= has_writable, bool writable, >> return; >=20 > Do we want to do any sanity checking that writing should only be > permitted on a root, and that when using a node name that is not a root= > that writable must be false so as not to negatively change the BDS out > of under the feet of the other root? Do op-blockers already cover that= ? Well, one could argue that it's possible to create an NBD server on a non-root node today anyway, since creating BBs is not restricted to root nodes: blockdev-add(id=3Dfoo, other arguments...) blockdev-add(id=3Dbar, backing=3Dfoo, other arguments...) And then you can create an NBD server on bar. I agree that this is not how it should be, though. However, I think that the fact that you need to specify a BB name for now deters people from doing stuff like that. If you can specify a node name, people will think it's completely fine to do so. Also note that only allowing NBD servers to be created on a root node doesn't really help you: blockdev-add(node-name=3Dfoo, ...) nbd-server-add(device=3Dfoo) blockdev-add(id=3Dbar, backing=3Dfoo, ...) So, yeah, I think we just need the new op-blockers for this, I don't think the current op blockers cover this. Max --s6sVfgSF7G8gKe1eqGnMfsSJIrclitTIP 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 iQEvBAEBCAAZBQJXiObREhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrfFP CACMrqWzlQjswQTV3OdgFtPjvXt8caeD74tDK6b4vc0obV2C6YUq6sDtplkNN5sd OYw1pj/kzS43jCag05oMGROXEIW1IQTxAZ2iV5/UH22hqm3S197U+hLZ64hnEBXk Zq7wCxQbDLYIy/Q83yb2O0ztpSmO9dPlI7KroxxcWRh8ByBDzNiy9bF+lIfFXJ+d RxXYK9ukpKMh+NaYnkwBu8eb+VeapuYdK2PUIC5f2ct78/OXhBJ/xarCK7n6Q3kk 5eJNqebzyPKFKTQs1fcDaOdaqm/6TzUCZhPsGcfoEWKdlH8GzC5dymFUdf20Xjmh DDXZO4L5dnfwIQU2bB8TaYdP =YRLw -----END PGP SIGNATURE----- --s6sVfgSF7G8gKe1eqGnMfsSJIrclitTIP--