Bug 886878

Summary: atapi: tray statuses (locked and open) are not reset on boot/reboot of guest
Product: Red Hat Enterprise Linux 6 Reporter: Pavel Hrdina <phrdina>
Component: qemu-kvmAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: acathrow, areis, bsarathy, chayang, flang, juzhang, lnovich, michen, mkenneth, qzhang, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.373.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 05:59:08 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:

Description Pavel Hrdina 2012-12-13 13:12:20 UTC
Description of problem:

If you reboot a guest which locks the tray of optical drive the optical drive stay locked.

How reproducible: 100%


Steps to Reproduce:
1. Boot a guest with media inserted in optical drive (for example fedora 17)
2. The media is auto-mounted and the optical drive is locked
3. Reboot the guest.
4. Before kernel is loaded (in GRUB time) the optical drive is locked
  
Actual results:
Before kernel is loaded the optical drive is locked.


Expected results:
Optical drive should not be locked.

Comment 8 langfang 2013-06-26 06:59:26 UTC
Reproduce this bug as follow version:
Host:
# uname -r
2.6.32-392.el6.x86_64
# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.356.el6.x86_64

Guest:
2.6.32-358.el6.x86_64

Steps:
1.Boot guest with
...
-drive file=/home/RHEL6.4-20130123.0-Server-x86_64-DVD1.iso,if=none,media=cdrom,id=cdrom,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=cdrom,id=cdrom,id=cdrom...

2.After guest boot up,check the cdrom have mounted /dev/sr0. 
(qemu) info block
drive-virtio-disk1: removable=0 io-status=ok file=/home/RHEL-Server-6.4-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
cdrom: removable=1 locked=1 tray-open=0 io-status=ok file=/home/RHEL6.4-20130123.0-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]

3.Reboot guest 
(qemu)system_reset
4.Check the locked value of cdrom
(qemu)info block
drive-virtio-disk1: removable=0 io-status=ok file=/home/RHEL-Server-6.4-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
cdrom: removable=1 locked=1 tray-open=0 io-status=ok file=/home/RHEL6.4-20130123.0-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]

Results:
After step 4,before guest kernel is loaded the optical drive is locked.

Verify this bug as follow version:
HOst:
# uname -r
2.6.32-392.el6.x86_64
# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.376.el6.x86_64

Guest:
2.6.32-358.el6.x86_64

The steps as same as reproduce

Results:
While guest begin reboot, the locked value of cdrom changed to 0

cdrom: removable=1 locked=0 tray-open=0 io-status=ok file=/home/RHEL6.4-20130123.0-Server-x86_64-DVD1.iso ro=1 drv=raw encrypted=0

Addtional info:
1)If only boot guest ,the "locked value" is 0.
2)I aslo tried passthrough a cdrom wich ide-drive, the steps as same as reproduce, after reboot guest,the value changed to 0
...-drive file=/dev/sr0,if=none,media=cdrom,id=cdrom,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=cdrom,id=cdrom,id=cdrom,
3)Also tried use local cdrom with scsi-cd,work well

My CLI: /usr/libexec/qemu-kvm -monitor stdio  -chardev socket,id=serial_id_20120515-041452-KkUY,path=/tmp/serial-20120515-041452-KkUY,server,nowait -device isa-serial,chardev=serial_id_20120515-041452-KkUY -device ich9-usb-uhci1,id=usb1,bus=pci.0,addr=0x4 -drive file=/home/RHEL-Server-6.4-64-virtio.qcow2,index=0,if=none,id=drive-virtio-disk1,media=disk,cache=none,boot=on,snapshot=off,readonly=off,format=qcow2,aio=native -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1 -device virtio-net-pci,netdev=idLYjg29,mac=9a:6e:47:a6:d8:f9,id=ndev00idLYjg29,bus=pci.0,addr=0x3 -netdev tap,id=idLYjg29,vhost=on -m 2048 -smp 4,cores=2,threads=1,sockets=2 -cpu Penryn  -device usb-tablet,id=usb-tablet1,bus=usb1.0 -spice port=8000,disable-ticketing -vga qxl -rtc base=utc,clock=host,driftfix=slew -M rhel6.4.0 -boot order=cdn,once=c,menu=off    -no-kvm-pit-reinjection -enable-kvm -monitor unix:/tmp/monitor-unix,nowait,server -serial unix:/tmp/tty0,server,nowait -drive file=/home/RHEL6.4-20130123.0-Server-x86_64-DVD1.iso,if=none,id=drive-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi1,addr=0x8,bus=pci.0 -device scsi-cd,bus=scsi1.0,drive=drive-disk,id=cd-disk


According to above test ,this bug fixed.

Comment 11 langfang 2013-06-28 03:08:44 UTC
Addtional info for comment8.

On the verify version.
HOst:
# uname -r
2.6.32-392.el6.x86_64
# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.376.el6.x86_64

Guest:
2.6.32-358.el6.x86_64

Results:

 While guest begin reboot, the locked value of cdrom changed to 0--->after guest boot up , the value automatically changed to 1 .

Comment 12 Qunfang Zhang 2013-06-28 03:34:05 UTC
(In reply to langfang from comment #11)
> Addtional info for comment8.
> 
> On the verify version.
> HOst:
> # uname -r
> 2.6.32-392.el6.x86_64
> # rpm -q qemu-kvm
> qemu-kvm-0.12.1.2-2.376.el6.x86_64
> 
> Guest:
> 2.6.32-358.el6.x86_64
> 
> Results:
> 
>  While guest begin reboot, the locked value of cdrom changed to 0--->after
> guest boot up , the value automatically changed to 1 .

I think flang means when the cdrom is mounted automatically by the guest os, the "lock" flag changes to 1. Right?

Comment 13 langfang 2013-06-28 03:47:12 UTC
(In reply to Qunfang Zhang from comment #12)
> (In reply to langfang from comment #11)
> > Addtional info for comment8.
> > 
> > On the verify version.
> > HOst:
> > # uname -r
> > 2.6.32-392.el6.x86_64
> > # rpm -q qemu-kvm
> > qemu-kvm-0.12.1.2-2.376.el6.x86_64
> > 
> > Guest:
> > 2.6.32-358.el6.x86_64
> > 
> > Results:
> > 
> >  While guest begin reboot, the locked value of cdrom changed to 0--->after
> > guest boot up , the value automatically changed to 1 .
> 
> I think flang means when the cdrom is mounted automatically by the guest os,
> the "lock" flag changes to 1. Right?

 qzhang, yes .

Comment 15 errata-xmlrpc 2013-11-21 05:59:08 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-2013-1553.html