On Wed, Apr 13, 2022 at 01:18:46AM +0300, Denis V. Lunev wrote: > '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 <d...@openvz.org> > Reviewed-by: Vladimir Sementsov-Ogievskiy <vsement...@openvz.org> > Acked-by: "Dr. David Alan Gilbert" <dgilb...@redhat.com> > CC: Kevin Wolf <kw...@redhat.com> > CC: Hanna Reitz <hre...@redhat.com> > CC: Eric Blake <ebl...@redhat.com> > CC: Markus Armbruster <arm...@redhat.com> > --- > block/qapi-sysemu.c | 3 ++- > hmp-commands.hx | 11 +++++++---- > monitor/hmp-cmds.c | 4 +++- > qapi/block.json | 6 ++++++ > ui/cocoa.m | 1 + > 5 files changed, 19 insertions(+), 6 deletions(-) > > Changes from v2: > - fixed parameter's order in changeDeviceMedia(). This is a VERY interesting > story, actually. Both versions of the patch (v2 & v3) compile silently. > In order to see the difference one needs to enable -Weverything compilation > option! > > Changes from v1: > - added kludge to Objective C code > - simplified a bit call of do_open_tray() (thanks, Vova!) > - added record to hmp-command.hx
Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|