mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
block: Factor out hmp_change_medium(), and move to block/monitor/
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230124121946.1139465-13-armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
cffaca0fab
commit
fa1d2f8f63
3 changed files with 25 additions and 16 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue