From: Max Reitz <mreitz@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Jeff Cody <jcody@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 4/5] qmp: Add blockdev-mirror command
Date: Thu, 24 Dec 2015 01:53:27 +0100 [thread overview]
Message-ID: <567B4207.8030300@redhat.com> (raw)
In-Reply-To: <1450850347-5291-5-git-send-email-famz@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3704 bytes --]
On 23.12.2015 06:59, Fam Zheng wrote:
> This will start a mirror job from a named device to another named
> device, its relation with drive-mirror is similar with blockdev-backup
> to drive-backup.
>
> In blockdev-mirror, the target node should be prepared by blockdev-add,
> which will be responsible for assigning a name to the new node, so
> we don't have 'node-name' parameter.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
> blockdev.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> qapi/block-core.json | 47 +++++++++++++++++++++++++++++++++++++++
> qmp-commands.hx | 48 ++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 157 insertions(+)
It appears you haven't addressed the comments for v2. I only had a
single one (regarding documentation), but Markus had a couple ones, so
those may be worth addressing.
>
> diff --git a/blockdev.c b/blockdev.c
> index f42e171..2df0c6d 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -3345,6 +3345,10 @@ static void blockdev_mirror_common(BlockDriverState *bs,
> if (bdrv_op_is_blocked(target, BLOCK_OP_TYPE_MIRROR_TARGET, errp)) {
> return;
> }
> + if (target->blk) {
> + error_setg(errp, "Cannot mirror to an attached block device");
> + return;
> + }
>
> if (!bs->backing && sync == MIRROR_SYNC_MODE_TOP) {
> sync = MIRROR_SYNC_MODE_FULL;
> @@ -3518,6 +3522,64 @@ out:
> aio_context_release(aio_context);
> }
>
> +void qmp_blockdev_mirror(const char *device, const char *target,
> + bool has_replaces, const char *replaces,
> + MirrorSyncMode sync,
> + bool has_speed, int64_t speed,
> + bool has_granularity, uint32_t granularity,
> + bool has_buf_size, int64_t buf_size,
> + bool has_on_source_error,
> + BlockdevOnError on_source_error,
> + bool has_on_target_error,
> + BlockdevOnError on_target_error,
> + Error **errp)
> +{
> + BlockDriverState *bs;
> + BlockBackend *blk;
> + BlockDriverState *target_bs;
> + AioContext *aio_context;
> + Error *local_err = NULL;
> +
> + blk = blk_by_name(device);
> + if (!blk) {
> + error_setg(errp, "Device '%s' not found", device);
> + return;
> + }
> + bs = blk_bs(blk);
> +
> + if (!bs) {
> + error_setg(errp, "Device '%s' has no media", device);
> + return;
> + }
> +
> + target_bs = bdrv_lookup_bs(target, target, errp);
> + if (!target_bs) {
> + return;
> + }
> +
> + aio_context = bdrv_get_aio_context(bs);
> + aio_context_acquire(aio_context);
> +
> + bdrv_ref(target_bs);
> + bdrv_set_aio_context(target_bs, aio_context);
> +
> + blockdev_mirror_common(bs, target_bs,
> + has_replaces, replaces, sync,
> + has_speed, speed,
> + has_granularity, granularity,
> + has_buf_size, buf_size,
> + has_on_source_error, on_source_error,
> + has_on_target_error, on_target_error,
> + true, true,
Shouldn't this be "false, false,", or, ideally, set by the user?
> + &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + bdrv_unref(target_bs);
> + }
> +
> + aio_context_release(aio_context);
> +}
> +
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2015-12-24 0:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-23 5:59 [Qemu-devel] [PATCH v3 0/5] qmp: Add blockdev-mirror Fam Zheng
2015-12-23 5:59 ` [Qemu-devel] [PATCH v3 1/5] block: Rename BLOCK_OP_TYPE_MIRROR to BLOCK_OP_TYPE_MIRROR_SOURCE Fam Zheng
2015-12-23 5:59 ` [Qemu-devel] [PATCH v3 2/5] block: Extract blockdev part of qmp_drive_mirror Fam Zheng
2015-12-24 0:44 ` Max Reitz
2015-12-23 5:59 ` [Qemu-devel] [PATCH v3 3/5] block: Add check on mirror target Fam Zheng
2015-12-23 5:59 ` [Qemu-devel] [PATCH v3 4/5] qmp: Add blockdev-mirror command Fam Zheng
2015-12-24 0:53 ` Max Reitz [this message]
2015-12-24 3:25 ` Fam Zheng
2016-01-04 19:58 ` Max Reitz
2015-12-23 5:59 ` [Qemu-devel] [PATCH v3 5/5] iotests: Add test cases for blockdev-mirror Fam Zheng
2015-12-24 1:06 ` Max Reitz
2015-12-24 0:26 ` [Qemu-devel] [PATCH v3 0/5] qmp: Add blockdev-mirror Max Reitz
2015-12-24 3:14 ` Fam Zheng
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=567B4207.8030300@redhat.com \
--to=mreitz@redhat.com \
--cc=armbru@redhat.com \
--cc=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.