Received: from eggs.gnu.org ([208.118.235.92]:42806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S37hp-00068D-6x for qemu-devel@nongnu.org; Thu, 01 Mar 2012 10:14:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S37hf-0002Wn-7I for qemu-devel@nongnu.org; Thu, 01 Mar 2012 10:14:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S37he-0002Vk-V8 for qemu-devel@nongnu.org; Thu, 01 Mar 2012 10:13:59 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q21FDuWc007403 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 1 Mar 2012 10:13:56 -0500 From: Federico Simoncelli Date: Thu, 1 Mar 2012 15:13:39 +0000 Message-Id: <1330614819-26929-1-git-send-email-fsimonce@redhat.com> Subject: [Qemu-devel] [PATCH] add reopen to blockdev-transaction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, Federico Simoncelli , eblake@redhat.com Signed-off-by: Federico Simoncelli --- blockdev.c | 8 ++++++++ qapi-schema.json | 12 ++++++++++++ qmp-commands.hx | 6 +++++- 3 files changed, 25 insertions(+), 1 deletions(-) diff --git a/blockdev.c b/blockdev.c index 56da5c9..36fe07c 100644 --- a/blockdev.c +++ b/blockdev.c @@ -798,6 +798,14 @@ void qmp_blockdev_transaction(BlockdevActionList *dev_list, dev_info->mirror->target); break; + case BLOCKDEV_ACTION_KIND_REOPEN: + device = dev_info->reopen->device; + if (dev_info->format->has_format) { + format = dev_info->reopen->format; + } + new_source = g_strdup(dev_info->reopen->target); + break; + default: abort(); } diff --git a/qapi-schema.json b/qapi-schema.json index b33875d..17f7548 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1145,6 +1145,17 @@ { 'type': 'BlockdevMirror', 'data': { 'device': 'str', 'target': 'str', '*format': 'str', '*reuse': 'bool' } } +## +# @BlockdevReopen +# +# @device: the name of the device to reopen. +# +# @target: the target of the new image. +# +# @format: #optional the format of the new image, default is 'qcow2'. +## +{ 'type': 'BlockdevReopen', + 'data': { 'device': 'str', 'target': 'str', '*format': 'str' } } ## # @BlockdevAction @@ -1156,6 +1167,7 @@ 'data': { 'snapshot': 'BlockdevSnapshot', 'mirror': 'BlockdevMirror', + 'reopen': 'BlockdevReopen', } } ## diff --git a/qmp-commands.hx b/qmp-commands.hx index 50ac5a0..317c448 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -720,7 +720,7 @@ Arguments: actions array: - "type": the operation to perform. The only supported - values are "snapshot" and "mirror". (json-string) + values are "snapshot", "mirror" and "reopen". (json-string) - "data": a dictionary. The contents depend on the value of "type". When "type" is "snapshot": - "device": device name to snapshot (json-string) @@ -734,6 +734,10 @@ actions array: - "format": format of new image (json-string, optional) - "reuse": whether QEMU should look for an existing image file (json-bool, optional, default false) + When "type" is "reopen": + - "device": device name to reopen (json-string) + - "target": name of destination image file (json-string) + - "format": format of new image (json-string, optional) Example: -- 1.7.1