qmp: Introduce blockdev-change-medium

Introduce a new QMP command 'blockdev-change-medium' which is intended
to replace the 'change' command for block devices. The existing function
qmp_change_blockdev() is accordingly renamed to
qmp_blockdev_change_medium().

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Max Reitz 2015-11-06 16:27:06 +01:00 committed by Kevin Wolf
parent f1f5706657
commit 24fb413300
7 changed files with 69 additions and 12 deletions

View file

@ -2143,8 +2143,9 @@ void qmp_blockdev_insert_medium(const char *device, const char *node_name,
qmp_blockdev_insert_anon_medium(device, bs, errp);
}
void qmp_change_blockdev(const char *device, const char *filename,
const char *format, Error **errp)
void qmp_blockdev_change_medium(const char *device, const char *filename,
bool has_format, const char *format,
Error **errp)
{
BlockBackend *blk;
BlockDriverState *medium_bs = NULL;
@ -2165,7 +2166,7 @@ void qmp_change_blockdev(const char *device, const char *filename,
bdrv_flags = blk_get_open_flags_from_root_state(blk);
if (format) {
if (has_format) {
options = qdict_new();
qdict_put(options, "driver", qstring_from_str(format));
}