Bug 739944 - CD-ROMs cannot be ejected in virtualized Fedora 16
Summary: CD-ROMs cannot be ejected in virtualized Fedora 16
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.3
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Paolo Bonzini
QA Contact: Virtualization Bugs
Depends On:
Blocks: 740189 782029
TreeView+ depends on / blocked
Reported: 2011-09-20 14:13 UTC by Paolo Bonzini
Modified: 2013-01-10 00:21 UTC (History)
12 users (show)

Fixed In Version: qemu-kvm-
Doc Type: Bug Fix
Doc Text:
No Documentation Needed
Clone Of:
: 740189 (view as bug list)
Last Closed: 2012-06-20 11:34:32 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0746 normal SHIPPED_LIVE qemu-kvm bug fix and enhancement update 2012-06-19 19:31:48 UTC

Description Paolo Bonzini 2011-09-20 14:13:03 UTC
Description of problem:
Fedora 16 always locks media, and relies on eject request events to invoke the unlock/eject sequence from udev.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Boot a Fedora 16 netinst image with an additional, empty CD-ROM
2. Try to change the CD-ROM from the monitor.
Actual results:
The "change" command does not work.

Expected results:
??? No idea, can we get the "change" command to work at all since it relies on a non-forced "eject" to work, and "eject" cannot be done with guest help???

Additional info:

Comment 2 Paolo Bonzini 2011-09-20 14:23:55 UTC
Forgot to mention that eject requests are in fact completely unimplemented by QEMU.  Should be doable with Markus's revamp of locked state upstream, but still the doubt on how to make atomic "change" work remains.

Comment 3 Paolo Bonzini 2011-09-20 16:24:17 UTC
More info at http://lwn.net/Articles/423619/

Kay, how does this behavior of udev-172 work exactly, when there are no async events and polling is disabled?

$ cat /sys/block/sr0/events_async 
$ cat /sys/block/sr0/events
media_change eject_request
$ cat /sys/block/sr0/events_poll_msecs 
$ cat /sys/module/block/parameters/events_dfl_poll_msecs 

Comment 4 Kay Sievers 2011-09-20 22:14:04 UTC
It relies on a recent kernel, polling will be enabled
by default by udev rules:
  # grep . /sys/module/block/parameters/*

Comment 5 Paolo Bonzini 2011-09-21 08:56:40 UTC
> polling will be enabled by default by udev rules:

Apparently this doesn't work when booting the rescue image.  Cloning the bug.

Comment 6 Dor Laor 2011-09-21 13:19:22 UTC
It probably coalesced with other cdrom bugs Markus have on his queue

Comment 8 Markus Armbruster 2011-11-25 12:38:41 UTC
Paolo fixed it upstream, reassigning.

Comment 13 FuXiangChun 2012-02-10 09:50:56 UTC
1.reproduce this bug with qemu-kvm-

reproduce steps:
1.1) install fedora16 guest
1.2) boot guest 
  /usr/libexec/qemu-kvm  -M rhel6.2.0 -enable-kvm -m 2048 -smp 2,sockets=1,cores=2,threads=1 -name rhel6.2 -uuid 9a2fcf21-04e9-3737-6c3c-85011ce1a90c -nodefconfig -nodefaults -mon chardev=monitor,mode=readline -rtc base=utc -boot order=n,menu=off -drive file=/home/fedora16.qcow2,if=none,id=drive-virtio-disk0,boot=on,format=qcow2 -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -device virtio-net-pci,vlan=0,id=net0,mac=52:54:00:c7:c4:6d,bus=pci.0,addr=0x9 -net tap,script=/etc/qemu-ifup,vlan=0,name=hostnet0 -spice disable-ticketing,port=5914 -vga qxl -monitor stdio  -cdrom /home/test-cdrom.raw

1.3) info block
  (qemu) info block
drive-virtio-disk0: type=hd removable=0 file=/home/fedora16.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 file=/home/test-cdrom.raw ro=1 drv=raw encrypted=0 

1.4) (qemu) change ide1-cd0 /home/rhev-hypervisor.iso

actual result:
Device 'ide1-cd0' is locked

2.verify bug with qemu-kvm-

verify steps:
2.1 repeat step 1.2
2.2 repeat step 1.3
2.3 repeat step 1.4

actual result:
change work well 

base on above result, this bug is fixed.

Comment 15 Michal Novotny 2012-05-03 17:39:24 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    New Contents:
No Documentation Needed

Comment 16 errata-xmlrpc 2012-06-20 11:34:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.