Bug 739944

Summary: CD-ROMs cannot be ejected in virtualized Fedora 16
Product: Red Hat Enterprise Linux 6 Reporter: Paolo Bonzini <pbonzini>
Component: qemu-kvmAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: acathrow, amit.shah, armbru, juzhang, kay, minovotn, mkenneth, pbonzini, shu, tburke, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.221.el6 Doc Type: Bug Fix
Doc Text:
No Documentation Needed
Story Points: ---
Clone Of:
: 740189 (view as bug list) Environment:
Last Closed: 2012-06-20 11:34:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 740189, 782029    

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):
qemu-kvm-0.12.1-191.el6

How reproducible:
100%

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 
-1
$ cat /sys/module/block/parameters/events_dfl_poll_msecs 
0

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/*
  2000

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-0.12.1.2-2.192.el6.x86_64

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-0.12.1.2-2.221.el6.x86_64

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.

http://rhn.redhat.com/errata/RHBA-2012-0746.html