From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UouAK-0001r9-9G for qemu-devel@nongnu.org; Tue, 18 Jun 2013 07:33:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UouAH-00072h-5z for qemu-devel@nongnu.org; Tue, 18 Jun 2013 07:33:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UouAG-00072a-UI for qemu-devel@nongnu.org; Tue, 18 Jun 2013 07:33:33 -0400 Date: Tue, 18 Jun 2013 13:33:29 +0200 From: Stefan Hajnoczi Message-ID: <20130618113329.GH7649@stefanha-thinkpad.redhat.com> References: <1371451486-28929-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1371451486-28929-1-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH] qmp: add 'drive' to enum NewImageMode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-devel@nongnu.org, Ian Main , Paolo Bonzini , dietmar@proxmox.com On Mon, Jun 17, 2013 at 02:44:46PM +0800, Fam Zheng wrote: > Introduce a "drive" option to new image mode. With this mode, QMP command > should (this patch only modified drive-backup to support it, and report invalid > parameter error for drive-mirror) skip creating the image file or trying to > open it, it should just reuse the existing BDS by looking for the named drive > with bdrv_find(). It will be useful to utilize "none" sync mode of drive-backup > for point-in-time snapshot. > > The example with drive-backup is: > > -> { "execute": "drive-backup", "arguments": { "device": "ide0-hd0", > "mode": "drive", > "target": "drive_id_here" } } > <- { "return": {} } > > > Target bs is not released when block job completes in this case since it's > still used as a device drive or exported by nbd server. > > Signed-off-by: Fam Zheng > --- > block/backup.c | 9 ++++++-- > blockdev.c | 57 ++++++++++++++++++++++++++++++++--------------- > include/block/block_int.h | 3 ++- > qapi-schema.json | 4 +++- > 4 files changed, 51 insertions(+), 22 deletions(-) Fam and I chatted about this yesterday. The QMP API change here is that traditionally 'target' and 'mode' always referred to existing filenames. Now you can set 'mode': 'drive' and then 'target' becomes a QEMU block device name. I think this API extension is reasonable but I think we haven't nailed down the lifecycle of the snapshot block drive yet... Stefan