@@ -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.",
@@ -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);
}
@@ -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:
@@ -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,
},
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(-)