From patchwork Mon Jan 7 07:28:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Xia X-Patchwork-Id: 209872 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A9CE12C007E for ; Mon, 7 Jan 2013 18:43:22 +1100 (EST) Received: from localhost ([::1]:36729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ts7Ay-0005oo-RI for incoming@patchwork.ozlabs.org; Mon, 07 Jan 2013 02:31:16 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ts7AS-0004sP-Ij for qemu-devel@nongnu.org; Mon, 07 Jan 2013 02:30:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ts7AR-0005aG-1e for qemu-devel@nongnu.org; Mon, 07 Jan 2013 02:30:44 -0500 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:49597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ts7AQ-0005a8-Fr for qemu-devel@nongnu.org; Mon, 07 Jan 2013 02:30:42 -0500 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 7 Jan 2013 17:27:00 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 7 Jan 2013 17:26:58 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 12D202CE804C for ; Mon, 7 Jan 2013 18:30:37 +1100 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r077Uafo60686566 for ; Mon, 7 Jan 2013 18:30:36 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r077UapU023787 for ; Mon, 7 Jan 2013 18:30:36 +1100 Received: from RH63Wenchao (wenchaox.cn.ibm.com [9.115.122.237]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r077Rp6e018491; Mon, 7 Jan 2013 18:30:34 +1100 From: Wenchao Xia To: qemu-devel@nongnu.org Date: Mon, 7 Jan 2013 15:28:08 +0800 Message-Id: <1357543689-11415-11-git-send-email-xiawenc@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1357543689-11415-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1357543689-11415-1-git-send-email-xiawenc@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13010707-7014-0000-0000-0000026CDCE5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 202.81.31.148 Cc: kwolf@redhat.com, aliguori@us.ibm.com, quintela@redhat.com, stefanha@gmail.com, Wenchao Xia , lcapitulino@redhat.com, pbonzini@redhat.com, dietmar@proxmox.com Subject: [Qemu-devel] [PATCH V2 09/10] snapshot: qmp add blockdev-snapshot-internal-sync interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This interface allow user to create internal snapshot on a single block device. Signed-off-by: Wenchao Xia --- blockdev.c | 14 ++++++++++++++ qapi-schema.json | 21 ++++++++++++++++++++- qmp-commands.hx | 28 ++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletions(-) diff --git a/blockdev.c b/blockdev.c index 09eeb7f..b2e6b3d 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1173,6 +1173,20 @@ void qmp_blockdev_snapshot_sync(const char *device, const char *snapshot_file, errp); } +void qmp_blockdev_snapshot_internal_sync(const char *device, + bool has_name, const char *name, + Error **errp) +{ + BlockdevSnapshotInternal snapshot = { + .device = (char *) device, + .has_name = has_name, + .name = (char *) name, + }; + blockdev_do_action(BLOCKDEV_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC, + &snapshot, + errp); +} + /* translation from qmp commands */ static int fill_blk_trs_ext_create_sync(BlockdevSnapshot *create_sync, BlkTransStatesSync *st_sync, diff --git a/qapi-schema.json b/qapi-schema.json index ea3ef77..459850a 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1555,7 +1555,7 @@ ## # @blockdev-snapshot-sync # -# Generates a synchronous snapshot of a block device. +# Generates a synchronous external snapshot of a block device. # # @device: the name of the device to generate the snapshot from. # @@ -1578,6 +1578,25 @@ '*mode': 'NewImageMode'} } ## +# @blockdev-snapshot-internal-sync +# +# Generates a synchronous internal snapshot of a block device. +# +# @device: the name of the device to generate the snapshot from. +# +# @name: #optional the name of snapshot to be created. If not specified, a name +# would be generated according to host time. If an internal snapshot with +# name exist, it will be overwritten. +# +# Returns: nothing on success +# If @device is not a valid block device, DeviceNotFound +# +# Since 1.4 +## +{ 'command': 'blockdev-snapshot-internal-sync', + 'data': { 'device': 'str', '*name': 'str'} } + +## # @human-monitor-command: # # Execute a command on the human monitor and return the output. diff --git a/qmp-commands.hx b/qmp-commands.hx index 3c2f468..499e64e 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -946,6 +946,34 @@ Example: EQMP { + .name = "blockdev-snapshot-internal-sync", + .args_type = "device:B,name:s?", + .mhandler.cmd_new = qmp_marshal_input_blockdev_snapshot_internal_sync, + }, + +SQMP +blockdev-snapshot-internal-sync +---------------------- + +Synchronous snapshot of a block device. name specifies the internal snapshot +name. If it is not specified, a name would be generated according to host time. +If a snapshot with that name already exist, it will be overwritten. + +Arguments: + +- "device": device name to snapshot (json-string) +- "name": name of internal snapshot (json-string, optional) + +Example: + +-> { "execute": "blockdev-snapshot-internal-sync", "arguments": { + "device": "ide-hd0", + "name": "snapshot1" } } +<- { "return": {} } + +EQMP + + { .name = "drive-mirror", .args_type = "sync:s,device:B,target:s,speed:i?,mode:s?,format:s?," "on-source-error:s?,on-target-error:s?",