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 <kw...@redhat.com> > --- > 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