Received: from eggs.gnu.org ([2001:4830:134:3::10]:53039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bL8tg-00040R-Pu for qemu-devel@nongnu.org; Thu, 07 Jul 2016 08:59:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bL8tg-000863-12 for qemu-devel@nongnu.org; Thu, 07 Jul 2016 08:59:16 -0400 From: Alberto Garcia In-Reply-To: <1467893497-2434-2-git-send-email-kwolf@redhat.com> References: <1467893497-2434-1-git-send-email-kwolf@redhat.com> <1467893497-2434-2-git-send-email-kwolf@redhat.com> Date: Thu, 07 Jul 2016 14:59:07 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v3 01/11] block: Accept node-name for block-stream List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, mreitz@redhat.com On Thu 07 Jul 2016 02:11:27 PM CEST, Kevin Wolf wrote: > In order to remove the necessity to use BlockBackend names in the > external API, we want to allow node-names everywhere. This converts > block-stream to accept a node-name without lifting the restriction that > we're operating at a root node. > > In case of an invalid device name, the command returns the GenericError > error class now instead of DeviceNotFound, because this is what > qmp_get_root_bs() returns. > > Signed-off-by: Kevin Wolf > --- > blockdev.c | 32 ++++++++++++++++++++------------ > qapi/block-core.json | 5 +---- > qmp-commands.hx | 2 +- > tests/qemu-iotests/030 | 2 +- > 4 files changed, 23 insertions(+), 18 deletions(-) > > diff --git a/blockdev.c b/blockdev.c > index 0f8065c..01e57c9 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -1172,6 +1172,23 @@ fail: > return dinfo; > } > > +static BlockDriverState *qmp_get_root_bs(const char *name, Error **errp) > +{ > + BlockDriverState *bs; > + > + bs = bdrv_lookup_bs(name, name, errp); > + if (bs == NULL) { > + return NULL; > + } > + > + if (!bdrv_has_blk(bs)) { > + error_setg(errp, "Need a root block node"); > + return NULL; > + } Since b6d2e59995f when you create a block job a new BlockBackend is created on top of the BDS. What happens with this check if we allow creating jobs in a non-root BDS? Berto