Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1199407

Summary: {"execute":"query-block"} should not show the cdrom device that have ejected
Product: Red Hat Enterprise Linux 6 Reporter: langfang <flang>
Component: qemu-kvmAssignee: John Snow <jsnow>
Status: CLOSED NEXTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.7CC: bcao, chayang, juzhang, mdeng, michen, mkenneth, qiguo, qzhang, rbalakri, rpacheco, virt-bugs, virt-maint, yfu, ypu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1240310 (view as bug list) Environment:
Last Closed: 2015-07-06 14:17:06 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:
Bug Depends On:    
Bug Blocks: 1240310    

Description langfang 2015-03-06 07:48:45 UTC
Description of problem:

{"execute":"query-block"} should not show the have ejected cdrom device

Version-Release number of selected component (if applicable):
Host:
# uname -r
2.6.32-541.el6.x86_64
# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.456.el6.x86_64

Guest:
2.6.32-541.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Boot guest with 
... -drive file=/root/flang/en_windows_xp_professional_x64.iso,if=none,media=cdrom,readonly=on,format=raw,id=cdrom1  -device scsi-cd,bus=scsi0.0,drive=cdrom1,id=scsi0-0

2.Check the CDROM device
{"execute":"query-block"}
{"return": [{"io-status": "ok", "device": "drive-scsi0-0-0-0", "locked": false, "removable": false, "inserted": {"ro": false, "drv": "qcow2", "encrypted": false, "file": "/home/rhel6.7-copy.qcow2"}, "type": "unknown"}, {"io-status": "ok", "device": "cdrom1", "locked": false, "removable": true, "inserted": {"ro": true, "drv": "raw", "encrypted": false, "file": "/home/en_windows_xp_professional_x64.iso"}, "tray-open": false, "type": "unknown"}]}

3.After guest boot up , eject the cdrom device in guest

#eject /dev/sr0 /#eject -r /dev/sr0
...
{"timestamp": {"seconds": 1425626949, "microseconds": 576764}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "cdrom1", "tray-open": true}}
{"timestamp": {"seconds": 1425626950, "microseconds": 66998}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "cdrom1", "tray-open": false}}
...
4.Check again
{"execute":"query-block"}
{"return": [{"io-status": "ok", "device": "drive-scsi0-0-0-0", "locked": false, "removable": false, "inserted": {"ro": false, "drv": "qcow2", "encrypted": false, "file": "/home/rhel6.7-copy.qcow2"}, "type": "unknown"}, {"io-status": "ok", "device": "cdrom1", "locked": false, "removable": true, "inserted": {"ro": true, "drv": "raw", "encrypted": false, "file": "/home/en_windows_xp_professional_x64.iso"}, "tray-open": false, "type": "unknown"}]}


Actual results:
Still can see the cdrom device by {"execute":"query-block"},and tray_open is false(0)

Expected results:
After guest eject this device ,should now see the device again for qmp command.And show correct tray-open value.

Additional info:
1. IN guest , after eject the CDROM device , will not see the CDROM device 
2.CLI:
 /usr/libexec/qemu-kvm -name flang-test  -M rhel6.6.0 -enable-kvm -m 4096 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -cpu Sandybridge , -nodefaults  -rtc base=utc -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x6,num_queues=1 -drive file=/home/rhel6.7-copy.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 -netdev tap,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=42:31:09:d3:06:2f,bus=pci.0,addr=0x3  -usb -device usb-tablet,id=input0 -vnc :10 -vga std -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -msg timestamp=on  -qmp tcp:0:4444,server,nowait -monitor stdio -drive file=/home/en_windows_xp_professional_x64.iso,if=none,media=cdrom,readonly=on,format=raw,id=cdrom1  -device ide-drive,drive=cdrom1,id=scsi0-0

Comment 5 Yanan Fu 2015-07-06 09:34:45 UTC
This issue still can be reproduced in RHEL7:

kernel version: 3.10.0-290.el7.x86_64
qemu-kvm version: qemu-kvm-rhev-2.3.0-7.el7


#eject -r /dev/sr0   {"execute":"query-block"}, 
1.Still can see the cdrom device and the file /root/RHEL-7.1-20150219.1-Server-x86_64-dvd1.iso
2.tray_open is true.

both pc and q35 all have this issue.

CLI:
/usr/libexec/qemu-kvm -name test -S -machine q35,accel=kvm,usb=off -m 1G -realtime mlock=on -smp 2,sockets=2,cores=1,threads=1 -no-user-config -nodefaults -monitor stdio -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot menu=on,strict=on -device pci-bridge,bus=pcie.0,id=bridge1,chassis_nr=1,addr=0x5 -device ich9-usb-ehci1,id=usb,bus=bridge1,addr=0x2.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=bridge1,multifunction=on,addr=0x2.0x0 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=bridge1,addr=0x2.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=bridge1,addr=0x2.0x2 -drive file=/root/RHEL-7.1-20150219.1-Server-x86_64-dvd1.iso,if=none,media=cdrom,readonly=on,format=raw,id=cdrom1 -device virtio-scsi-pci,id=scsi-pci -device scsi-cd,bus=scsi-pci.0,drive=cdrom1,id=scsi0-0,bootindex=1 -device ich9-ahci,id=ahci -drive file=/home/yfu.qcow2,if=none,id=drive-ide0-0-0,media=disk,format=qcow2,cache=none -device ide-drive,drive=drive-ide0-0-0,id=ide0-0-0,bus=ahci.1,bootindex=0 -device virtio-serial-pci,id=virtio-serial0,bus=bridge1,addr=0x4 -device usb-tablet,id=input0 -spice port=5900,disable-ticketing -vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432 -msg timestamp=on -monitor unix:/home/qmp,server,nowait -qmp unix:/tmp/socket,server,nowait

Comment 6 Yanan Fu 2015-07-06 10:07:24 UTC
before eject:
{"execute":"query-block"}
{"return": [{"io-status": "ok", "device": "cdrom1", "locked": true, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 3890216960, "filename": "/root/RHEL-7.1-20150219.1-Server-x86_64-dvd1.iso", "format": "raw", "actual-size": 3890216960, "dirty-flag": false}, "iops_wr": 0, "ro": true, "backing_file_depth": 0, "drv": "raw", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "/root/RHEL-7.1-20150219.1-Server-x86_64-dvd1.iso", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}, {"io-status": "ok", "device": "drive-ide0-0-0", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 42949672960, "filename": "/home/yfu.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 3390640128, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": true, "writeback": true}, "file": "/home/yfu.qcow2", "encryption_key_missing": false}, "type": "unknown"}]}

{"timestamp": {"seconds": 1436166354, "microseconds": 513145}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "cdrom1", "tray-open": true}}


after eject:
{"execute":"query-block"}
{"return": [{"io-status": "ok", "device": "cdrom1", "locked": true, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 3890216960, "filename": "/root/RHEL-7.1-20150219.1-Server-x86_64-dvd1.iso", "format": "raw", "actual-size": 3890216960, "dirty-flag": false}, "iops_wr": 0, "ro": true, "backing_file_depth": 0, "drv": "raw", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "/root/RHEL-7.1-20150219.1-Server-x86_64-dvd1.iso", "encryption_key_missing": false}, "tray_open": true, "type": "unknown"}, {"io-status": "ok", "device": "drive-ide0-0-0", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 42949672960, "filename": "/home/yfu.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 3390640128, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": true, "writeback": true}, "file": "/home/yfu.qcow2", "encryption_key_missing": false}, "type": "unknown"}]}

Comment 7 Ademar Reis 2015-07-06 14:17:06 UTC
We may fix it in upstream/rhel7, but not in RHEL6. It's a low priority issue.