Bug 842946

Summary: popup the CD-ROM SCSI pass-through device via 'eject -r /dev/sr0' always fail
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, amit.shah, bsarathy, chayang, dyasny, juzhang, michen, mkenneth, pbonzini, rhod, shu, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-25 11:54:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sibiao Luo 2012-07-25 03:21:50 UTC
Description of problem:
boot a rhel6.3 guest with host CD-ROM SCSI pass-through and popup it via 'eject -r /dev/sr0' always fail and prompt some Input/output error. 
if i use 'eject -s /dev/sr0' or 'eject /dev/sr0' to test, they all work correctly without any error. 
i also test the three commands on my host with physical CD-ROM, they all work correctly.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-284.el6.x86_64
qemu-kvm-0.12.1.2-2.295.el6.x86_64
guest info:
rhel6.3.5.31.0_x86_64

How reproducible:
always

Steps to Reproduce:
1.boot a guest with a CD-ROM SCSI passthrough.
e.g. # /usr/libexec/qemu-kvm -M rhel6.3.0 -enable-kvm -m 2048 -smp 2,sockets=1,cores=2,threads=1 -m 2G -usb -device usb-tablet,id=input0 -name sluo-test -drive file=/home/rhel6.3.5.31.0.qcow2,if=none,id=drive-virtio-disk-0,format=qcow2,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,drive=drive-virtio-disk-0,id=virtio0,bootindex=1 -netdev tap,script=/etc/qemu-ifup,id=netdev0 -device virtio-net-pci,netdev=netdev0,id=device-net0 -spice port=5931,disable-ticketing -vga qxl -monitor stdio -boot menu=on -nodefconfig -nodefaults -drive file=/dev/sr0,if=none,media=cdrom,id=drive-scsi-sluo,format=raw,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi -device scsi-block,drive=drive-scsi-sluo,id=scsi_sluo
2.# ls -l /dev/cdrom1 
  lrwxrwxrwx. 1 root root 3 Jul 23 19:39 /dev/cdrom1 -> sr0
  # ls -l /dev/sr0 
  brw-rw----+ 1 root cdrom 11, 0 Jul 23 19:39 /dev/sr0
3.repeat popup and drop-in the CD-ROM SCSI passthrough device for some times.
# eject -r /dev/sr0 
# eject -t /dev/sr0
  
Actual results:
after the step 3, it always fail to popup and prompt some 'Input/output error'.
# eject -r /dev/sr0 
eject: unable to eject, last error: Input/output error

Expected results:
it should popup the CD-ROM correctly without any error.

Additional info:

Comment 2 Paolo Bonzini 2012-07-25 11:54:37 UTC
"eject -r" can fail if (for example) the CD-ROM is locked.  This can also happen on bare-metal, it depends on your configuration.