Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 539250

Summary: Cannot eject cd-rom when configured to host cd-rom
Product: Red Hat Enterprise Linux 5 Reporter: James Ko <koj>
Component: kvmAssignee: Eduardo Habkost <ehabkost>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 5.4.zCC: andriusb, koj, llim, nsprei, qzhang, tburke, virt-maint, ykaul
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kvm-83-143.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 581789 (view as bug list) Environment:
Last Closed: 2010-03-30 07:55:55 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: 581789    

Description James Ko 2009-11-19 18:17:40 UTC
Description of problem:
QEMU does not release cd-rom on 'eject ide1-cd0' when connected to the host's cd-rom drive /dev/scd0


Version-Release number of selected component (if applicable):
kvm-83-105.el5_4.9


How reproducible:
Everytime


Steps to Reproduce:
1. Connect the physical cd-rom drive to virtual cd-drive using 'change' commmand
2. Verify drive is connected with 'info block'
3. Attempt to release association the drive using 'eject' command
  
Actual results:
info block is still showing physical drive association

Expected results:
info block should show cd-rom device ide1-cd0 as [not inserted]


Additional info:
Unknown if it makes a difference but there is no physical disc present in the drive.  Will update once I can get test results with disc present.

Changing the cd-rom to another file without first ejecting successfully changes the drive in the guest.

Comment 1 Eduardo Habkost 2009-11-19 19:47:01 UTC
(In reply to comment #0)
> Additional info:
> Unknown if it makes a difference but there is no physical disc present in the
> drive.  Will update once I can get test results with disc present.

It does. For some reason, the eject code is conditional on bdrv_is_inserted(), that will return false if there is no physical disk inserted. I am investigating why it does that.

Comment 3 Eduardo Habkost 2009-11-30 21:13:44 UTC
Fix submitted upstream: http://marc.info/?l=qemu-devel&m=125961532916885

Comment 4 Andrius Benokraitis 2009-12-01 02:32:33 UTC
Removing Cisco from 'partner' field since this isn't a bugzilla being
requested/sponsored by the Cisco Engineering team via Red Hat Engineering
Partner Management.

Comment 10 Qunfang Zhang 2010-01-20 05:20:39 UTC
Can reproduce in kvm-83-142.el5.
Re-test in kvm-83-147.el5,this issue does not exist.

Steps:
1.boot a guest.(I tested win2k3 guest and rhel3.9 guest.)
/usr/libexec/qemu-kvm -no-hpet -usbdevice tablet -rtc-td-hack -m 2G -smp 2 -drive file=/root/win2k3-32-bak.raw,media=disk,if=ide -net nic,vlan=0,macaddr=10:1a:4a:10:20:4d,model=rtl8139 -net tap,vlan=0,script=/etc/qemu-ifup -cpu qemu64,+sse2 -boot c -monitor stdio -vnc :10
2.(qemu)info block
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
3.(qemu)change ide1-cd0 /dev/cdrom
4.(qemu)info block
ide1-cd0: type=cdrom removable=1 locked=0 file=/dev/cdrom ro=0 drv=host_device
5.(qemu)eject ide1-cd0
(qemu)info block
ide1-cd0: type=cdrom removable=1 locked=0 file=/dev/cdrom ro=0 drv=host_device

Re-test with the same steps in kvm-83-147.el5.This issue does not exist.
4.(qemu)info block
ide1-cd0: type=cdrom removable=1 locked=0 file=/dev/cdrom ro=0 drv=host_device
5.(qemu)eject ide1-cd0
(qemu)info block
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]

This issue only happened when there is no physical disc present in the
drive.
I tested with the same steps when physical disc present.It works well.
And also I tested changing the cd-rom to an file(for example:rhle5.4-32.qcow2),it works well too.

Comment 13 errata-xmlrpc 2010-03-30 07:55:55 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2010-0271.html