Bug 723270

Summary: Report cdrom tray status in a monitor command such as info block
Product: Red Hat Enterprise Linux 6 Reporter: Dan Kenigsberg <danken>
Component: qemu-kvmAssignee: Markus Armbruster <armbru>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2CC: iheim, juzhang, lcapitulino, mkenneth, mprivozn, shuang, shu, tburke, virt-maint, wdai
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.206.el6 Doc Type: Bug Fix
Doc Text:
Cause: management applications want to know whether tray is open or closed Consequence: management applications have difficulties changing media at the right time for the guest Change: extend monitor command "info block" to show tray open/closed status Result: management applications can poll "info block" to see when tray opens and closes. Turns out QE finds this useful, too. Management applications would like to be notified on change so they don't have to poll, but that's bug 575159.
Story Points: ---
Clone Of:
: 723272 (view as bug list) Environment:
Last Closed: 2011-12-06 15:53:57 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: 725673, 742458, 748554    

Description Dan Kenigsberg 2011-07-19 14:46:43 UTC
Management may want to remove cdrom media and throw it away if the guest OS has ejected it. Please report the tray status of cdrom devices.

This is required to avoid changed behavior (aka regression) due to the resolution of bug 558256.

Comment 1 Dan Kenigsberg 2011-07-19 14:52:16 UTC
It would be nice to be notified immediately (event) when a change occurs.

Comment 2 Luiz Capitulino 2011-07-20 13:00:16 UTC
Just for reference, the bz for the event is bug 575159.

Comment 3 Markus Armbruster 2011-07-20 16:53:56 UTC
Re comment#1: Yes, that would be nice, but it's bug 575159.  This bug is about enabling polling, not events.  Events are preferable, but may not be ready in time.

Comment 4 Markus Armbruster 2011-07-20 16:57:47 UTC
I just posted a patch series upstream that improves info block to show whether the tray is open, like this:

(qemu) info block
disk0: removable=0 file=/home/armbru/work/images/test.qcow2 backing_file=test.img ro=0 drv=qcow2 encrypted=0
cd: removable=1 locked=0 ejected file=x.iso ro=1 drv=raw encrypted=0

http://lists.gnu.org/archive/html/qemu-devel/2011-07/msg01925.html

Comment 5 Markus Armbruster 2011-08-09 13:48:59 UTC
Upstream fix is still under review.  It's part of the same series as the upstream fix for bug 676528.  Match is destined for extra time; requesting exception.

Comment 6 Dor Laor 2011-09-13 11:39:35 UTC
Is there a matching libvirt bugzilla? Otherwise it won't get into end-to-end rhev solution

Comment 7 Luiz Capitulino 2011-09-13 12:33:25 UTC
The libvirt one is bug 725673, which is listed in the "Blocks" field.

However, Daniel has reported on bug 575159 that the fix suggested here is not enough for libvirt. So, maybe this could be closed as invalid.

Comment 13 Markus Armbruster 2011-09-26 15:31:24 UTC
Fixed upstream in commit e4def80b block: Show whether the virtual tray is open in info block.

RFC backport posted:
http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-September/msg00677.html

Testing in progress.

Comment 15 juzhang 2011-09-30 08:50:40 UTC
According to our test results. 
with comment13 patch,info block includes tray-open option.add this issue into tracker bug(bz742458)

Comment 19 Shaolong Hu 2011-10-19 02:45:24 UTC
Reproduce on qemu-kvm-0.12.1.2-2.196.el6.x86_64:

Steps:
-------
1.boot a guest, in qemu monitor:
(qemu) info block
drive-virtio-disk0: type=hd removable=0 file=RHEL-Server-6.2-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]

(qemu) change ide1-cd0 RHEL6.1-20110510.1-Server-x86_64-DVD1.iso

(qemu) info block
drive-virtio-disk0: type=hd removable=0 file=RHEL-Server-6.2-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 file=RHEL6.1-20110510.1-Server-x86_64-DVD1.iso ro=1 drv=raw encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]

2.in guest, eject the cdrom, then in qemu monitor:
(qemu) info block
drive-virtio-disk0: type=hd removable=0 file=RHEL-Server-6.2-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 file=RHEL6.1-20110510.1-Server-x86_64-DVD1.iso ro=1 drv=raw encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]



Verified on qemu-kvm-0.12.1.2-2.199.el6.x86_64:

1.after step 1:
(qemu) change ide1-cd0 RHEL6.1-20110510.1-Server-x86_64-DVD1.iso
(qemu) info block
drive-virtio-disk0: removable=0 file=RHEL-Server-6.2-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: removable=1 locked=0 tray-open=0 file=RHEL6.1-20110510.1-Server-x86_64-DVD1.iso ro=1 drv=raw encrypted=0
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]

2.after step 2:
(qemu) info block
drive-virtio-disk0: removable=0 file=RHEL-Server-6.2-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: removable=1 locked=0 tray-open=1 file=RHEL6.1-20110510.1-Server-x86_64-DVD1.iso ro=1 drv=raw encrypted=0
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]

Comment 22 Eduardo Habkost 2011-10-28 17:58:30 UTC
Moving to ON_QA because Errata Tool did not do it

Comment 24 Markus Armbruster 2011-11-18 10:38:59 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: management applications want to know whether tray is open or closed
Consequence: management applications have difficulties changing media at the right time for the guest
Change: extend monitor command "info block" to show tray open/closed status
Result: management applications can poll "info block" to see when tray opens and closes.  Turns out QE finds this useful, too.  Management applications would like to be notified on change so they don't have to poll, but that's bug 575159.

Comment 25 errata-xmlrpc 2011-12-06 15:53:57 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.

http://rhn.redhat.com/errata/RHSA-2011-1531.html