Bug 946993

Summary: Q35 does not honor -drive if=ide,... and its sugared forms -cdrom, -hda, ...
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvm-rhevAssignee: John Snow <jsnow>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: armbru, chayang, hhuang, juli, juzhang, knoel, kraxel, kwolf, mazhang, michen, pbonzini, qzhang, rbalakri, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.1.2-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 09:42:19 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 Sibiao Luo 2013-04-01 06:48:32 UTC
Description of problem:
when i install guest under Q35 with '-cdrom ...', but fail to detect CD-ROM device in seabios.
btw,
1.if i use '-cdrom ...' under 'pc-i440fx-1.4' machine type, it have no such issue, it can etect CD-ROM device in seabios correctly.
2.if i use the '-drive file=...media=cdrom,readonly=on -device ide-cd ...' under Q35, it also have no such issue, it can etect CD-ROM device in seabios sucessfully.

Version-Release number of selected component (if applicable):
host info:
kernel-3.9.0-0.rc4.45.el7.x86_64
qemu-kvm-1.4.0-1.el7.x86_64
seabios-1.7.2-0.2.gita810e4e7.el7.x86_64
guest info:
windows_server_2012_x64

How reproducible:
100%

Steps to Reproduce:
1.install guest under Q35 with '-cdrom ...' + '-boot menu=on'.
e.g:# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 ... -boot menu=on -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio -fda /usr/share/virtio-win/virtio-win-1.6.3_amd64.vfd -cdrom /home/en_windows_server_2012_x64_dvd_915478.iso
2.press F12 during POST.
3.select the CD-ROMs to install the guest.

Actual results:
after step 2, there is no DVD/CD device in boot menu,
 
Press F12 for boot menu.

Select boot device:

1. virtio-scsi Drive QEMU HARDDISK 1.4.
2. Legacy option rom
3. Floppy [drive A]
4. iPXE (PCI 00:05.0)

Expected results:
there should list the DVD/CD device in boot menu.
1. virtio-scsi Drive QEMU HARDDISK 1.4.
2. Legacy option rom
3. Floppy [drive A]
4. iPXE (PCI 00:05.0)
5. DVD/CD [ata1-0 .... DVD/CD]     <----------for example

Additional info:

Comment 1 Sibiao Luo 2013-04-01 06:53:25 UTC
we can see the cdrom use the IDE interface under Q35 with '-cdrom ...' .
(qemu) info block
drive-system-disk: removable=0 io-status=ok file=/home/windows_server_2012_x64.raw ro=0 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
floppy0: removable=1 locked=0 tray-open=0 file=/usr/share/virtio-win/virtio-win-1.6.3_amd64.vfd ro=0 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
ide1-cd0: removable=1 locked=0 tray-open=0 file=/home/en_windows_server_2012_x64_dvd_915478.iso ro=1 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
sd0: removable=1 locked=0 tray-open=0 [not inserted]

Comment 2 Paolo Bonzini 2013-05-06 15:53:26 UTC
The AHCI adapter and the Q35 board lack calls to ide_create_drive and drive_get respectively.

Reassigning to Kevin since he worked on other AHCI -drive bugs, and the fix is relatively trivial.

Comment 3 Ademar Reis 2013-12-06 17:24:05 UTC
discussion happening upstream (IDE vs AHCI for cd-roms in Q35). Leaving it for 7.1.0 as Q35 is tech-preview.

Comment 5 Markus Armbruster 2014-07-24 06:39:19 UTC
Q35 does not honor -drive if=ide (see comment#2).  '-cdrom F' is sugar
for '-drive if=ide,index=2,file=F,media=cdrom'.  -hda & friends is
similar sugar, see vl.c for details.

You don't need SeaBIOS to observe that, info qtree suffices.  Summary
updated.

-drive creates a backend, visible in "info block".  With if=ide, it
additionally posts a request to the board code to create the
appropriate frontend.  It's up to the board to honor it.  i440FX does,
Q35 doesn't.

-device ide-hd,.. works differently: board-independent code creates
the IDE device and plugs it into a suitable socket if it finds one.
Same for ide-cd.

Suitable sockets may be provided by onboard controllers created by
board code or additional controllers created with -device.  You can
constrain the choice by specifying bus, unit with -device.

i440FX's onboard controller is PATA.  Q35's is SATA.  -device doesn't
care; both provide the same kind of plug for ide-{hd,cd}.

A system may have both PATA and SATA controllers.  If you care about
the kind of controller, pick one by specifying bus=... with -device.

The reason why Q35 doesn't honor if=ide requests is lack of upstream
consensus on what the request should mean: always PATA, or leave the
choice to the board.  I'm in the "leave it to the board" camp.  Kevin
has arguments for "always PATA".

If "always PATA", then we need to implement ICH9 legacy PATA mode for
it to work.

If "leave it to the board", we need to rethink the mapping between
index and (bus,unit), which differs between PATA and SATA.

A possible compromise is a machine option controlling ICH9 legacy PATA
mode.  Q35 would then use PATA for if=ide if and only if the option is
enabled.

Comment 6 Markus Armbruster 2014-07-28 11:01:47 UTC
*** Bug 1056900 has been marked as a duplicate of this bug. ***

Comment 7 Miroslav Rezanina 2014-10-24 16:17:58 UTC
Fix included in qemu-kvm-rhev-2.1.2-5.el7

Comment 9 mazhang 2014-10-30 08:18:17 UTC
Reproduce this bug on qemu-kvm-rhev-2.1.2-3.el7.x86_64.

Host:
qemu-kvm-rhev-2.1.2-3.el7.x86_64
qemu-kvm-tools-rhev-2.1.2-3.el7.x86_64
qemu-kvm-common-rhev-2.1.2-3.el7.x86_64
qemu-kvm-rhev-debuginfo-2.1.2-3.el7.x86_64
qemu-img-rhev-2.1.2-3.el7.x86_64
kernel-3.10.0-191.el7.x86_64
seabios-bin-1.7.5-5.el7.noarch

Command line:
/usr/libexec/qemu-kvm \
-M q35 \
-cpu SandyBridge \
-m 2G \
-smp 4,maxcpus=160,cores=2,threads=1,sockets=2 \
-enable-kvm \
-name rhel7 \
-uuid 990ea161-6b67-47b2-b803-19fb01d30d12 \
-smbios type=1,manufacturer='Red Hat',product='RHEV Hypervisor',version=el6,serial=koTUXQrb,uuid=feebc8fd-f8b0-4e75-abc3-e63fcdb67170 \
-k en-us \
-rtc base=localtime,clock=host,driftfix=slew \
-nodefaults \
-monitor stdio \
-qmp tcp:0:5555,server,nowait \
-boot menu=on \
-bios /usr/share/seabios/bios.bin \
-monitor unix:/tmp/monitor2,server,nowait \
-vga qxl \
-spice port=5900,disable-ticketing \
-usb \
-device usb-tablet,id=tablet0 \
-drive file=gluster://10.66.106.25/gv0/rhel7-64.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,werror=stop,rerror=stop,aio=threads \
-device virtio-blk-pci,scsi=off,bus=pcie.0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-netdev tap,id=hostnet0,vhost=on \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:01:02:B6:40:21 \
-cdrom /home/boot.iso \
-chardev socket,id=seabios,path=/tmp/seabios,server,nowait \
-device isa-debugcon,chardev=seabios,iobase=0x402 \

Result:
Searching bootorder for: /pci@i0cf8/*@3
Searching bootorder for: /rom@genroms/kvmvapic.bin

Press F12 for boot menu.

Select boot device:

1. Virtio disk PCI:0:2
2. Legacy option rom
3. iPXE (PCI 00:03.0)


Verified this bug on qemu-kvm-rhev-2.1.2-5.el7.x86_64.


Result:
DVD/CD device list in boot menu.

Searching bootorder for: /pci@i0cf8/*@3
Searching bootorder for: /rom@genroms/kvmvapic.bin

Press F12 for boot menu.

Select boot device:

1. Virtio disk PCI:0:2
2. Legacy option rom
3. DVD/CD [AHCI/2: QEMU DVD-ROM ATAPI-4 DVD/CD]
4. iPXE (PCI 00:03.0)


This bug has been fixed.

Comment 10 mazhang 2014-10-30 08:24:40 UTC
Test with -hda also works well.

Command line:
-cdrom /home/boot.iso \
-chardev socket,id=seabios,path=/tmp/seabios,server,nowait \
-device isa-debugcon,chardev=seabios,iobase=0x402 \
-hda /home/storage0.qcow2 \


Result:
Searching bootorder for: /pci@i0cf8/*@2
Searching bootorder for: /rom@genroms/kvmvapic.bin

Press F12 for boot menu.

Select boot device:

1. AHCI/0: QEMU HARDDISK ATA-7 Hard-Disk (30720 MiBytes)
2. Legacy option rom
3. DVD/CD [AHCI/2: QEMU DVD-ROM ATAPI-4 DVD/CD]
4. iPXE (PCI 00:02.0)

Comment 13 errata-xmlrpc 2015-03-05 09:42:19 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.

https://rhn.redhat.com/errata/RHSA-2015-0624.html