Bug 742446

Summary: info block show "locked=0" even when this cdrom device has mounted to /media
Product: Red Hat Enterprise Linux 6 Reporter: juzhang <juzhang>
Component: qemu-kvmAssignee: Markus Armbruster <armbru>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.2CC: acathrow, areis, armbru, bsarathy, chayang, michen, mkenneth, phrdina, shuang, tburke, 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: 2012-12-13 13:14:46 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:
Attachments:
Description Flags
anaconda-ks.cfg log
none
install log none

Description juzhang 2011-09-30 07:41:45 UTC
Description of problem:
(qemu) info block
drive-ide0-1-0: type=cdrom removable=1 locked=0 file=/home/RHEL6.2-Server-x86_64.iso ro=1 drv=raw encrypted=0

info bock show "locked=0" even when this cdrom device has mounted to /media

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.193.el6.x86_64
guest kernel
#uname -r
2.6.32-195.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
1.Boot guest
#/usr/libexec/qemu-kvm  -no-kvm-pit-reinjection -rtc-td-hack -m 1G -smp 1 -M rhel6.2.0 -drive file=/home/timerdevice/rhel62-guest-new.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,werror=stop,rerror=stop,cache=none,aio=native -device virtio-blk-pci,drive=drive-virtio0-0-0,id=virti0-0-0,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:56:00:94:a3:21 -uuid 9e6f04cf-2ad7-45aa-9333-2d2ee26570c6 -balloon none -monitor stdio -vnc :10 
/ emulation cdrom
-drive file=/home/RHEL6.2-Server-x86_64.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw 
-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0 
/
-device usb-ehci,id=ehci -drive if=none,id=usbstick,file=/root/usb.qcow2 -device usb-storage,bus=ehci.0,drive=usbstick -drive file=/root/floppy1.qcow2,readonly=on,if=none,id=drive-fdc0-0-0 -global isa-fdc.driveA=drive-fdc0-0-0
2.(qemu) info block,please note locked=0
--------
drive-ide0-1-0: type=cdrom removable=1 locked=0 file=/home/RHEL6.2-Server-x86_64.iso ro=1 drv=raw encrypted=0


3.in guest
 mount
....................................
/dev/sr0 on /media/RHEL_6.2 x86_64 Disc 1 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500)

  
Actual results:
locked=0

Expected results:
locked=1

Additional info:
if I mount manually,the locked=1
in guest
mount /dev/sr0 /mnt/

(qemu) info block
drive-ide0-1-0: type=cdrom removable=1 locked=1 file=/home/RHEL6.2-Server-x86_64.iso ro=1 drv=raw encrypted=0

Comment 1 Markus Armbruster 2011-09-30 08:26:45 UTC
We need to figure out whether this is a virtualization problem or a general problem.  Let's try to reproduce on a physical machine.

We need to observe the state of the drive's tray lock.  The obvious way to do that is to press the physical eject button.  If nothing happens, the tray is locked.

Complication: software can react to the button press, and unlock the tray.  I don't know whether RHEL-6 does that.

Suggested test:

1. Boot physical machine similar to the virtual one, i.e. with a CD containing an ISO filesystem in the drive.

2. Verify that filesystem got mounted automatically.

3. Press the eject button.  Does the tray open?

4. Unmount the filesystem if it's mounted.  Close the tray if it's open.

5. Mount the filesystem manually.

6. Press the eject button.  Does the tray open?

If the tray opens in step 3 and doesn't open in step 6, we can be pretty sure the automatic mount during boot didn't lock the drive, but the manual mount in step 5 did.

If the tray opens neither in step 3 nor in step 6, we can be pretty sure both mounts locked the drive.

If the tray opens in both steps, we need to dig deeper.

If the tray doesn't open in step 3 and does open in step 6, I'm confused, and we need to dig deeper.

Comment 2 juzhang 2011-10-08 08:00:37 UTC
I tried twice,please have a look the following infos.
#uname -r
2.6.32-191.el6.x86_64
> 1. Boot physical machine similar to the virtual one, i.e. with a CD containing
> an ISO filesystem in the drive.
> 
> 2. Verify that filesystem got mounted automatically.
Yes,mounted automatically
#mount
/dev/sr0 on /media/CDROM type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500)

> 
> 3. Press the eject button.  Does the tray open?
> 
After press the eject button,the tray doesn't open.
> 4. Unmount the filesystem if it's mounted.  Close the tray if it's open.
#umount /media/CDROM
Unmount the filesystem,then press the the eject button,the tray open,then close the tray.

> 
> 5. Mount the filesystem manually.
mount the filesystem manually.
#mount /dev/sr0 /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only
#mount
/dev/sr0 on /media/CDROM type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500)
/dev/sr0 on /mnt type iso9660 (ro)

#
> 
> 6. Press the eject button.  Does the tray open?
> 
After press the eject button,the tray doesn't open.
> If the tray opens in step 3 and doesn't open in step 6, we can be pretty sure
> the automatic mount during boot didn't lock the drive, but the manual mount in
> step 5 did.
Neither open in step 3 and step6.
> 
> If the tray opens neither in step 3 nor in step 6, we can be pretty sure both
> mounts locked the drive.
> 
Neither open in step 3 and step6.

Comment 3 juzhang 2011-10-08 08:04:54 UTC
> > 4. Unmount the filesystem if it's mounted.  Close the tray if it's open.
> #umount /media/CDROM
> Unmount the filesystem,then press the the eject button,the tray open,then close
> the tray.
> 
Re-parse these sentence in order to don't bring misunderstandings .
1.#umount /media/CDROM
2.then I press the the eject button,the tray open.
3.I press the the eject button again,the tray close

Comment 5 Markus Armbruster 2012-03-02 13:02:05 UTC
I tried to reproduce this with a freshly installed 6.2 guest (standard server install), no luck.  I suspect your guest runs something that I don't run.  To help me over this hump, please do a fresh install, reproduce the bug, and send me the anaconda-ks.cfg and install.log.

Comment 7 FuXiangChun 2012-03-05 06:37:01 UTC
(In reply to comment #5)
> I tried to reproduce this with a freshly installed 6.2 guest (standard server
> install), no luck.  I suspect your guest runs something that I don't run.  To
> help me over this hump, please do a fresh install, reproduce the bug, and send
> me the anaconda-ks.cfg and install.log.


I tested this bug and got the same result with comment 2. Neither open in step 3 and step 6.  "info block" got locked=0 in step 3, and  "info block" got locked=1 in step 6.

Comment 8 FuXiangChun 2012-03-05 06:39:30 UTC
Created attachment 567486 [details]
anaconda-ks.cfg log

Comment 9 FuXiangChun 2012-03-05 06:39:55 UTC
Created attachment 567487 [details]
install log

Comment 11 Ademar Reis 2012-07-02 20:07:57 UTC
My two cents:

Tested f17 host with a f16 guest.

 - locked=0 at grub in the first boot
 - locked=1 during boot time (changes while loading the kernel)
 - locked=1 all the time after a reboot (even at grub)

Comment 12 RHEL Program Management 2012-07-10 06:05:50 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 13 RHEL Program Management 2012-07-11 02:00:57 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 15 Pavel Hrdina 2012-11-21 16:11:15 UTC
I've been investigating this issue and the bug is not in qemu-kvm but in Nautilus or Gnome. If the media is automounted by nautilus the optical drive stay unlocked. If you turn off automount in Gnome using gconf-editor and after that try to mount media using Nautilus the optical drive stay unlocked too.

I tried this also using KDE an there is not this bug. KDE did not automatically mount the inserted media and if I opened them by Dolphin the optical drive changed status from unlocked to locked.

Comment 16 Pavel Hrdina 2012-11-29 16:18:44 UTC
I've done some deeper investigation and I find out that the media is not locked is a feature of udisks to enable the HW eject button.

And another interesting think is that for some physical drives udisks using detection by polling and for others it is not using detection by polling. And there is the difference. If detection by polling is used, then the optical drive is not locked, otherwise it is locked.

This is probably not a bug at all.

I'll test the issue mentioned by Ademar in Comment #11