Bug 691372

Summary: No default ide1-cd0 cdrom device for guest when using ide drive
Product: Red Hat Enterprise Linux 6 Reporter: Shaolong Hu <shu>
Component: qemu-kvmAssignee: Markus Armbruster <armbru>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 6.1CC: juzhang, michen, mkenneth, tburke, virt-maint
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: 2011-03-28 14:53:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Shaolong Hu 2011-03-28 11:32:59 UTC
Description of problem:
------------------------
Boot guest with ide drive, there is no default ide1-cd0 cdrom device of info block output in qemu monitor.


Version-Release number of selected component (if applicable):
--------------------------------------------------------------
2.6.32-125.el6.x86_64
qemu-kvm-0.12.1.2-2.152.el6.x86_64


How reproducible:
-----------------
100%


Steps to Reproduce:
--------------------
1. Boot guest with:
#qemu-kvm -M rhel6.1.0 -enable-kvm -m 4G -smp 4 -name rhel6.1-32 -uuid `uuidgen` -drive file=/dev/mapper/vg_shutest2-lv_guest,if=none,cache=none,format=qcow2,rerror=stop,werror=stop,id=ide-disk0 -device ide-drive,drive=ide-disk0 -netdev tap,script=/etc/qemu-ifup,id=net0,vhost=on -device virtio-net-pci,netdev=net0,mac=00:1E:4F:D3:EF:99 -balloon virtio -usb -device usb-tablet -monitor stdio -spice port=5910,disable-ticketing

2. In qemu monitor:
(qemu) info block

  
Actual results:
----------------
(qemu) info block
ide-disk0: type=hd removable=0 file=/dev/mapper/vg_shutest2-lv_guest ro=0 drv=qcow2 encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]


Expected results:
------------------
There should be:
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]


Additional info:
-----------------
Boot guest with the same cmdline, change ide-drive to virtio-blk-pci, works fine.

Comment 2 Dor Laor 2011-03-28 14:53:32 UTC
I doubt that's a real bug. What happens when you spawn this through virt manager? IMHO the regular IDE drive and the cdrom IDE conflicts.
Please retest and I'll close the bug for the moment. Please reopen it if virt manager fails as well.

Comment 3 Markus Armbruster 2011-03-31 12:13:52 UTC
QEMU can provide three default drives:

* CD-ROM, IDE or SCSI depending on machine type, IDE for PC-like machines
* Floppy
* SD card

Whether the drives are actually used by a guest device depends on the machine type.  For instance, PC-like machines don't use the SD card default drive.

The machine type can suppress any of them.  PC-like machines don't. Arguably, they should suppress the drives they don't use.

Some configuration options suppress default drives:

* -nodefaults suppresses all of them
* -device isa-fdc suppresses floppy
* -device ide-drive suppresses CD-ROM

Note: [device] sections in configuration files read with -readconfig work exactly like -device.

The recipe in comment#0 has -device ide-drive, which suppresses the CD-ROM.

With the recipe changed as per additional info (virtio-blk-pci instead of ide-drive), there's no CD-ROM suppressor left, so we get one.

Works as designed :)

Comment 4 Shaolong Hu 2011-03-31 12:17:14 UTC
(In reply to comment #2)
> I doubt that's a real bug. What happens when you spawn this through virt
> manager? IMHO the regular IDE drive and the cdrom IDE conflicts.
> Please retest and I'll close the bug for the moment. Please reopen it if virt
> manager fails as well.

Finding this while testing a case against bug 581789, in its reproduction, there is default cdrom device when use ide-drive, however the version of qemu-kvm is a little old.

With Virt manager, i cannot see cdrom in the guest both with virtio-blk-device or ide-drive, and also when query-block through QMP, i believe this is caused by virt manager adding -nodefaults parameter, qemu-kvm won't add default cdrom and 2 floppy device to guest with this parameter, as far as i know, there is no way to delete it.

Comment 5 Shaolong Hu 2011-03-31 12:27:21 UTC
With Markus comment, i think we can modify the test case to: add a not-insert cdrom manually instead of using the default one. Thanks.