File 0001-Handle-alternative-UEFI-boot-loader-locations-on-SLE.patch of Package openstack-nova
From e3d637a1319db9699ed80f97397b62e31d63ccd5 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Thu, 28 Jul 2016 16:39:19 +0200
Subject: [PATCH] Handle alternative UEFI boot loader locations on SLES
These EDKs are located in a different path here with no symlinks,
so just probe for all of those paths in an order and pick one
that exists. This kludges around a problem on UEFI images on SLES.
Change-Id: I28afdb09d300be39981606d5234fd837ea738e1d
Closes-Bug: 1607400
---
nova/virt/libvirt/driver.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
Index: nova-13.1.1.dev18/nova/virt/libvirt/driver.py
===================================================================
--- nova-13.1.1.dev18.orig/nova/virt/libvirt/driver.py
+++ nova-13.1.1.dev18/nova/virt/libvirt/driver.py
@@ -334,8 +334,10 @@ DEFAULT_FIREWALL_DRIVER = "%s.%s" % (
libvirt_firewall.IptablesFirewallDriver.__name__)
DEFAULT_UEFI_LOADER_PATH = {
- "x86_64": "/usr/share/OVMF/OVMF_CODE.fd",
- "aarch64": "/usr/share/AAVMF/AAVMF_CODE.fd"
+ "x86_64": ['/usr/share/OVMF/OVMF_CODE.fd',
+ '/usr/share/qemu/ovmf-x86_64-code.bin'],
+ "aarch64": ['/usr/share/AAVMF/AAVMF_CODE.fd',
+ '/usr/share/qemu/aavmf-aarch64-code.bin']
}
MAX_CONSOLE_BYTES = 100 * units.Ki
@@ -4371,9 +4373,12 @@ class LibvirtDriver(driver.ComputeDriver
# This means that the host can support uefi booting for guests
supported_archs = [arch.X86_64, arch.AARCH64]
caps = self._host.get_capabilities()
+ # TODO(dmllr): Instead of probing UEFI_LOADER_PATHS, we should query libvirt domCapabilities
+ # that should be configured correctly whether UEFI is available or not
return ((caps.host.cpu.arch in supported_archs) and
self._host.has_min_version(MIN_LIBVIRT_UEFI_VERSION) and
- os.path.exists(DEFAULT_UEFI_LOADER_PATH[caps.host.cpu.arch]))
+ any((os.path.exists(p)
+ for p in DEFAULT_UEFI_LOADER_PATH[caps.host.cpu.arch])))
def _configure_guest_by_virt_type(self, guest, virt_type, caps, instance,
image_meta, flavor, root_device_name):
@@ -4393,8 +4398,8 @@ class LibvirtDriver(driver.ComputeDriver
"functional testing and therefore "
"considered experimental."))
uefi_logged = True
- guest.os_loader = DEFAULT_UEFI_LOADER_PATH[
- caps.host.cpu.arch]
+ guest.os_loader = filter(os.path.exists, DEFAULT_UEFI_LOADER_PATH[
+ caps.host.cpu.arch])[0]
guest.os_loader_type = "pflash"
else:
raise exception.UEFINotSupported()