Bug 1752838

Summary: Boot order does not work when using OVMF
Product: Red Hat Enterprise Linux 8 Reporter: Michael <choma>
Component: edk2Assignee: Virtualization Maintenance <virt-maint>
Status: CLOSED NOTABUG QA Contact: Michael <choma>
Severity: high Docs Contact:
Priority: high    
Version: 8.1CC: berrange, chayang, coli, jinzhao, juzhang, kraxel, lersek, pbonzini, philmd, yfu
Target Milestone: rc   
Target Release: 8.0   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-09-17 11:48:02 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 Michael 2019-09-17 11:12:49 UTC
Description of problem:
As the subject, there is a command line "-boot order=cdn,once=c", which order boot from hard disk first. If the hard disk boot failure, then boot from cdrom, then boot from network. 

However, the guest was booting from cdrom first even through the hard disk is available. On the words, the boot order=cdn did not give effect. 

The detail please see the 'Steps to reproduce'. 


Version-Release number of selected component (if applicable):
kernel:4.18.0-141.el8.x86_64
qemu-kvm-4.1.0-10.module+el8.1.0+4234+33aa4f57.x86_64


How reproducible:
100%


Steps to Reproduce:
1.Boot a ovmf guest with mult devices and set boot order as cdn. 
/usr/libexec/qemu-kvm -M q35 -cpu EPYC -enable-kvm -m 4G -smp 4 -nodefaults \
-device pcie-root-port,id=pcie.0-root-port-2,slot=2,chassis=2,addr=0x2,bus=pcie.0 \
-device pcie-root-port,id=pcie.0-root-port-3,slot=3,chassis=3,addr=0x3,bus=pcie.0 \
-device pcie-root-port,id=pcie.0-root-port-4,slot=4,chassis=4,addr=0x4,bus=pcie.0 \
-device pcie-root-port,id=pcie.0-root-port-5,slot=5,chassis=5,addr=0x5,bus=pcie.0 \
-device virtio-scsi-pci,id=scsi0,bus=pcie.0-root-port-2,addr=0x0 \
-drive file=win2019-edk2_gatting.qcow2,if=none,id=guest-img,format=qcow2,werror=stop,rerror=stop \
-device scsi-hd,bus=scsi0.0,drive=guest-img \     <---hard disk
-device virtio-net-pci,mac=24:be:05:15:d3:90,id=netdev1,vectors=4,netdev=net1,bus=pcie.0-root-port-3 -netdev tap,id=net1,vhost=on,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown \
-monitor stdio -vga qxl -boot menu=on \
-qmp tcp::8888,server,nowait \
-device virtio-serial-pci,id=virtio-serial0,bus=pcie.0-root-port-5,addr=0x0 \
-chardev spicevmc,id=charchannel1,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=com.redhat.spice.0 \
-spice port=5901,addr=0.0.0.0,disable-ticketing,image-compression=off,seamless-migration=on \
-drive id=drive_cd1,if=none,snapshot=off,aio=threads,cache=none,media=cdrom,file=/home/kvm_autotest_root/iso/ISO/Win2019/en_windows_server_2019_updated_march_2019_x64_dvd_2ae967ab.iso \  <--- cdrom
-device ide-cd,id=cd1,drive=drive_cd1,bus=ide.0,unit=0 \
-drive file=virtio-win.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on -device ide-drive,drive=drive-ide0-1-0,id=ide0-1-0 \
-global driver=cfi.pflash01,property=secure,value=on \
-drive file=/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd,if=pflash,format=raw,unit=0,readonly=on \
-drive file=OVMF_VARS.fd,if=pflash,format=raw,unit=1,readonly=off \
-usb -device usb-tablet \
-boot order=cdn,once=c,menu=on,strict=off,splash-time=5000  \  <--- boot order. 


Actual results:
The guest was going to cdrom and installation process. 


Expected results:
The guest should login the system. 

Additional info:

Comment 1 Michael 2019-09-17 11:18:52 UTC
Sorry for missing edk2 version. 

The version of edk2 was: edk2-ovmf-20190308git89910a39dcfd-6.el8.noarch

Comment 2 Laszlo Ersek 2019-09-17 11:48:02 UTC
Hi Michael,

the "-boot order" and "-boot once" options are unsupported -- and
unsupportable -- for setting the boot order with OVMF.

For setting a boot order, you must use "bootindex=N" properties,
attached to individual "-device" options.

Libvirt correctly generates the required bootindex properties on the
QEMU command line. And not just when the domain XML specifies per-device

  <boot order='N'/>

elements, but also when the domain XML uses the -- now obsolete --
high-level elements

  <boot dev='hd|...'/>

That's the desired behavior. Please refer to bug 1323085 for details.

If the "-boot order" or "-boot once" option is used in the RHEL8 edk2
test plan (RHEL-133831?), then please update the test plan as well, to
"-device xxxx,bootindex=N".


... I've now quickly searched the test plan in Polarion for "-boot". It
looks like RHEL-133831 does not use any problematic "-boot" option. I
assume you are currently developing the new test case RHEL-133831 (in
connection to bug 1561128), and attempted to use "-boot order" and/or
"-boot once". Please don't do that.

In total, I see the following options used, across the whole test plan:

* "-boot menu=(on|off)" -- this is correct; it's supported. (It may not
  work exactly like in SeaBIOS, but it does something similar.)

* "-boot splash-time=<msecs>" -- same as above.

* "-boot strict=..." -- this has no effect / it is unsupported; OVMF
  always behaves as if "-boot strict=on" were specified.

OVMF supports only "-boot menu" and "-boot splash-time". The behavior of
"-boot XXX" options is firmware specific, and OVMF supports only these
two.

Please see also the comments (in Polarion) that I had attached, in June
/ July 2016, to test case RHEL7-56230 ("[OVMF] Verify Boot Option
Support under UEFI environment").

I'm closing this report as NOTABUG now.

Thanks,
Laszlo