From: Max Reitz <mreitz@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 5/6] block: Add QMP support for streaming to an intermediate layer
Date: Wed, 15 Apr 2015 18:17:26 +0200 [thread overview]
Message-ID: <552E8F16.2000406@redhat.com> (raw)
In-Reply-To: <49410048030019e82e55fc6e6f5bd0dd793b9908.1428503789.git.berto@igalia.com>
On 08.04.2015 16:43, Alberto Garcia wrote:
> This patch makes the 'device' paramater of the 'block-stream' command
> allow a node name as well as a device name.
s/allow/accept/
> In addition to that, operation blockers will be checked in all
> intermediate nodes between the top and the base node.
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> blockdev.c | 20 ++++++++++----------
> qapi/block-core.json | 10 +++++++---
> 2 files changed, 17 insertions(+), 13 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index dc5d931..f24cf2d 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -2104,8 +2104,7 @@ void qmp_block_stream(const char *device,
> bool has_on_error, BlockdevOnError on_error,
> Error **errp)
> {
> - BlockBackend *blk;
> - BlockDriverState *bs;
> + BlockDriverState *bs, *i;
Hmmmm... ;-)
Looks good otherwise.
Max
> BlockDriverState *base_bs = NULL;
> AioContext *aio_context;
> Error *local_err = NULL;
> @@ -2115,20 +2114,14 @@ void qmp_block_stream(const char *device,
> on_error = BLOCKDEV_ON_ERROR_REPORT;
> }
>
> - blk = blk_by_name(device);
> - if (!blk) {
> - error_set(errp, QERR_DEVICE_NOT_FOUND, device);
> + bs = bdrv_lookup_bs(device, device, errp);
> + if (!bs) {
> return;
> }
> - bs = blk_bs(blk);
>
> aio_context = bdrv_get_aio_context(bs);
> aio_context_acquire(aio_context);
>
> - if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_STREAM, errp)) {
> - goto out;
> - }
> -
> if (has_base) {
> base_bs = bdrv_find_backing_image(bs, base);
> if (base_bs == NULL) {
> @@ -2139,6 +2132,13 @@ void qmp_block_stream(const char *device,
> base_name = base;
> }
>
> + /* Check for op blockers in the whole chain between bs and base */
> + for (i = bs; i != NULL && i != base_bs; i = i->backing_hd) {
> + if (bdrv_op_is_blocked(i, BLOCK_OP_TYPE_STREAM, errp)) {
> + goto out;
> + }
> + }
> +
> /* if we are streaming the entire chain, the result will have no backing
> * file, and specifying one is therefore an error */
> if (base_bs == NULL && has_backing_file) {
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 3639454..60b9664 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -1014,6 +1014,10 @@
> # with query-block-jobs. The operation can be stopped before it has completed
> # using the block-job-cancel command.
> #
> +# The node that receives the data is called the top image, can be located
> +# in any part of the whole chain and can be specified using its device
> +# or node name.
> +#
> # If a base file is specified then sectors are not copied from that base file and
> # its backing chain. When streaming completes the image file will have the base
> # file as its backing file. This can be used to stream a subset of the backing
> @@ -1022,12 +1026,12 @@
> # On successful completion the image file is updated to drop the backing file
> # and the BLOCK_JOB_COMPLETED event is emitted.
> #
> -# @device: the device name
> +# @device: the device or node name of the top image
> #
> # @base: #optional the common backing file name
> #
> -# @backing-file: #optional The backing file string to write into the active
> -# layer. This filename is not validated.
> +# @backing-file: #optional The backing file string to write into the top
> +# image. This filename is not validated.
> #
> # If a pathname string is such that it cannot be
> # resolved by QEMU, that means that subsequent QMP or
next prev parent reply other threads:[~2015-04-15 16:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 14:43 [Qemu-devel] [PATCH v3 0/6] Support streaming to an intermediate layer Alberto Garcia
2015-04-08 14:43 ` [Qemu-devel] [PATCH 1/6] block: keep a list of block jobs Alberto Garcia
2015-04-15 14:29 ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-04-08 14:43 ` [Qemu-devel] [PATCH 2/6] block: allow block jobs in any arbitrary node Alberto Garcia
2015-04-15 15:22 ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-04-16 8:20 ` Alberto Garcia
2015-04-08 14:43 ` [Qemu-devel] [PATCH 3/6] block: never cancel a streaming job without running stream_complete() Alberto Garcia
2015-04-15 15:29 ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-04-08 14:43 ` [Qemu-devel] [PATCH 4/6] block: Support streaming to an intermediate layer Alberto Garcia
2015-04-15 16:09 ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-04-16 9:36 ` Alberto Garcia
2015-04-16 12:27 ` Eric Blake
2015-04-16 12:34 ` Alberto Garcia
2015-04-17 8:02 ` Kevin Wolf
2015-04-16 14:30 ` Alberto Garcia
2015-04-17 12:46 ` Max Reitz
2015-04-08 14:43 ` [Qemu-devel] [PATCH 5/6] block: Add QMP support for " Alberto Garcia
2015-04-15 16:17 ` Max Reitz [this message]
2015-04-08 14:43 ` [Qemu-devel] [PATCH 6/6] docs: Document how to stream " Alberto Garcia
2015-04-15 16:25 ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-04-15 16:27 ` [Qemu-devel] [Qemu-block] [PATCH v3 0/6] Support streaming " Max Reitz
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=552E8F16.2000406@redhat.com \
--to=mreitz@redhat.com \
--cc=berto@igalia.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).