aboutsummaryrefslogtreecommitdiff
path: root/block/qapi-sysemu.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2022-04-13 01:18:46 +0300
committerHanna Reitz <hreitz@redhat.com>2022-04-25 12:02:36 +0200
commit80dd5aff1b3273e0ee5bec379df62647c0b39c1c (patch)
tree984391b0ca2dbeb1ec858ad0348227ac6312268b /block/qapi-sysemu.c
parent754f756cc4c6d9d14b7230c62b5bb20f9d655888 (diff)
block: add 'force' parameter to 'blockdev-change-medium' command
'blockdev-change-medium' is a convinient wrapper for the following sequence of commands: * blockdev-open-tray * blockdev-remove-medium * blockdev-insert-medium * blockdev-close-tray and should be used f.e. to change ISO image inside the CD-ROM tray. Though the guest could lock the tray and some linux guests like CentOS 8.5 actually does that. In this case the execution if this command results in the error like the following: Device 'scsi0-0-1-0' is locked and force was not specified, wait for tray to open and try again. This situation is could be resolved 'blockdev-open-tray' by passing flag 'force' inside. Thus is seems reasonable to add the same capability for 'blockdev-change-medium' too. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org> Acked-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> CC: Hanna Reitz <hreitz@redhat.com> CC: Eric Blake <eblake@redhat.com> CC: Markus Armbruster <armbru@redhat.com> Message-Id: <20220412221846.280723-1-den@openvz.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'block/qapi-sysemu.c')
-rw-r--r--block/qapi-sysemu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/qapi-sysemu.c b/block/qapi-sysemu.c
index 8498402ad4..680c7ee342 100644
--- a/block/qapi-sysemu.c
+++ b/block/qapi-sysemu.c
@@ -318,6 +318,7 @@ void qmp_blockdev_change_medium(bool has_device, const char *device,
bool has_id, const char *id,
const char *filename,
bool has_format, const char *format,
+ bool has_force, bool force,
bool has_read_only,
BlockdevChangeReadOnlyMode read_only,
Error **errp)
@@ -380,7 +381,7 @@ void qmp_blockdev_change_medium(bool has_device, const char *device,
rc = do_open_tray(has_device ? device : NULL,
has_id ? id : NULL,
- false, &err);
+ force, &err);
if (rc && rc != -ENOSYS) {
error_propagate(errp, err);
goto fail;