Bug 729225

Summary: eject command in the guest does not works properly when guest using host cdrom
Product: Red Hat Enterprise Linux 6 Reporter: Mike Cao <bcao>
Component: qemu-kvmAssignee: Amit Shah <amit.shah>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: armbru, flang, juzhang, michen, mkenneth, pbonzini, rhod, sluo, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 709314 Environment:
Last Closed: 2012-08-01 07:39:48 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: 580948    

Description Mike Cao 2011-08-09 05:52:23 UTC
Reproduced on 
# uname -r
2.6.32-171.el6.x86_64
[root@localhost ~]# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.177.el6.x86_64


+++ This bug was initially created as a clone of Bug #709314 +++

Description of problem:


Version-Release number of selected component (if applicable):
# uname -r
2.6.18-264.el5
# rpm -q kvm
kvm-83-235.el5


How reproducible:
100%

Steps to Reproduce:
1.start guest with /dev/sr0
eg:/usr/libexec/qemu-kvm -M rhel5.6.0 -m 2048 -smp 4,sockets=4,cores=1,threads=1 -name RHEL6u1 -uuid 7c9a4b2c-8d58-6771-7748-0ce92bfd83f7 -monitor stdio -no-kvm-pit-reinjection -boot dc -drive file=/dev/stress/rhel6u1,if=virtio,boot=on,format=raw,cache=none -drive file=/dev/sr0,if=ide,format=raw,cache=none,media=cdrom,bus=1,unit=0 -net nic,macaddr=54:52:00:7d:dd:37,vlan=0,model=virtio -net tap,vlan=0,downscript=no -serial pty -parallel none -usb -usbdevice tablet -vnc :2 -k en-us -vga cirrus -balloon none -notify all
2.change ide1-cd0 to make guest detect cd in the host cdrom.
(qemu)change ide1-cd0 /dev/sr0 (this step due to Bug 709304
3.mount /dev/sr0 in the guest .
#mount /dev/sr0 /opt
4,umount /dev/sr0  
#umount /dev/sr0
5.in the guest #eject
  
Actual results:
the tray open then closed immediately so that I could not get the cd out from host cdrom.
During this time ,qemu-kvm process freezed 

Expected results:
the tray keeps open.
qemu-kvm does not freeze

Additional info:

Comment 2 Amit Shah 2011-12-07 10:16:33 UTC
Host CDROM passthrough is difficult to get right due to multiple programs
involved that need fixing.

Comment 4 RHEL Program Management 2012-07-10 07:00:36 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 5 RHEL Program Management 2012-07-11 02:00:18 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 6 Ronen Hod 2012-07-23 11:03:06 UTC
Please test the CD-ROM support using SCSI passthrough.
If it works, we prefer to close this bug.

Comment 7 Sibiao Luo 2012-07-24 08:37:19 UTC
(In reply to comment #6)
> Please test the CD-ROM support using SCSI passthrough.
> If it works, we prefer to close this bug.

Hi Ronen,

   I have tested the CD-ROM with SCSI passthrough, it can work correctly.

Steps:
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 100 times.
# eject /dev/sr0 
# eject -t /dev/sr0

Result:
after the step 3, the CD-ROM SCSI passthrough device can be popup and drop-in successfully.

BTW, if i popup the CD-ROM SCSI passthrough device via 'eject -r /dev/sr0', it always fail to popup and prompt some 'Input/output error'. But if i use 'eject -s /dev/sr0' or 'eject /dev/sr0', it can popup the CD-ROM SCSI passthrough device correctly. I also try this test scenario on my host, they all work correctly. Maybe there a bug for SCSI passthrough, would i file a bug to track this issue.
# eject -r /dev/sr0 
eject: unable to eject, last error: Input/output error

Best wish & thx.
sluo

Comment 8 Amit Shah 2012-08-01 07:39:48 UTC
Please create a separate bug for other behaviour.  For this IDE one, I'll close it.

Comment 9 Sibiao Luo 2012-08-14 15:00:27 UTC
(In reply to comment #8)
> Please create a separate bug for other behaviour.  For this IDE one, I'll
> close it.

hi amit,

   I have separated it in bz #842946, but paol close it to NOTABUG, could you help check it.

Thanks.
sluo