aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-03-06 18:55:59 +0100
committerKevin Wolf <kwolf@redhat.com>2012-03-12 15:14:07 +0100
commit6cc2a4157b31c47303da96c5ed7836db3c10def6 (patch)
treef31c97b9ca1ffffd7eb7c8aef2ab933b36d3479a /hmp.c
parentbc8b094feb61c5f3ad55113f1c9b3288dd843b10 (diff)
downloadqemu-6cc2a4157b31c47303da96c5ed7836db3c10def6.zip
qemu-6cc2a4157b31c47303da96c5ed7836db3c10def6.tar.gz
qemu-6cc2a4157b31c47303da96c5ed7836db3c10def6.tar.bz2
qmp: convert blockdev-snapshot-sync to a wrapper around transactions
Simplify the blockdev-snapshot-sync code and gain failsafe operation by turning it into a wrapper around the new transaction command. A new option is also added matching "mode". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hmp.c b/hmp.c
index 3a54455..290c43d 100644
--- a/hmp.c
+++ b/hmp.c
@@ -692,6 +692,8 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
const char *device = qdict_get_str(qdict, "device");
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);
+ enum NewImageMode mode;
Error *errp = NULL;
if (!filename) {
@@ -702,7 +704,9 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
return;
}
- qmp_blockdev_snapshot_sync(device, filename, !!format, format, &errp);
+ mode = reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PATHS;
+ qmp_blockdev_snapshot_sync(device, filename, !!format, format,
+ true, mode, &errp);
hmp_handle_error(mon, &errp);
}