aboutsummaryrefslogtreecommitdiff
path: root/block/monitor/block-hmp-cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/monitor/block-hmp-cmds.c')
-rw-r--r--block/monitor/block-hmp-cmds.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
index 0ff7c84..ae624ab 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
@@ -1005,3 +1005,24 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
g_free(sn_tab);
g_free(global_snapshots);
}
+
+void hmp_change_medium(Monitor *mon, const char *device, const char *target,
+ const char *arg, const char *read_only, bool force,
+ Error **errp)
+{
+ ERRP_GUARD();
+ BlockdevChangeReadOnlyMode read_only_mode = 0;
+
+ if (read_only) {
+ read_only_mode =
+ qapi_enum_parse(&BlockdevChangeReadOnlyMode_lookup,
+ read_only,
+ BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, errp);
+ if (*errp) {
+ return;
+ }
+ }
+
+ qmp_blockdev_change_medium(device, NULL, target, arg, true, force,
+ !!read_only, read_only_mode, errp);
+}