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.
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
"-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.
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.
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>.
(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
<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>
Note type='raw' in comment#6. Apparently, virt-manager creates it that way. Hmm.
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).
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?
P.S. Loading a medium into the CDROM device permits the guest to start normally.
(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
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> ....
Bug 1065480 is reported against F20.