Bug 1210651

Summary: The seabios always choose the first hard disk to boot up when configuring guest with multiple hard disks
Product: Red Hat Enterprise Linux 7 Reporter: vivian zhang <vivianzhang>
Component: seabiosAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: aliang, areis, dyuan, ehabkost, gnatapov, hhuang, jiahu, jsuchane, kraxel, mzhan, rbalakri, sluo, tzheng, virt-maint, xfu, yunyang
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: 2015-04-29 05:49:46 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 vivian zhang 2015-04-10 09:39:07 UTC
Description:
When configuring guest with multiple hard disks the seabios always choose the first hard disk from the boot menu list to boot up guest. But if the first hard disk in the boot menu list contains without OS, guest will fail to boot up finally.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.2.0-8.el7.x86_64
libvirt-1.2.8-16.el7_1.3.x86_64
seabios-1.7.5-8.el7.x86_64


How reproducible:
100%

Steps:

scenario
1. prepare one guest with bootmenu enable='yes', and two different hard disks, one of them contains with good OS, another contains without OS.
...
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
    <boot dev='hd'/>
    <bootmenu enable='yes'/>
  </os>
...

 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/wzhang/rhel7_l.img'/>             <--has health OS
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>
...
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/var/lib/libvirt/images/new.img' startupPolicy='optional'/>                     <-----has fake OS
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>

# virsh domblklist rl
Target     Source
------------------------------------------------
vda        /mnt/wzhang/rhel7_l.img
vdb        /var/lib/libvirt/images/new.img

2. boot up guest failed with no bootable device, because of the seabios always choose the first hard disk without OS from boot menu list.

.....
SeaBIOS (version seabios-1.7.5-8.el7)
Machine UUID fdd9ba31-bacd-3382-c7c7-5a3f1f446768


gPXE (http://etherboot.org) - 00:03.0 C900 PCI2.10 PnP PMM+3FF97990+3FEF7990 C900
                                                                              


Press ESC or F12 for boot menu.

Booting from Hard Disk...
Boot failed: not a bootable disk

Booting from ROM...
iPXE (PCI 00:03.0) starting execution...ok
iPXE initialising devices...ok



iPXE 1.0.0+ (c4bce43) -- Open Source Boot Firmware -- http://ipxe.org
Features: iSCSI HTTP DNS TFTP AoE bzImage ELF MBOOT PXE Menu PXEXT

net0: 52:54:00:25:55:7e using rtl8139 on PCI00:03.0 (open)
  [Link:up, TX:0 TXE:0 RX:0 RXE:0]
DHCP (net0 52:54:00:25:55:7e)...... Connection timed out(http://ipxe.org/4c106035)
No more network devices

Booting from Floppy...                  
Boot failed: could not read the boot disk

No bootable device.  
...


3. during boot up, print F12 to check bootmenu list

Press F12 for boot menu.

Select boot device:
1. Virtio disk PCI:0:6  <--this disk has fake OS
2. Virtio disk PCI:0:a
3. Legacy option rom
4. iPXe (PCI 00:03.0)


4. select bootmune enalbe='no' or dismiss this attribute setting in XML, boot up guest success. the seabios will automatically choose the hard disk contains with OS to boot up guest
...
<os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
    <boot dev='hd'/>
    <bootmenu enable='no'/>   <----- notice this to no or delete this line
  </os>
...

Sceanrio 2:

1. edit guest with following XML, with bootmenu enable='yes', but setting boot order in each disk separately

...
<os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
   <bootmenu enable='yes'/>
  </os>
...


# virsh dumpxml r7a | grep "/disk" -B8
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/r7.img'/>   has a health OS
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <boot order='2'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/var/lib/libvirt/images/new.qcow2'/>  a fake os
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>

2. start guest, to check seabio still can not jump to the second disk which has health OS

Actual result:
When configuring guest with multiple hard disks, and select bootmenu enable='yes' or set the boot order for each disks, the seabios always choose the first hard disk from the boot menu list to boot up guest. But if the first hard disk in the boot menu list without OS, guest will fail to boot up finally.

Expect result:
For this scenario, the seabios should try to jump to the second hard disk if the first disk without OS and bootup failed.

Comment 2 Jaroslav Suchanek 2015-04-20 09:42:19 UTC
Moving to seabios component for investigation.

Comment 3 Gerd Hoffmann 2015-04-29 05:49:46 UTC
The BIOS interface specs don't allow that.

Comment 4 Hu Jianwei 2015-04-30 02:44:42 UTC
(In reply to Gerd Hoffmann from comment #3)
> The BIOS interface specs don't allow that.

If you mean the scenario 2 in #c0, it's acceptable. 

But for the fist scenario, seabios has a side effect with <bootmenu enable='yes'/>, the guest can not boot up from the health disk normally. 

Is there more clear explanation? Thanks in advance.

Comment 5 Gerd Hoffmann 2015-04-30 06:19:46 UTC
(In reply to Hu Jianwei from comment #4)
> (In reply to Gerd Hoffmann from comment #3)
> > The BIOS interface specs don't allow that.
> 
> If you mean the scenario 2 in #c0, it's acceptable. 
> 
> But for the fist scenario, seabios has a side effect with <bootmenu
> enable='yes'/>, the guest can not boot up from the health disk normally. 

Which side effect?  Disk ordering doesn't change depending on bootmenu=on|off.
Guest doesn't boot in both cases for me.

Comment 6 vivian zhang 2015-05-06 03:04:13 UTC
(In reply to Gerd Hoffmann from comment #5)
> (In reply to Hu Jianwei from comment #4)
> > (In reply to Gerd Hoffmann from comment #3)
> > > The BIOS interface specs don't allow that.
> > 
> > If you mean the scenario 2 in #c0, it's acceptable. 
> > 
> > But for the fist scenario, seabios has a side effect with <bootmenu
> > enable='yes'/>, the guest can not boot up from the health disk normally. 
> 
> Which side effect?  Disk ordering doesn't change depending on
> bootmenu=on|off.
> Guest doesn't boot in both cases for me.

Hi, Gerd

Thanks for your reply, I think you misunderstand our meaning for this bug. 

For scenario 1 as described in comment 0,  I configure two disks
...
 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/wzhang/rhel7_l.img'/>        <--has health OS
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>
...
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/var/lib/libvirt/images/new.img' startupPolicy='optional'/>                       <-----has fake OS
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
...

****you can see that new.img has fake OS with bus slot = '0x06', and rhel7_l.img has health OS with bus slot ='0x0a'****

1. when bootmenu=yes, decided by the bus slot address number, the disk order listed in bootmenu is new.img before rhel7_l.img, right?

Press F12 for boot menu.

Select boot device:
1. Virtio disk PCI:0:6  <--this disk has fake OS
2. Virtio disk PCI:0:a
3. Legacy option rom
4. iPXe (PCI 00:03.0)

then guest will always choose the first boot device new.img with fake OS, so guest boot up failed every time.

2. when bootmenu=no, you said that bootmenu does not change disk order, but why seabios will automatically choose the second boot device rhel7_l.img to boot up successful?


So what we are confused is that if the disk order is not changing with bootmenu=on/off, why guest boot up failed with bootmenu=yes, but successful with bootmenu=no in my condition?



hope for your reply, thanks

Comment 7 Gerd Hoffmann 2015-05-18 11:29:13 UTC
> ****you can see that new.img has fake OS with bus slot = '0x06', and
> rhel7_l.img has health OS with bus slot ='0x0a'****
> 
> 1. when bootmenu=yes, decided by the bus slot address number, the disk order
> listed in bootmenu is new.img before rhel7_l.img, right?
> 
> Press F12 for boot menu.
> 
> Select boot device:
> 1. Virtio disk PCI:0:6  <--this disk has fake OS
> 2. Virtio disk PCI:0:a
> 3. Legacy option rom
> 4. iPXe (PCI 00:03.0)
> 
> then guest will always choose the first boot device new.img with fake OS, so
> guest boot up failed every time.

Same here.

> 2. when bootmenu=no, you said that bootmenu does not change disk order, but
> why seabios will automatically choose the second boot device rhel7_l.img to
> boot up successful?

Fails to boot for me too.

> So what we are confused is that if the disk order is not changing with
> bootmenu=on/off, why guest boot up failed with bootmenu=yes, but successful
> with bootmenu=no in my condition?

No idea why this happens for you.
Doesn't match what I see in testing.

Comment 8 Paolo Bonzini 2017-10-28 06:46:37 UTC
*** Bug 1505784 has been marked as a duplicate of this bug. ***

Comment 9 Ján Tomko 2019-06-25 10:42:49 UTC
*** Bug 1711770 has been marked as a duplicate of this bug. ***