aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c70
1 files changed, 21 insertions, 49 deletions
diff --git a/hmp.c b/hmp.c
index 3ca79c3ea3..cc2056e9e2 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1077,31 +1077,28 @@ void hmp_block_resize(Monitor *mon, const QDict *qdict)
void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
{
- const char *device = qdict_get_str(qdict, "device");
const char *filename = qdict_get_str(qdict, "target");
const char *format = qdict_get_try_str(qdict, "format");
bool reuse = qdict_get_try_bool(qdict, "reuse", false);
bool full = qdict_get_try_bool(qdict, "full", false);
- enum NewImageMode mode;
Error *err = NULL;
+ DriveMirror mirror = {
+ .device = (char *)qdict_get_str(qdict, "device"),
+ .target = (char *)filename,
+ .has_format = !!format,
+ .format = (char *)format,
+ .sync = full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
+ .has_mode = true,
+ .mode = reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PATHS,
+ .unmap = true,
+ };
if (!filename) {
error_setg(&err, QERR_MISSING_PARAMETER, "target");
hmp_handle_error(mon, &err);
return;
}
-
- if (reuse) {
- mode = NEW_IMAGE_MODE_EXISTING;
- } else {
- mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
- }
-
- qmp_drive_mirror(false, NULL, device, filename, !!format, format,
- false, NULL, false, NULL,
- full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
- true, mode, false, 0, false, 0, false, 0,
- false, 0, false, 0, false, true, &err);
+ qmp_drive_mirror(&mirror, &err);
hmp_handle_error(mon, &err);
}
@@ -1439,42 +1436,17 @@ void hmp_change(Monitor *mon, const QDict *qdict)
void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
+ BlockIOThrottle throttle = {
+ .device = (char *) qdict_get_str(qdict, "device"),
+ .bps = qdict_get_int(qdict, "bps"),
+ .bps_rd = qdict_get_int(qdict, "bps_rd"),
+ .bps_wr = qdict_get_int(qdict, "bps_wr"),
+ .iops = qdict_get_int(qdict, "iops"),
+ .iops_rd = qdict_get_int(qdict, "iops_rd"),
+ .iops_wr = qdict_get_int(qdict, "iops_wr"),
+ };
- qmp_block_set_io_throttle(qdict_get_str(qdict, "device"),
- qdict_get_int(qdict, "bps"),
- qdict_get_int(qdict, "bps_rd"),
- qdict_get_int(qdict, "bps_wr"),
- qdict_get_int(qdict, "iops"),
- qdict_get_int(qdict, "iops_rd"),
- qdict_get_int(qdict, "iops_wr"),
- false, /* no burst max via HMP */
- 0,
- false,
- 0,
- false,
- 0,
- false,
- 0,
- false,
- 0,
- false,
- 0,
- false, /* no burst length via HMP */
- 0,
- false,
- 0,
- false,
- 0,
- false,
- 0,
- false,
- 0,
- false,
- 0,
- false, /* No default I/O size */
- 0,
- false,
- NULL, &err);
+ qmp_block_set_io_throttle(&throttle, &err);
hmp_handle_error(mon, &err);
}