qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 5/6 v11] add-cow: hmp and qmp interface
Date: Wed,  1 Aug 2012 00:51:49 +0800	[thread overview]
Message-ID: <1343753510-24661-5-git-send-email-wdongxu@linux.vnet.ibm.com> (raw)
In-Reply-To: <1343753510-24661-1-git-send-email-wdongxu@linux.vnet.ibm.com>

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 <wdongxu@linux.vnet.ibm.com>
---
 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

  parent reply	other threads:[~2012-07-31 16:52 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 16:51 [Qemu-devel] [PATCH 1/6 v11] docs: spec for add-cow file format Dong Xu Wang
2012-07-31 16:51 ` [Qemu-devel] [PATCH 2/6 v11 v11] block: make some functions public Dong Xu Wang
2012-08-01 13:53   ` Eric Blake
2012-08-02  7:10     ` Dong Xu Wang
2012-08-01 14:01   ` Stefan Hajnoczi
2012-08-02  7:11     ` Dong Xu Wang
2012-07-31 16:51 ` [Qemu-devel] [PATCH 3/6] add-cow file format Dong Xu Wang
2012-08-01 13:57   ` Eric Blake
2012-08-01 14:14     ` Stefan Hajnoczi
2012-08-01 14:21       ` Kevin Wolf
2012-08-02  7:20     ` Dong Xu Wang
2012-08-01 15:31   ` Stefan Hajnoczi
2012-08-02  7:20     ` Dong Xu Wang
2012-07-31 16:51 ` [Qemu-devel] [PATCH 4/6 v11] add-cow: support snapshot_blkde Dong Xu Wang
2012-08-01 15:37   ` Stefan Hajnoczi
2012-08-02  7:28     ` Dong Xu Wang
2012-08-02 10:37       ` Stefan Hajnoczi
2012-07-31 16:51 ` Dong Xu Wang [this message]
2012-07-31 16:51 ` [Qemu-devel] [PATCH 6/6 v11] add-cow: support qemu-iotests Dong Xu Wang
2012-08-01 13:51 ` [Qemu-devel] [PATCH 1/6 v11] docs: spec for add-cow file format Eric Blake
2012-08-02  7:03   ` Dong Xu Wang
2012-08-01 13:55 ` Stefan Hajnoczi
2012-08-02  7:09   ` Dong Xu Wang
2012-08-02 10:44     ` Stefan Hajnoczi
2012-08-03  5:56       ` Dong Xu Wang
2012-08-03  8:26         ` Stefan Hajnoczi
2012-08-06  2:05           ` Dong Xu Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1343753510-24661-5-git-send-email-wdongxu@linux.vnet.ibm.com \
    --to=wdongxu@linux.vnet.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).