diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-03-06 18:55:59 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-03-12 15:14:07 +0100 |
commit | 6cc2a4157b31c47303da96c5ed7836db3c10def6 (patch) | |
tree | f31c97b9ca1ffffd7eb7c8aef2ab933b36d3479a /hmp.c | |
parent | bc8b094feb61c5f3ad55113f1c9b3288dd843b10 (diff) |
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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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); } |