diff options
author | Markus Armbruster <armbru@redhat.com> | 2010-06-25 13:42:14 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-07-02 13:18:02 +0200 |
commit | 0b0d5085f72bbd7256a8ee226cc44efc517d94fd (patch) | |
tree | e2d3a6cb0b5f07d8220f2361605ba689220560b1 /hw/scsi-generic.c | |
parent | 4ac17cd4157d0db78d42b2f634861c1132f9c082 (diff) | |
download | qemu-0b0d5085f72bbd7256a8ee226cc44efc517d94fd.tar.gz qemu-0b0d5085f72bbd7256a8ee226cc44efc517d94fd.tar.bz2 qemu-0b0d5085f72bbd7256a8ee226cc44efc517d94fd.zip |
block: Fix virtual media change for if=none
BlockDriverState member removable controls whether virtual media
change (monitor commands change, eject) is allowed. It is set when
the "type hint" is BDRV_TYPE_CDROM or BDRV_TYPE_FLOPPY.
The type hint is only set by drive_init(). It sets BDRV_TYPE_FLOPPY
for if=floppy. It sets BDRV_TYPE_CDROM for media=cdrom and if=ide,
scsi, xen, or none.
if=ide and if=scsi work, because the type hint makes it a CD-ROM.
if=xen likewise, I think.
For the same reason, if=none works when it's used by ide-drive or
scsi-disk. For other guest devices, there are problems:
* fdc: you can't change virtual media
$ qemu [...] -drive if=none,id=foo,... -global isa-fdc.driveA=foo
QEMU 0.12.50 monitor - type 'help' for more information
(qemu) eject foo
Device 'foo' is not removable
unless you add media=cdrom, but that makes it readonly.
* virtio: if you add media=cdrom, you can change virtual media. If
you eject, the guest gets I/O errors. If you change, the guest sees
the drive's contents suddenly change.
* scsi-generic: if you add media=cdrom, you can change virtual media.
I didn't test what that does to the guest or the physical device,
but it can't be pretty.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/scsi-generic.c')
-rw-r--r-- | hw/scsi-generic.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c index 79347f4a67..3915e7844e 100644 --- a/hw/scsi-generic.c +++ b/hw/scsi-generic.c @@ -509,6 +509,7 @@ static int scsi_generic_initfn(SCSIDevice *dev) DPRINTF("block size %d\n", s->qdev.blocksize); s->driver_status = 0; memset(s->sensebuf, 0, sizeof(s->sensebuf)); + bdrv_set_removable(s->bs, 0); return 0; } |