Go to file
Mauricio Faria de Oliveira 84383af704 [stable-only] libvirt: disable secure boot on non-q35 or with os secure_boot options
Impact:
===

Currently, setting hw_firwmare_type=uefi on Ubuntu 20.04
might create _unbootable_ servers on Ussuri and Victoria.

Wallaby and later are fixed with refactoring, as part of
the Secure Boot implementation, but that's risky; see
commit 9fff6893ce ("libvirt: Use firmware metadata files
to configure instance") and others.

Issue:
===

The issue is that if UEFI is enabled, SB can be enabled
if loader OVMF_CODE.secboot.fd exists (eg, Ubuntu 20.04);
see commit 363710b655 ("libvirt: Handle alternative
UEFI firmware binary paths").

This is unintended and might prevent guest from booting
because SB requires an q35 machine type, SMM feature in
libvirt XML, SB-ready image etc. (Neither is enabled by
default nor guaranteed to be available or functional.)

Approach:
===

Well, SB support _isn't_ implemented in Ussuri/Victoria,
only later in Wallaby. The first commit above fixes the
issue because it removes hardcoded firmware/loader path
from second commit above.

As SB isn't supported should we just ignore .secboot.fd?
Maybe not completely? Let's ignore it if not q35 (which
it _needs_; note the behavior change but it's otherwise
broken anyway), and if q35 is used (for something else)
and still broken with .secboot.fd, provide users with a
way out of the latter using documented (future) options.

[Or should we opinionatedly just ignore .secboot.fd, as
Secure Boot is not yet supported anyway, and options to
get it back are provided? (e.g. os secure_boot=required).

Fix:
===

So, ignore .secboot.fd loader IF not q35. And since q35
may be set for AMD SEV, check `os.secure_boot` property/
extra spec for `disabled` to ignore .secboot.fd as well
(as listed in future `doc/source/admin/secure-boot.rst`),
and users can explicitly disable it to boot UEFI on q35.

(And as SB is not supported, do not check for both must
match [`disabled`/`required`] as `required` isn't valid;
thus if either image/flavor sets `disabled`, disable it).

Info:
===

    [0] https://docs.openstack.org/nova/wallaby/admin/uefi.html
    [1] https://docs.openstack.org/nova/wallaby/admin/secure-boot.html
    [2] https://docs.openstack.org/nova/wallaby/user/flavors.html
    [3] https://specs.openstack.org/openstack/nova-specs/specs/wallaby/implemented/allow-secure-boot-for-qemu-kvm-guests.html

Tests:
===

    Original:

    - Boots: BIOS / pc
    - Boots: BIOS / q35

    - Fails: UEFI / pc  / OVMF_CODE.secboot.fd
    - Fails: UEFI / q35 / OVMF_CODE.secboot.fd

    Patched:

    - Boots: BIOS / pc
    - Boots: BIOS / q35

    - Boots: UEFI / pc  / OVMF_CODE.fd          # FIXED!
    - Fails: UEFI / q35 / OVMF_CODE.secboot.fd  # No change by default.

    - Boots: UEFI / q35 / OVMF_CODE.fd / os_secure_boot=disabled (image)
    - Boots: UEFI / q35 / OVMF_CODE.fd / os:secure_boot=disabled (flavor)

Logs: (included for PC with UEFI only; broken/fixed case)
===

    $ openstack image set --property hw_firmware_type=uefi bionic
    $ openstack server create --image bionic --flavor m1.small --network private srv

Before:

    $ juju run --app nova-compute 'for guest in $(virsh list --name); do \
      virsh dumpxml $guest; done | grep -e nova:name -e machine= -e loader'
          <nova:name>srv</nova:name>
        <type arch='x86_64' machine='pc-i440fx-4.2'>hvm</type>
        <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.secboot.fd</loader>

    Guest doesn't boot; nothing in the console log:

    $ openstack console log show srv | grep -i -e efi -e bios
    $ openstack console log show srv | wc -l
    0

    QEMU looping / 100% CPU:

    $ juju run --app nova-compute 'top -b -d1 -n5 | grep qemu'
      67205 libvirt+  ... 100.0   1.4   1:18.35	qemu-sy+
      67205 libvirt+  ... 100.0   1.4   1:19.36	qemu-sy+
      67205 libvirt+  ...  99.0   1.4   1:20.36	qemu-sy+
      67205 libvirt+  ... 101.0   1.4   1:21.37	qemu-sy+
      67205 libvirt+  ... 100.0   1.4   1:22.38	qemu-sy+

After:

    $ juju run --app nova-compute 'for guest in $(virsh list --name); do \
      virsh dumpxml $guest; done | grep -e nova:name -e machine= -e loader'
          <nova:name>srv</nova:name>
        <type arch='x86_64' machine='pc-i440fx-4.2'>hvm</type>
        <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>

    Guest booted; details in the console log:

    $ openstack console log show srv | grep -i -e efi -e bios
    ...
    Creating boot entry "Boot0003" with label "ubuntu" for file "\EFI\ubuntu\shimx64.efi"
    ...
    [    0.000000] efi: EFI v2.70 by EDK II
    [    0.000000] efi:  SMBIOS=0x7fbcd000  ACPI=0x7fbfa000  ACPI
    2.0=0x7fbfa014  MEMATTR=0x7eb30018
    [    0.000000] SMBIOS 2.8 present.
    [    0.000000] DMI: OpenStack Foundation OpenStack Nova, BIOS 0.0.0 02/06/2015
    ...

Note that the XML snippet for the loader is aligned with Wallaby,
in which just setting hw_firmware_type=uefi works out of the box:

    $ juju run --app nova-compute 'for guest in $(virsh list --name); do \
      virsh dumpxml $guest; done | grep -e nova:name -e machine= -e loader'
        <nova:name>srv</nova:name>
      <type arch='x86_64' machine='pc-i440fx-4.2'>hvm</type>
      <loader readonly='yes' secure='no' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>

Closes-Bug: #1960758
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Change-Id: Ib6e52706e1eca92fefc44d21fab9f5df8780543c
2022-02-14 09:25:57 -03:00
2020-09-11 14:09:06 +01:00
2021-05-17 16:35:50 +01:00
2020-05-15 15:59:53 +01:00
2014-05-07 12:14:26 -07:00
2020-01-17 11:30:40 +00:00
2017-11-24 16:51:12 -05:00
2020-08-05 16:16:49 -05:00
2010-05-27 23:05:26 -07:00
2017-09-07 15:42:31 +02:00
2020-05-15 15:59:53 +01:00
2017-03-02 11:50:48 +00:00

OpenStack Nova

image

OpenStack Nova provides a cloud computing fabric controller, supporting a wide variety of compute technologies, including: libvirt (KVM, Xen, LXC and more), Hyper-V, VMware, OpenStack Ironic and PowerVM.

Use the following resources to learn more.

API

To learn how to use Nova's API, consult the documentation available online at:

For more information on OpenStack APIs, SDKs and CLIs in general, refer to:

Operators

To learn how to deploy and configure OpenStack Nova, consult the documentation available online at:

In the unfortunate event that bugs are discovered, they should be reported to the appropriate bug tracker. If you obtained the software from a 3rd party operating system vendor, it is often wise to use their own bug tracker for reporting problems. In all other cases use the master OpenStack bug tracker, available at:

Developers

For information on how to contribute to Nova, please see the contents of the CONTRIBUTING.rst.

Any new code must follow the development guidelines detailed in the HACKING.rst file, and pass all unit tests.

Further developer focused documentation is available at:

Other Information

During each Summit and Project Team Gathering, we agree on what the whole community wants to focus on for the upcoming release. The plans for nova can be found at:

Description
OpenStack Compute (Nova)
Readme 1.6 GiB
Languages
Python 97.6%
Smarty 2.3%
Shell 0.1%