From: Kevin Wolf <kwolf@redhat.com>
To: Alberto Garcia <berto@igalia.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>, Eric Blake <eblake@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v9 07/11] block: Add QMP support for streaming to an intermediate layer
Date: Fri, 29 Apr 2016 17:11:07 +0200 [thread overview]
Message-ID: <20160429151107.GL4350@noname.redhat.com> (raw)
In-Reply-To: <e6fa1fe465be9051316b29668c0a255341b6b1f1.1459776815.git.berto@igalia.com>
Am 04.04.2016 um 15:43 hat Alberto Garcia geschrieben:
> This patch makes the 'device' parameter of the 'block-stream' command
> accept a node name as well as a device name.
>
> In addition to that, operation blockers will be checked in all
> intermediate nodes between the top and the base node.
>
> Since qmp_block_stream() now uses the error from bdrv_lookup_bs() and
> no longer returns DeviceNotFound, iotest 030 is updated to expect
> GenericError instead.
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> blockdev.c | 31 +++++++++++++++++++++++--------
> qapi/block-core.json | 10 +++++++---
> tests/qemu-iotests/030 | 2 +-
> 3 files changed, 31 insertions(+), 12 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index 2e7712e..bfdc0e3 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -2989,6 +2989,7 @@ void qmp_block_stream(const char *device,
> BlockBackend *blk;
> BlockDriverState *bs;
> BlockDriverState *base_bs = NULL;
> + BlockDriverState *active;
> AioContext *aio_context;
> Error *local_err = NULL;
> const char *base_name = NULL;
> @@ -2997,21 +2998,19 @@ void qmp_block_stream(const char *device,
> on_error = BLOCKDEV_ON_ERROR_REPORT;
> }
>
> - blk = blk_by_name(device);
> - if (!blk) {
> - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
> - "Device '%s' not found", device);
> + bs = bdrv_lookup_bs(device, device, errp);
> + if (!bs) {
> return;
> }
>
> - aio_context = blk_get_aio_context(blk);
> + aio_context = bdrv_get_aio_context(bs);
> aio_context_acquire(aio_context);
>
> - if (!blk_is_available(blk)) {
> + blk = blk_by_name(device);
> + if (blk && !blk_is_available(blk)) {
> error_setg(errp, "Device '%s' has no medium", device);
> goto out;
> }
> - bs = blk_bs(blk);
>
> if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_STREAM, errp)) {
> goto out;
> @@ -3027,6 +3026,22 @@ void qmp_block_stream(const char *device,
> base_name = base;
> }
>
> + /* Look for the top-level node that contains 'bs' in its chain */
> + active = NULL;
> + do {
> + active = bdrv_next(active);
> + } while (active && !bdrv_chain_contains(active, bs));
> +
> + if (active == NULL) {
> + error_setg(errp, "Cannot find top level node for '%s'", device);
> + goto out;
> + }
Hm... On the one hand, I really like that you don't expect the user to
provide the active layer in QMP. This allows us to remove this wart once
we have the new op blockers.
On the other hand, this code assumes that there is only a single
top-level node. This isn't necessarily true any more these days. Do we
need to set blockers on _all_ root nodes that have the node in their
backing chain?
Kevin
next prev parent reply other threads:[~2016-04-29 15:12 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-04 13:43 [Qemu-devel] [PATCH for-2.7 v9 00/11] Support streaming to an intermediate layer Alberto Garcia
2016-04-04 13:43 ` [Qemu-devel] [PATCH v9 01/11] block: keep a list of block jobs Alberto Garcia
2016-04-27 11:59 ` Max Reitz
2016-04-29 14:22 ` Kevin Wolf
2016-04-04 13:43 ` [Qemu-devel] [PATCH v9 02/11] block: use the block job list in bdrv_drain_all() Alberto Garcia
2016-04-27 12:04 ` Max Reitz
2016-04-27 12:08 ` Alberto Garcia
2016-04-29 14:25 ` Kevin Wolf
2016-04-04 13:43 ` [Qemu-devel] [PATCH v9 03/11] block: use the block job list in qmp_query_block_jobs() Alberto Garcia
2016-04-27 12:09 ` Max Reitz
2016-04-29 14:32 ` Kevin Wolf
2016-05-02 13:06 ` Alberto Garcia
2016-04-04 13:43 ` [Qemu-devel] [PATCH v9 04/11] block: use the block job list in bdrv_close() Alberto Garcia
2016-04-27 12:14 ` Max Reitz
2016-04-29 14:38 ` Kevin Wolf
2016-05-02 13:42 ` Alberto Garcia
2016-04-04 13:43 ` [Qemu-devel] [PATCH v9 05/11] block: allow block jobs in any arbitrary node Alberto Garcia
2016-04-27 12:30 ` Max Reitz
2016-04-27 14:59 ` Alberto Garcia
2016-04-29 15:00 ` Kevin Wolf
2016-05-06 10:00 ` Alberto Garcia
2016-05-06 17:54 ` John Snow
2016-05-09 7:06 ` Kevin Wolf
2016-05-09 11:59 ` Alberto Garcia
2016-04-29 15:25 ` Eric Blake
2016-04-04 13:43 ` [Qemu-devel] [PATCH v9 06/11] block: Support streaming to an intermediate layer Alberto Garcia
2016-04-27 13:04 ` Max Reitz
2016-04-28 9:23 ` Alberto Garcia
2016-04-29 15:07 ` Kevin Wolf
2016-04-04 13:43 ` [Qemu-devel] [PATCH v9 07/11] block: Add QMP support for " Alberto Garcia
2016-04-27 13:34 ` Max Reitz
2016-04-28 12:20 ` Alberto Garcia
2016-04-29 15:18 ` Kevin Wolf
2016-05-03 12:50 ` Alberto Garcia
2016-05-03 13:23 ` Kevin Wolf
2016-05-03 13:33 ` Alberto Garcia
2016-05-03 13:48 ` Kevin Wolf
2016-05-03 15:09 ` Alberto Garcia
[not found] ` <w517fezo0al.fsf@maestria.local.igalia.com>
2016-05-12 15:04 ` Kevin Wolf
[not found] ` <w514ma3nwbl.fsf@maestria.local.igalia.com>
2016-05-12 15:28 ` Kevin Wolf
2016-05-17 14:26 ` Alberto Garcia
2016-05-17 14:47 ` Kevin Wolf
2016-05-17 14:54 ` Alberto Garcia
2016-04-29 15:11 ` Kevin Wolf [this message]
2016-05-03 12:53 ` Alberto Garcia
2016-05-03 13:18 ` Kevin Wolf
2016-05-03 13:29 ` Alberto Garcia
2016-04-29 15:29 ` Eric Blake
2016-04-04 13:43 ` [Qemu-devel] [PATCH v9 08/11] docs: Document how to stream " Alberto Garcia
2016-04-04 13:43 ` [Qemu-devel] [PATCH v9 09/11] qemu-iotests: test streaming " Alberto Garcia
2016-04-04 13:44 ` [Qemu-devel] [PATCH v9 10/11] qemu-iotests: test overlapping block-stream operations Alberto Garcia
2016-04-27 13:48 ` Max Reitz
2016-04-27 15:02 ` Alberto Garcia
2016-04-04 13:44 ` [Qemu-devel] [PATCH v9 11/11] qemu-iotests: test non-overlapping " Alberto Garcia
2016-04-27 13:50 ` Max Reitz
2016-04-08 10:00 ` [Qemu-devel] [PATCH for-2.7 v9 00/11] Support streaming to an intermediate layer Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160429151107.GL4350@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=berto@igalia.com \
--cc=eblake@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).