[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 31/35] ide/atapi scsi-disk: Make monitor eject -f, t
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 31/35] ide/atapi scsi-disk: Make monitor eject -f, then change work |
Date: |
Mon, 12 Sep 2011 16:19:30 +0200 |
From: Markus Armbruster <address@hidden>
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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 3 ++-
hw/ide/core.c | 1 +
hw/scsi-disk.c | 1 +
3 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 154cc84..0827bf7 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;
}
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 5def25c..9297b9e 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -789,6 +789,7 @@ static void ide_cd_change_cb(void *opaque, bool load)
IDEState *s = opaque;
uint64_t nb_sectors;
+ s->tray_open = !load;
bdrv_get_geometry(s->bs, &nb_sectors);
s->nb_sectors = nb_sectors;
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index f5f1d82..4a60820 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1175,6 +1175,7 @@ static void scsi_destroy(SCSIDevice *dev)
static void scsi_cd_change_media_cb(void *opaque, bool load)
{
+ ((SCSIDiskState *)opaque)->tray_open = !load;
}
static bool scsi_cd_is_tray_open(void *opaque)
--
1.7.6
- [Qemu-devel] [PATCH 13/35] block: Leave enforcing tray lock to device models, (continued)
- [Qemu-devel] [PATCH 13/35] block: Leave enforcing tray lock to device models, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 14/35] block: Drop medium lock tracking, ask device models instead, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 16/35] rbd: allow client id to be specified in config string, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 21/35] ide/atapi: Preserve tray state on migration, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 12/35] scsi-disk: Track tray locked state, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 15/35] block: Rename bdrv_set_locked() to bdrv_lock_medium(), Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 22/35] block: Clean up remaining users of "removable", Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 20/35] scsi-disk: Fix START_STOP to fail when it can't eject, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 28/35] block: Reset buffer alignment on detach, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 24/35] block: Show whether the virtual tray is open in info block, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 31/35] ide/atapi scsi-disk: Make monitor eject -f, then change work,
Kevin Wolf <=
- [Qemu-devel] [PATCH 35/35] qcow2: fix range check, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 34/35] qcow2: align cluster_data to block to improve performance using O_DIRECT, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 19/35] ide/atapi: Don't fail eject when tray is already open, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 25/35] block: Move BlockConf & friends from block_int.h to block.h, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 26/35] hw: Trim superfluous #include "block_int.h", Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 30/35] block: New change_media_cb() parameter load, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 32/35] qcow2: initialize metadata before inserting in cluster_allocs, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 23/35] block: Drop BlockDriverState member removable, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 33/35] ahci: Remove unused struct member, Kevin Wolf, 2011/09/12
- [Qemu-devel] [PATCH 17/35] rbd: clean up, fix style, Kevin Wolf, 2011/09/12