Bug 1373812

Summary: guest boot from network even set 'boot order=1' for virtio disk with OVMF
Product: Red Hat Enterprise Linux 7 Reporter: yalzhang <yalzhang>
Component: ovmfAssignee: Laszlo Ersek <lersek>
Status: CLOSED ERRATA QA Contact: FuXiangChun <xfu>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.3CC: chayang, jinzhao, juzhang, lmen, michen, mrezanin, mtessun, rbalakri
Target Milestone: rcKeywords: Rebase
Target Release: 7.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovmf-20170228-1.gitc325e41585e3.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 22:22:15 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:
Bug Depends On: 1416919    
Bug Blocks:    
Attachments:
Description Flags
set boot from virtio disk, but in fact it boot from network
none
virtiodiskboot2.log
none
sata disk works ok
none
the ovfm log for boot from interface(set network as the only first boot devie) none

Description yalzhang@redhat.com 2016-09-07 08:01:14 UTC
Created attachment 1198571 [details]
set boot from virtio disk, but in fact it boot from network

Description of problem:
Guest use OVMF, and set <boot order='1'/> for interface, it will boot from network. After change the <boot order='1'/> into virtio disk, do destroy-start, the guest will still boot from network.

Version-Release number of selected component (if applicable):
libvirt-2.0.0-6.el7.x86_64
ipxe-roms-qemu-20160127-5.git6366fa7a.el7.noarch.rpm
OVMF-20160608-3.git988715a.el7.noarch
qemu-kvm-rhev-2.6.0-22.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. prepare a guest with virtio disk. set it boot from network. It will boot from network. see interfaceboot.log.
  <os>
    <type arch='x86_64' machine='pc-q35-rhel7.3.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.secboot.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/uefiq35notset_VARS.fd</nvram>
  </os>
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/uefiq35notset.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </disk>
...
    <interface type='bridge'>
      <mac address='52:54:00:97:99:85'/>
      <source bridge='br0'/>
      <model type='rtl8139'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
    </interface>
...

2. destroy the guest, edit it the boot device to disk, it will still boot from network. see ovmf log virtiodiskboot.log.

 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/uefiq35notset.qcow2'/>
      <target dev='vda' bus='virtio'/>
<boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </disk>
...

3. change the disk to sata type, will boot from disk. see ovmf log satadiskboot.log.
  <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/uefiq35notset.qcow2'/>
      <target dev='sda' bus='scsi'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
...
4. change the disk back to virtio type, it will boot from disk and works well. see ovmf log virtiodiskboot2.log.


Actual results:
After change first boot device from network to virtio disk, the guest still boot from network. 

Expected results:
The boot order should match what we set in the domain xml.

Additional info:
sata and scsi disk have no such issue.

Comment 1 yalzhang@redhat.com 2016-09-07 08:06:54 UTC
Created attachment 1198576 [details]
virtiodiskboot2.log

Comment 2 yalzhang@redhat.com 2016-09-07 08:07:49 UTC
Created attachment 1198577 [details]
sata disk works ok

Comment 3 yalzhang@redhat.com 2016-09-07 08:09:24 UTC
Created attachment 1198578 [details]
the ovfm log for boot from interface(set network as the only first boot devie)

Comment 5 Laszlo Ersek 2016-09-07 09:42:35 UTC
Confirmed, this is a bug in OVMF. I'll send an upstream patch soon.

Comment 6 Laszlo Ersek 2016-09-07 11:14:26 UTC
NB: this issue can be mitigated if you never remove the hard disk from the boot order, you just place it behind all the other devices.

Comment 8 Laszlo Ersek 2016-09-07 11:43:16 UTC
Posted upstream patch:
https://lists.01.org/pipermail/edk2-devel/2016-September/001477.html

Comment 9 Laszlo Ersek 2016-09-08 08:06:52 UTC
Upstream commit d796d33f1844.

Comment 14 FuXiangChun 2017-03-10 10:45:48 UTC
reproduced this bug with OVMF-20160608b-1.git988715a.el7.noarch. Can not find virtio disk from ovmf.

verified this bug with OVMF-20170228-1.gitc325e41585e3.el7.  bootindex works well from virtio disk.

Comment 15 errata-xmlrpc 2017-08-01 22:22:15 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://access.redhat.com/errata/RHEA-2017:2056