aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-09-06 18:59:00 +0200
committerKevin Wolf <kwolf@redhat.com>2011-09-12 15:17:22 +0200
commit25ad22bc4e9c946df694fa7343027b1050b2946b (patch)
tree40653ee590c807635b36dcfb895471ef188b1b8f /blockdev.c
parent7d4b4ba5c2bae99d44f265884b567ae63947bb4a (diff)
ide/atapi scsi-disk: Make monitor eject -f, then change work
change fails while the tray is locked by the guest. eject -f forces it open and removes any media. Unfortunately, the tray closes again instantly. Since the lock remains as it is, there is no way to insert another medium unless the guest voluntarily unlocks. Fix by leaving the tray open after monitor eject. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/blockdev.c b/blockdev.c
index 154cc8456e..0827bf7743 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -635,7 +635,8 @@ static int eject_device(Monitor *mon, BlockDriverState *bs, int force)
qerror_report(QERR_DEVICE_NOT_REMOVABLE, bdrv_get_device_name(bs));
return -1;
}
- if (!force && bdrv_dev_is_medium_locked(bs)) {
+ if (!force && !bdrv_dev_is_tray_open(bs)
+ && bdrv_dev_is_medium_locked(bs)) {
qerror_report(QERR_DEVICE_LOCKED, bdrv_get_device_name(bs));
return -1;
}