This reverts commit 9ca111544c64b5abed2e79cf52e19a8f227b347b. That commit has added a weird side effect to QMP: on shutdown, QMP emits the DEVICE_TRAY_MOVED event for all empty drives that have closed trays.
This happens because the tray state actually changes in the following code path: main loop exit bdrv_close_all() bdrv_close() bdrv_dev_change_media_cb() So, revert the commit as the real fix is to separate eject from bdrv_close() and also because it's not clear how important it is to have a 100% correct semantic for eject from HMP. Signed-off-by: Luiz Capitulino <lcapitul...@redhat.com> --- ** IMPORTANT: This is an RFC because I'm not totally sure we should apply it for 1.4, for the following reasons: 1. The worst we get is a gratuitous state change that triggers an QMP event 2. Commit 9ca1115 is a bit old and was introduced before 1.4 development 3. This is not the Right Thing either block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 50dab8e..d58c6cc 100644 --- a/block.c +++ b/block.c @@ -1178,9 +1178,9 @@ void bdrv_close(BlockDriverState *bs) bdrv_delete(bs->file); bs->file = NULL; } - } - bdrv_dev_change_media_cb(bs, false); + bdrv_dev_change_media_cb(bs, false); + } /*throttling disk I/O limits*/ if (bs->io_limits_enabled) { -- 1.8.1