Bug 709585 - qemu-kvm can not start with /dev/sr0 if no media in physical cdrom
qemu-kvm can not start with /dev/sr0 if no media in physical cdrom
Status: CLOSED DEFERRED
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kvm (Show other bugs)
5.7
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Markus Armbruster
Virtualization Bugs
:
Depends On:
Blocks: Rhel5KvmTier2
  Show dependency treegraph
 
Reported: 2011-06-01 01:52 EDT by Mike Cao
Modified: 2014-06-28 07:28 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-08-10 16:15:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mike Cao 2011-06-01 01:52:55 EDT
Description of problem:
,do not insert media in physical cdrom  ,try to start guest with -cdrom /dev/sr0 ,qemu-kvm could not start 

Version-Release number of selected component (if applicable):
# uname -r
2.6.18-264.el5
# rpm -q kvm
kvm-83-235.el5

How reproducible:
100%

Steps to Reproduce:
1.Do not insert any media in physical cdrom
2.start guest with -drive file=/dev/sr0,if=ide,media=cdrom
eg:/usr/libexec/qemu-kvm -M rhel5.6.0 -m 2048 -smp 4,sockets=4,cores=1,threads=1 -name RHEL6u1 -uuid 7c9a4b2c-8d58-6771-7748-0ce92bfd83f7 -monitor stdio -no-kvm-pit-reinjection -boot dc -drive file=/dev/stress/rhel6u1,if=virtio,boot=on,format=raw,cache=none -drive file=/dev/cdrom,if=ide,format=raw,cache=none,media=cdrom,bus=1,unit=0 -net nic,macaddr=54:52:00:7d:dd:37,vlan=0,model=virtio -net tap,vlan=0,downscript=no -serial pty -parallel none -usb -usbdevice tablet -vnc :2 -k en-us -vga cirrus -balloon none -notify all
  
Actual results:
qemu-kvm can not start with error :
qemu: could not open disk image /dev/cdrom

Expected results:
qemu-kvm could start 

Additional info:
Tried with /usr/libexec/qemu-kvm -cdrom /dev/sr0  ,does not hit this issue.
Comment 1 Mike Cao 2011-06-01 04:48:54 EDT
more info :

keep the tray open on the host ,start guest with 
/usr/libexec/qemu-kvm -drive file=/dev/sr0,if=ide,media=cdrom

Actual Results: the tray will auto-closed.

keep the tray open on the host ,start guest with 
/usr/libexec/qemu-kvm -cdrom /dev/sr0

Actual Restuls: the tray will *not* close
Comment 2 Markus Armbruster 2011-08-09 04:16:14 EDT
"-cdrom /dev/sr0" is shorthand for "-drive file=/dev/sr0,if=ide,index=2,media=cdrom".  Differences to the failing test case: lacks format=raw,cache=none, uses index=2 instead of bus=1,unit=0.  In my testing, format=raw causes the failure.
Comment 3 Markus Armbruster 2011-08-09 04:31:02 EDT
Without "format=raw", we get driver "host_device", which does the right thing for /dev/sr0.

"format=raw" overrides that: we get driver "raw", which can't cope with host devices.  In particular, it can't cope with ENOMEDIUM.
Comment 4 Markus Armbruster 2011-08-09 04:37:31 EDT
Mike, does libvirt use format=raw with file=/dev/sr0?

Could you give me the relevant part of the domain XML?  Should be an element <disk> within element <devices>.
Comment 5 Mike Cao 2011-08-09 05:13:00 EDT
(In reply to comment #4)
> Mike, does libvirt use format=raw with file=/dev/sr0?
> 
> Could you give me the relevant part of the domain XML?  Should be an element
> <disk> within element <devices>.

yes .

this is the CLI generates by virt-manager

 /usr/libexec/qemu-kvm -S -M rhel5.4.0 -m 512 -smp 1,sockets=1,cores=1,threads=1 -name tt -uuid 77b30b96-b94b-89ac-e641-fc5c4d5fe71a -monitor unix:/var/lib/libvirt/qemu/tt.monitor,server,nowait -localtime -no-kvm-pit-reinjection -no-reboot -boot dc -drive file=/var/lib/libvirt/images/tt.img,if=ide,bus=0,unit=0,boot=on,format=raw,cache=none -drive file=/dev/sr0,if=ide,media=cdrom,bus=1,unit=0,readonly=on,format=raw -net nic,macaddr=54:52:00:79:fc:ab,vlan=0 -net tap,fd=20,vlan=0 -serial pty -parallel none -usb -usbdevice tablet -vnc 127.0.0.1:0 -k en-us -vga cirrus -balloon virtio
Comment 6 Mike Cao 2011-08-09 05:14:15 EDT
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sr0'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
Comment 7 Markus Armbruster 2011-08-09 05:20:07 EDT
Note type='raw' in comment#6.  Apparently, virt-manager creates it that way.  Hmm.
Comment 8 Markus Armbruster 2011-08-09 05:28:12 EDT
Summary of findings so far:

format=raw doesn't work with /dev/sr0.  Omitting format=raw works.  format=host_device works.

Apparently, virt-manager specifically asks for "raw".

Things are different in RHEL-6: format=raw works, format=host_device doesn't, format=host_cdrom does (doesn't exist in RHEL-5).
Comment 10 James B. Byrne 2014-02-13 12:29:30 EST
RHEl6
qemu-kvm-0.12.1.2-2.4-15.el6_5.3
virt-manager.x86_64-0.9.0-19.el6
Guest OS = MS-WinV7proSP1 (updated to date)


The guest OS installed without difficulty via virt-manager. The guest responded to console commands and mouse actions, obtained network access and was updated.  Subsequent to the controlled shutdown of the guest system and power down of the vm the guest image fails to start giving instead this error:

virsh start brws-ms-v7-37v.brockley.harte-lyne.ca
error: Failed to start domain brws-ms-v7-37v.brockley.harte-lyne.ca
error: cannot open file '/dev/sr0': No medium found

Examination of the guest configuration file shows this:

     30     <disk type='block' device='cdrom'>
     31       <driver name='qemu' type='raw'/>
     32       <source dev='/dev/sr0'/>
     33       <target dev='hdc' bus='ide'/>
     34       <readonly/>
     35       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     36     </disk>

Despite the inference I draw from the above bug report, that the <driver> tag attribute 'format' actually refers to the attribute 'type' as the attribute format' is not found anywhere in the guest configuration file, one cannot in fact change the driver attribute 'type' to any value other than raw. Any attempt to do so results in this message:

unsupported configuration: unknown driver format value 'host_cdrom'
Failed. Try again? [y,n,f,?]:

Further, the value 'f' is not permitted so one cannot forcibly save the
configuration to determine if in fact it might work.

Is this a regression?
Comment 11 James B. Byrne 2014-02-13 12:44:21 EST
P.S.  Loading a medium into the CDROM device permits the guest to start normally.
Comment 12 Mike Cao 2014-02-13 19:43:38 EST
(In reply to James B. Byrne from comment #10)
> RHEl6
> qemu-kvm-0.12.1.2-2.4-15.el6_5.3
> virt-manager.x86_64-0.9.0-19.el6
> Guest OS = MS-WinV7proSP1 (updated to date)
> 

This bug is used to track RHEL5 kVM bug  ,pls report it on RHEL6 against qemu-kvm component if you think it is a bug
Comment 13 David Tonhofer 2014-05-16 06:14:18 EDT
Happens on Fedora 20, too. 

qemu-kvm-1.6.2-4.fc20.x86_64
virt-manager-1.0.1-3.fc20.noarch
Guest OS = MS-WinV7proSP1 (updated to date)


# virsh dumpxml win7

....
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sr0'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
....
Comment 14 Nerijus Baliūnas 2014-06-28 07:28:00 EDT
Bug 1065480 is reported against F20.

Note You need to log in before you can comment on or make changes to this bug.