Bug 1025178

Summary: QMP: "DEVICE_TRAY_MOVED" event is emitted twice when eject or change the scsi-cd cdrom
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Markus Armbruster <armbru>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: bsarathy, chayang, juzhang, kwolf, michen, mkenneth, pbonzini, qzhang, rbalakri, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-19 21:56:52 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: 890012    
Bug Blocks:    

Description Sibiao Luo 2013-10-31 07:45:40 UTC
Description of problem:
QMP: "DEVICE_TRAY_MOVED" event is emitted twice when eject or change the scsi-cd cdrom, but the IDE cdrom did not meet such issue.
this issue a little different bug 890012 for tray-open value in HMP monitor, but they are all specified the scsi-cd.

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

How reproducible:
100%

Steps to Reproduce:
1.boot a guest with scsi-cdrom and QMP server.
e.g:...-qmp tcp:0:4444,server,nowait -drive file=/home/my-cdrom1.iso,media=cdrom,if=none,id=drive-disk1,format=raw,cache=none,aio=native -device virtio-scsi-pci,bus=pci.0,addr=0x8,id=scsi0 -device scsi-cd,bus=scsi0.0,drive=drive-disk1,id=disk1
2.connect the QMP server via nc.
$ telnet 10.16.67.29 4444
Trying 10.16.67.29...
Connected to 10.16.67.29.
Escape character is '^]'.
{"QMP": {"version": {"qemu": {"micro": 1, "minor": 12, "major": 0}, "package": "(qemu-kvm-0.12.1.2)"}, "capabilities": []}}
{"execute":"qmp_capabilities"}
{"return": {}}
3.eject and change the scsi-cd cdrom in QMP monitor.
->{"execute":"eject","arguments":{"device":"drive-disk1","force":true}}
->{"execute":"change","arguments":{"device":"drive-disk1","target":"/home/my-cdrom1.iso"}}

Actual results:
after step 3, the "DEVICE_TRAY_MOVED" event is emitted twice when eject or change the scsi-cd cdrom.
->{"execute":"eject","arguments":{"device":"drive-disk1","force":true}}
{"timestamp": {"seconds": 1383190461, "microseconds": 341709}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "drive-disk1", "tray-open": true}}
{"return": {}}
{"timestamp": {"seconds": 1383190462, "microseconds": 525296}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "drive-disk1", "tray-open": false}}
->{"execute":"change","arguments":{"device":"drive-disk1","target":"/home/my-cdrom1.iso"}}
{"timestamp": {"seconds": 1383190469, "microseconds": 910601}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "drive-disk1", "tray-open": true}}
{"timestamp": {"seconds": 1383190469, "microseconds": 910845}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "drive-disk1", "tray-open": false}}
{"return": {}}

Expected results:
the first DEVICE_TRAY_MOVED to open the tray when eject the cdrom, and the second DEVICE_TRAY_MOVED to close the tray when change the cdrom, like:
->{"execute":"eject","arguments":{"device":"drive-disk1","force":true}}
{"timestamp": {"seconds": 1383190461, "microseconds": 341709}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "drive-disk1", "tray-open": true}}
{"return": {}}

->{"execute":"change","arguments":{"device":"drive-disk1","target":"/home/my-cdrom1.iso"}}
{"timestamp": {"seconds": 1383190469, "microseconds": 910845}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "drive-disk1", "tray-open": false}}
{"return": {}}

Additional info:

Comment 1 Paolo Bonzini 2013-10-31 13:47:20 UTC
The patch for bug 890012 should fix this one as well.

Comment 2 RHEL Program Management 2013-11-03 14:16:03 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 Ademar Reis 2015-05-19 21:56:52 UTC
Corner case, no practical impact. Closing it as WONTFIX in RHEL6. Since there's no impact in RHEL7 either, where direct usage of QMP is not even supported, I'm not clonning it there.

Reassigning it to Markus though, who, as the QMP upstream maintainer, may have a different opinion (Markus: feel free to reopen).

Comment 6 Markus Armbruster 2015-09-07 12:02:17 UTC
As far as I can tell, upstream and RHEL-7 behave as expected.