About HTTP boot


Juliana Rodrigueiro <juliana.rodrigueiro@...>
 

Hi all!

I would like to ask the community about a way to automatically use HTTP
boot in a QEMU VM using OVMF.

Currently I can set the network interface to be the first in the boot
order, then when booting the machine I manually trigger the firmware
setup and change the network boot options positioning HTTP ipv4 in the
first position. In the next boot, the machine goes straight to HTTP boot
(No PXE boot was triggered, as desired).

Could anyone tell me if it is possible to perform such actions in the
command line (maybe with qemu-system-x86_64)? Or with the libvirt xml
description?

Please let me know if this is the wrong mailing list to ask.

Thank you!
Juliana.


Laszlo Ersek
 

On 07/30/20 09:05, Juliana Rodrigueiro wrote:
Hi all!

I would like to ask the community about a way to automatically use HTTP
boot in a QEMU VM using OVMF.

Currently I can set the network interface to be the first in the boot
order, then when booting the machine I manually trigger the firmware
setup and change the network boot options positioning HTTP ipv4 in the
first position. In the next boot, the machine goes straight to HTTP boot
(No PXE boot was triggered, as desired).

Could anyone tell me if it is possible to perform such actions in the
command line (maybe with qemu-system-x86_64)? Or with the libvirt xml
description?

Please let me know if this is the wrong mailing list to ask.
This is certainly the right mailing list to ask on; sorry about the
delay (I didn't get a notification email about your message pending
moderation -- but now further messages from you should go through directly).

So, two points:


(1) Use the "bootindex" device property for placing the virtual NIC at
the front of the UEFI boot order. Do not use the "-boot order" option;
instead use:

-device virtio-net-pci,...,bootindex=1

the "bootindex=1" property is relevant (the value 1 is not critical,
just make sure nothing else has a lower bootindex value).

In the libvirt domain XML, this is handled automatically; just use the
<boot order='1'/> child element in the <interface type='network'> element.


(2) For prioritizing HTTP(S) boot over PXE boot, we have rudimentary
support at this moment. It is currently available on the QEMU command
line, and not integrated well into libvirt.

(You can still use it with the <qemu:arg> element in the domain XML of
course, like some other QEMU swithes. Just know that <qemu:arg> causes
some virt vendors to taint your domain as "unsupportable".)

So, the feature was implemented in:

https://bugzilla.tianocore.org/show_bug.cgi?id=2681

The idea is to disable both PXEv4 and PXEv6, while keeping the NIC at
the front of the UEFI boot order. This will effectively let you attempt
HTTP boot at once. The QEMU options are (use both at the same time):

-fw_cfg name=opt/org.tianocore/IPv4PXESupport,string=n \
-fw_cfg name=opt/org.tianocore/IPv6PXESupport,string=n \

In the domain XML, this amounts to:

<domain type='kvm'
xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<qemu:commandline>
<qemu:arg value='-fw_cfg'/>
<qemu:arg value='name=opt/org.tianocore/IPv4PXESupport,string=n'/>
<qemu:arg value='-fw_cfg'/>
<qemu:arg value='name=opt/org.tianocore/IPv6PXESupport,string=n'/>
</qemu:commandline>
</domain>


Important: do not forget adding the "xmlns:qemu" namespace definition to
the root element of the XML (that is, to <domain>):

xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'

otherwise the <qemu:commandline> and <qemu:arg> elements will have no
meaning, and libvirt will strip them immediately and silently (as soon
as "virsh edit" or "virsh define" completes).

Hope this helps,
Laszlo