On 10/28/2011 07:21 PM, Kevin Wolf wrote:
> - if (!force&& !bdrv_dev_is_tray_open(bs)
> -&& bdrv_dev_is_medium_locked(bs)) {
> - qerror_report(QERR_DEVICE_LOCKED, bdrv_get_device_name(bs));
> + if (bdrv_dev_is_medium_locked(bs)&& !bdrv_dev_is_tray_open(bs)) {
> + bdrv_dev_eject_request(bs, force);
> + if (!force) {
> + qerror_report(QERR_DEVICE_LOCKED, bdrv_get_device_name(bs));
> + }
> return -1;
> }
> bdrv_close(bs);
Now force doesn't force any more. It avoids the error message, but
doesn't forcefully close the BlockDriverState any more. Intentional? If
so, why is it a good idea?
In theory the guest OS should eject the disk itself. However, force
does unlock the disk so that: 1) two ejects will have the desired
effect; 2) force eject followed by change will work even with the tray
locked, unlike before this series.
Paolo