From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHD4p-0005mY-CO for qemu-devel@nongnu.org; Mon, 20 Jul 2015 11:34:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHD4o-00021k-KF for qemu-devel@nongnu.org; Mon, 20 Jul 2015 11:33:59 -0400 References: <1435202570-12360-1-git-send-email-famz@redhat.com> <1435202570-12360-6-git-send-email-famz@redhat.com> From: Max Reitz Message-ID: <55AD14DA.7040004@redhat.com> Date: Mon, 20 Jul 2015 17:33:46 +0200 MIME-Version: 1.0 In-Reply-To: <1435202570-12360-6-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 5/6] qmp: Add blockdev-mirror command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, Jeff Cody , Markus Armbruster , Stefan Hajnoczi , pbonzini@redhat.com On 25.06.2015 05:22, 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 > 'node-name' in drive-mirror is dropped. > > Signed-off-by: Fam Zheng > --- > blockdev.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > qapi/block-core.json | 47 ++++++++++++++++++++++++++++++++++++++++ > qmp-commands.hx | 48 +++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 156 insertions(+) > > diff --git a/blockdev.c b/blockdev.c > index de6383f..e0dba07 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -2932,6 +2932,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; > + } 1) Why? 2) I think this should be noted in the QMP interface documentation. "the name of the device to mirror to" sounds like it is actually meant to be an attached block device. Max