Bug 922670

Summary: the seabios only can detect one CD-ROM/hard disk when install/boot guest with multiple CD-ROMs/hard disks using AHCI (Q35)
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: acathrow, armbru, chayang, flang, hhuang, juzhang, knoel, kwolf, michen, mrezanin, mst, pbonzini, qiguo, qzhang, rhod, shuang, sluo, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.0-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 12:21:42 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:
Attachments:
Description Flags
AHCI screenshot.
none
IDE screenshot.
none
SCSI screenshot. none

Description Sibiao Luo 2013-03-18 09:22:24 UTC
Description of problem:
Install guest with multiple CD-ROMs using AHCI (Q35), the seabios only can detect one CD-ROMs. BTW, I tried the scsi-cd/IDE, they have no such issue, just the AHCI have this issue.

Version-Release number of selected component (if applicable):
host info:
kernel-3.8.0-0.40.el7.x86_64
qemu-kvm-1.4.0-1.el7.x86_64
seabios-bin-1.7.2-0.2.gita810e4e7.el7.noarch
seabios-1.7.2-0.2.gita810e4e7.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Install guest with multiple CD-ROMs using AHCI (Q35) + "-boot menu=on".
e.g:# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge -enable-kvm -m 2048 -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -device usb-mouse,id=mouse -name sluo-test -uuid b03eea94-a502-4142-b541-96f86473a07a -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pcie.0,addr=0x3 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2 -drive file=/home/test-image.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,id=scsi0,addr=0x4 -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk -netdev tap,id=hostnet0,vhost=off,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2E:5F:0A:1D:B1,bus=pcie.0,addr=0x5,event_idx=off -device virtio-balloon-pci,id=ballooning,bus=pcie.0,addr=0x7 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -k en-us -boot menu=on -vnc :1 -monitor stdio -drive file=/usr/share/virtio-win/virtio-win-1.6.3_amd64.vfd,if=none,id=drive-fdc0-0-0,format=raw -global isa-fdc.driveA=drive-fdc0-0-0 -drive file=/home/en_windows_server_2012_x64_dvd_915478.iso,if=none,id=drive-cd-disk1,media=cdrom,format=raw,cache=none -device ide-cd,drive=drive-cd-disk1,id=cd-disk1,unit=0 -drive file=/home/en_windows_8_enterprise_x64_dvd_917522.iso,if=none,id=drive-cd-disk2,media=cdrom,format=raw,cache=none -device ide-cd,drive=drive-cd-disk2,id=cd-disk2,unit=1
2.press F12 during POST.
3.select one of the CD-ROMs to install guest.

Actual results:
after step 2, there is only one CD-ROM device in boot menu, i will attach the screenshot later.
 
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. DVD/CD [AHCI/5: QEMU DVD-ROM ATAPI-4 DVD/CD]
5. iPXE (PCI 00:05.0)

after 3, select 4, only can install windows_server_2012_x64.

Expected results:
Two of the CD-ROMs can be detected in boot menu, and can select one of it to install guest, like:
1. virtio-scsi Drive QEMU HARDDISK 1.4.
2. Legacy option rom
3. Floppy [drive A]
4. DVD/CD [AHCI/5: QEMU DVD-ROM ATAPI-4 DVD/CD]   <------ ONE
4. DVD/CD [AHCI/5: QEMU DVD-ROM ATAPI-4 DVD/CD]   <------ TWO
6. iPXE (PCI 00:05.0)

Additional info:
1.if  the IDE.
e.g:/usr/libexec/qemu-kvm -S -M pc-i440fx-1.4...-drive file=/usr/share/virtio-win/virtio-win-1.6.3_amd64.vfd,if=none,id=drive-fdc0-0-0,format=raw -global isa-fdc.driveA=drive-fdc0-0-0 -drive file=/home/en_windows_server_2012_x64_dvd_915478.iso,if=none,id=drive-cd-disk1,media=cdrom,format=raw,cache=none -device ide-cd,drive=drive-cd-disk1,id=cd-disk1,unit=0 -drive file=/home/en_windows_8_enterprise_x64_dvd_917522.iso,if=none,id=drive-cd-disk2,media=cdrom,format=raw,cache=none -device ide-cd,drive=drive-cd-disk2,id=cd-disk2,unit=1

Result:
1. virtio-scsi Drive QEMU HARDDISK 1.4.
2. Legacy option rom
3. Floppy [drive A]
4. DVD/CD [ata1-0: QEMU DVD-ROM ATAPI-4 DVD/CD]
5. DVD/CD [ata1-1: QEMU DVD-ROM ATAPI-4 DVD/CD]
6. iPXE (PCI 00:05.0)

1.if  the SCSI.
e.g:...-drive file=/usr/share/virtio-win/virtio-win-1.6.3_amd64.vfd,if=none,id=drive-fdc0-0-0,format=raw -global isa-fdc.driveA=drive-fdc0-0-0 -drive file=/home/en_windows_server_2012_x64_dvd_915478.iso,if=none,id=drive-cd-disk1,media=cdrom,format=raw,cache=none -device virtio-scsi-pci,id=scsi2,vectors=0,bus=pcie.0,addr=0x8 -device scsi-cd,drive=drive-cd-disk1,id=cd-disk1 -drive file=/home/en_windows_8_enterprise_x64_dvd_917522.iso,if=none,id=drive-cd-disk2,media=cdrom,format=raw,cache=none -device scsi-cd,drive=drive-cd-disk2,id=cd-disk2

Result:
1. virtio-scsi Drive QEMU HARDDISK 1.4.
2. Legacy option rom
3. Floppy [drive A]
4. DVD/CD [virtio-scsi Drive QEMU CD-ROM 1.4.]
5. DVD/CD [virtio-scsi Drive QEMU CD-ROM 1.4.]
6. iPXE (PCI 00:05.0)

Comment 1 Sibiao Luo 2013-03-18 09:23:25 UTC
Created attachment 711808 [details]
AHCI screenshot.

Comment 2 Sibiao Luo 2013-03-18 09:23:55 UTC
Created attachment 711809 [details]
IDE screenshot.

Comment 3 Sibiao Luo 2013-03-18 09:24:30 UTC
Created attachment 711810 [details]
SCSI screenshot.

Comment 4 Sibiao Luo 2013-03-18 09:35:25 UTC
multiple hard disks using AHCI (Q35) also hit this issue.

# /usr/libexec/qemu-kvm -S -M q35...-drive file=/home/my-data-disk1.raw,if=none,id=drive-data-disk1,media=disk,format=raw,cache=none -device ide-hd,drive=drive-data-disk1,id=data-disk1,unit=0 -drive file=/home/my-data-disk2.raw,if=none,id=drive-data-disk2,media=disk,format=raw,cache=none -device ide-hd,drive=drive-data-disk2,id=data-disk2,unit=1
(qemu) info qtree
...
      dev: ich9-ahci, id ""
        addr = 1f.2
        romfile = <null>
        rombar = 1
        multifunction = on
        command_serr_enable = on
        class SATA controller, addr 00:1f.2, pci id 8086:2922 (sub 1af4:1100)
        bar 4: i/o at 0xc140 [0xc15f]
        bar 5: mem at 0xfebf4000 [0xfebf4fff]
        bus: ide.5
          type IDE
          dev: ide-hd, id "data-disk2"
            drive = drive-data-disk2
            logical_block_size = 512
            physical_block_size = 512
            min_io_size = 0
            opt_io_size = 0
            bootindex = -1
            discard_granularity = 0
            ver = "1.4.0"
            wwn = 0x0
            serial = "QM00012"
            model = <null>
            cyls = 16383
            heads = 16
            secs = 63
            bios-chs-trans = lba
            unit = 1
          dev: ide-hd, id "data-disk1"
            drive = drive-data-disk1
            logical_block_size = 512
            physical_block_size = 512
            min_io_size = 0
            opt_io_size = 0
            bootindex = -1
            discard_granularity = 0
            ver = "1.4.0"
            wwn = 0x0
            serial = "QM00011"
            model = <null>
            cyls = 16383
            heads = 16
            secs = 63
            bios-chs-trans = lba
            unit = 0
        bus: ide.4
          type IDE
        bus: ide.3
          type IDE
        bus: ide.2
          type IDE
        bus: ide.1
          type IDE
        bus: ide.0
          type IDE
...

Result:
Press F12 for boot menu.

Select boot device:

1. AHCI/5 QEMU HARDDISK ATA-7 Hard-Disk (1024 MiBytes)
2. virtio-scsi Drive QEMU HARDDISK 1.4.
3. Legacy option rom
4. Floppy [drive A]
5. iPXE (PCI 00:05.0)

Comment 5 Qian Guo 2013-03-25 07:53:10 UTC
*** Bug 927138 has been marked as a duplicate of this bug. ***

Comment 6 Gerd Hoffmann 2013-05-03 12:50:30 UTC
AHCI has no concept of master/slave devices.  So attaching two ide devices to one (ahci) ide bus isn't going to work.  Try this instead:

  -device ide-{cd,hd},drive=${name},bus=ide.{0,1,2,3,4,5}

The emulated AHCI controller has 6 ports, each gets one ide bus, and this way you can attach up to 6 ide devices.

Due to ahci emulation sharing code with ide emulation and some nasty command line compatibility issues it is possible to create invalid configurations like you did.  Assigning to blockdev guys for investigation / status update (not sure whenever this has been addressed in 1.5 already).

Comment 7 Kevin Wolf 2013-05-15 10:19:25 UTC
Fixed upstream in commit 0ee20e66.

Comment 8 Miroslav Rezanina 2013-05-23 12:04:46 UTC
Build in qemu-kvm-1.5.0-1.el7

Comment 9 Sibiao Luo 2013-07-15 06:19:05 UTC
(In reply to Gerd Hoffmann from comment #6)
> AHCI has no concept of master/slave devices.  So attaching two ide devices
> to one (ahci) ide bus isn't going to work.  Try this instead:
> 
>   -device ide-{cd,hd},drive=${name},bus=ide.{0,1,2,3,4,5}
> 
> The emulated AHCI controller has 6 ports, each gets one ide bus, and this
> way you can attach up to 6 ide devices.
> 
> Due to ahci emulation sharing code with ide emulation and some nasty command
> line compatibility issues it is possible to create invalid configurations
> like you did.  Assigning to blockdev guys for investigation / status update
> (not sure whenever this has been addressed in 1.5 already).
ok, thanks for your information that AHCI has no concept of master/slave devices, I will make a note to our wiki.

Verify this issue on qemu-kvm-1.5.1-2.el7.x86_64.
host info:
3.10.0-0.rc7.64.el7.x86_64
qemu-kvm-1.5.1-2.el7.x86_64
guest info:
3.10.0-0.rc7.64.el7.x86_64

Steps and result:
1.the emulated AHCI controller has 6 ports, each gets one ide bus, and this way you can attach up to 6 ide devices, it work correctly.
e.g:/usr/libexec/qemu-kvm -S -M q35...-drive file=/home/en_windows_7_ultimate_with_sp1_x64_dvd_618240.iso,if=none,id=drive-cd-disk1,media=cdrom,format=raw,cache=none -device ide-cd,drive=drive-cd-disk1,id=cd-disk1,bus=ide.0,unit=0 -drive file=/home/en_windows_server_2012_x64_dvd_915478.iso,if=none,id=drive-cd-disk2,media=cdrom,format=raw,cache=none -device ide-cd,drive=drive-cd-disk2,id=cd-disk2,bus=ide.1,unit=0

1. Virtio disk PCI:3:0
2. Virtio disk PCI:a:0
3. Legacy option rom
4. Floppy [drive A]
5. DVD/CD [AHCI/0: QEMU DVD-ROM ATAPI-4 DVD/CD]
6. DVD/CD [AHCI/1: QEMU DVD-ROM ATAPI-4 DVD/CD]
7. iPXE (PCI 07:00.0)

2.Tried to create ide unit 1 for AHCI that qemu will fail to boot and give prompt that can't create IDE unit 1, bus supports only 1 units.
e.g:/usr/libexec/qemu-kvm -S -M q35...-drive file=/home/en_windows_7_ultimate_with_sp1_x64_dvd_618240.iso,if=none,id=drive-cd-disk1,media=cdrom,format=raw,cache=none -device ide-cd,drive=drive-cd-disk1,id=cd-disk1,bus=ide.0,unit=0 -drive file=/home/en_windows_server_2012_x64_dvd_915478.iso,if=none,id=drive-cd-disk2,media=cdrom,format=raw,cache=none -device ide-cd,drive=drive-cd-disk2,id=cd-disk2,bus=ide.0,unit=1
(qemu) qemu-kvm: -device ide-cd,drive=drive-cd-disk2,id=cd-disk2,bus=ide.0,unit=1: Can't create IDE unit 1, bus supports only 1 units
qemu-kvm: -device ide-cd,drive=drive-cd-disk2,id=cd-disk2,bus=ide.0,unit=1: Device initialization failed.
qemu-kvm: -device ide-cd,drive=drive-cd-disk2,id=cd-disk2,bus=ide.0,unit=1: Device 'ide-cd' could not be initialized
/etc/qemu-ifdown: could not launch network script


Base on above, this issue has been fixed correctly, set it to verified status.

Best Regards,
sluo

Comment 10 Ludek Smid 2014-06-13 12:21:42 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.