Bug 1240310

Summary: {"execute":"query-block"} should not show the cdrom device that have ejected
Product: Red Hat Enterprise Linux 7 Reporter: Ademar Reis <areis>
Component: qemu-kvm-rhevAssignee: John Snow <jsnow>
Status: CLOSED ERRATA QA Contact: FuXiangChun <xfu>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: chayang, flang, huding, jsnow, juzhang, knoel, mdeng, michen, mkenneth, mrezanin, qzhang, rbalakri, rpacheco, virt-bugs, virt-maint, yfu, ypu, yuhuang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu 2.6.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1199407 Environment:
Last Closed: 2016-11-07 20:26:41 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: 1199407    
Bug Blocks:    

Comment 1 John Snow 2016-06-07 22:55:39 UTC
Tested with Fedora 24 Beta Workstation for the guest.

Upstream AHCI ATAPI and IDE ATAPI behavior:

After eject, the media is still present, but tray-open is true. This is the expected behavior.

Also verified with scsi-cd using virtio-scsi-pci device as above.


It is *not expected* that the media (iso) will be absent from query-block when using a tray-model CDROM device after an eject. In much the same way that when you eject a CDROM in real life if you do not also remove the media, closing the tray will re-mount the same CDROM.

Removing the media such that it does not appear in query-block requires the use of the medium-remove command OR the legacy "eject" command.

Tray-open bug appears to have been fixed (at least) as of 2.6.0

Comment 3 Yumei Huang 2016-09-10 08:40:04 UTC
Verify:
qemu-kvm-rhev-2.6.0-23.el7
kernel-3.10.0-497.el7.x86_64

Boot guest with scsi-cd, and eject the cdrom in the guest. The media is present and the tray-open is true.

Details:
// before eject /dev/sr0
{"execute":"query-block"}
{"return": [{"io-status": "ok", "device": "drive-disk", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 42949672960, "filename": "/home/guest/rhel73.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 8430391296, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "node-name": "#block177", "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/guest/rhel73.qcow2", "encryption_key_missing": false}, "type": "unknown"}, {"io-status": "ok", "device": "cdrom1", "locked": true, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 536870912, "filename": "/home/guest/iso/test.iso", "format": "raw", "actual-size": 536870912, "dirty-flag": false}, "iops_wr": 0, "ro": true, "node-name": "#block330", "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": "/home/guest/iso/test.iso", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}]}

// eject /dev/sr0  in guest
{"timestamp": {"seconds": 1473495807, "microseconds": 16589}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "cdrom1", "tray-open": true}}

{"execute":"query-block"}
{"return": [{"io-status": "ok", "device": "drive-disk", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 42949672960, "filename": "/home/guest/rhel73.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 8430391296, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "node-name": "#block177", "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/guest/rhel73.qcow2", "encryption_key_missing": false}, "type": "unknown"}, {"io-status": "ok", "device": "cdrom1", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 536870912, "filename": "/home/guest/iso/test.iso", "format": "raw", "actual-size": 536870912, "dirty-flag": false}, "iops_wr": 0, "ro": true, "node-name": "#block330", "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": "/home/guest/iso/test.iso", "encryption_key_missing": false}, "tray_open": true, "type": "unknown"}]}

So the bug is fixed.

Comment 5 errata-xmlrpc 2016-11-07 20:26:41 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.

https://rhn.redhat.com/errata/RHBA-2016-2673.html