From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwFgU-0001rw-F5 for qemu-devel@nongnu.org; Tue, 31 Jul 2012 12:52:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SwFgR-0004Mn-Ml for qemu-devel@nongnu.org; Tue, 31 Jul 2012 12:52:38 -0400 Received: from mail-yx0-f173.google.com ([209.85.213.173]:51739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwFgR-0004IN-IM for qemu-devel@nongnu.org; Tue, 31 Jul 2012 12:52:35 -0400 Received: by mail-yx0-f173.google.com with SMTP id l1so6109195yen.4 for ; Tue, 31 Jul 2012 09:52:35 -0700 (PDT) Sender: Dong Xu Wang From: Dong Xu Wang Date: Wed, 1 Aug 2012 00:51:49 +0800 Message-Id: <1343753510-24661-5-git-send-email-wdongxu@linux.vnet.ibm.com> In-Reply-To: <1343753510-24661-1-git-send-email-wdongxu@linux.vnet.ibm.com> References: <1343753510-24661-1-git-send-email-wdongxu@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 5/6 v11] add-cow: hmp and qmp interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, Dong Xu Wang add HMP and QMP support for add-cow format. Because add-cow does not work like other image formats, it will use image-file, so we need add add-cow support while doing snapshot. Signed-off-by: Dong Xu Wang --- hmp-commands.hx | 8 ++++++-- hmp.c | 5 ++++- qapi-schema.json | 5 +++-- qmp-commands.hx | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index eea8b32..bd14690 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -908,14 +908,18 @@ ETEXI { .name = "snapshot_blkdev", - .args_type = "reuse:-n,device:B,snapshot-file:s?,format:s?", - .params = "[-n] device [new-image-file] [format]", + .args_type = "reuse:-n,device:B,snapshot-file:s?,format:s?,image-file:s?,image-format:s?", + .params = "[-n] device [new-image-file] [format] [image-file] [image-format]", .help = "initiates a live snapshot\n\t\t\t" "of device. If a new image file is specified, the\n\t\t\t" "new image file will become the new root image.\n\t\t\t" "If format is specified, the snapshot file will\n\t\t\t" "be created in that format. Otherwise the\n\t\t\t" "snapshot will be internal! (currently unsupported).\n\t\t\t" + "If image file is specified, the snapshot file will\n\t\t\t" + "be created using image_file option.\n\t\t\t" + "If image-format is specified, the image file will\n\t\t\t" + "be created in that format. Otherwise will use raw format.\n\t\t\t" "The default format is qcow2. The -n flag requests QEMU\n\t\t\t" "to reuse the image found in new-image-file, instead of\n\t\t\t" "recreating it from scratch.", diff --git a/hmp.c b/hmp.c index 6b72a64..4c7026c 100644 --- a/hmp.c +++ b/hmp.c @@ -701,6 +701,8 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict) const char *filename = qdict_get_try_str(qdict, "snapshot-file"); const char *format = qdict_get_try_str(qdict, "format"); int reuse = qdict_get_try_bool(qdict, "reuse", 0); + const char *image_filename = qdict_get_try_str(qdict, "image-file"); + const char *image_format = qdict_get_try_str(qdict, "image-format"); enum NewImageMode mode; Error *errp = NULL; @@ -714,7 +716,8 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict) mode = reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PATHS; qmp_blockdev_snapshot_sync(device, filename, !!format, format, - true, mode, &errp); + true, mode, !!image_filename, image_filename, + !!image_format, image_format, &errp); hmp_handle_error(mon, &errp); } diff --git a/qapi-schema.json b/qapi-schema.json index bc55ed2..c90fe0d 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1204,7 +1204,7 @@ ## { 'type': 'BlockdevSnapshot', 'data': { 'device': 'str', 'snapshot-file': 'str', '*format': 'str', - '*mode': 'NewImageMode' } } + '*mode': 'NewImageMode', '*image_file': 'str', '*image_format': 'str' } } ## # @BlockdevAction @@ -1269,7 +1269,8 @@ ## { 'command': 'blockdev-snapshot-sync', 'data': { 'device': 'str', 'snapshot-file': 'str', '*format': 'str', - '*mode': 'NewImageMode'} } + '*mode': 'NewImageMode', '*image-file': 'str', + '*image-format': 'str'} } ## # @human-monitor-command: diff --git a/qmp-commands.hx b/qmp-commands.hx index e3cf3c5..fc776a5 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -789,7 +789,7 @@ EQMP { .name = "blockdev-snapshot-sync", - .args_type = "device:B,snapshot-file:s,format:s?,mode:s?", + .args_type = "device:B,snapshot-file:s,format:s?,mode:s?,image-file:s?,image-format:s?", .mhandler.cmd_new = qmp_marshal_input_blockdev_snapshot_sync, }, -- 1.7.1