Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions nova/tests/unit/virt/libvirt/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,7 @@ def test_get_loader(self, mock_get_mtype, mock_loaders):
'interface-types': ['uefi'],
'mapping': {
'device': 'flash',
'mode': 'split',
'executable': {
'filename': '/usr/share/edk2/ovmf/OVMF_CODE.fd',
'format': 'raw',
Expand All @@ -1895,6 +1896,44 @@ def test_get_loader(self, mock_get_mtype, mock_loaders):
'features': ['acpi-s3', 'amd-sev', 'verbose-dynamic'],
'tags': [],
},
# NOTE(tkajinam): The following loaders are not supported and
# should be ignored. https://bugs.launchpad.net/nova/+bug/2122288
{
'description': 'Sample descriptor for stateless mode',
'interface-types': ['uefi'],
'mapping': {
'device': 'flash',
'mode': 'stateless',
'executable': {
'filename': '/usr/share/edk2/ovmf/OVMF_CODE_SL.fd',
'format': 'raw'
}
},
'targets': [
{
'architecture': 'x86_64',
'machines': ['pc-q35-*'],
},
],
'features': ['amd-sev', 'verbose-dynamic'],
'tags': [],
},
{
'description': 'Sample descriptor for memory device',
'interface-types': ['uefi'],
'mapping': {
'device': 'memory',
'filename': '/usr/share/edk2/ovmf/OVMF_MEM.fd'
},
'targets': [
{
'architecture': 'x86_64',
'machines': ['pc-q35-*'],
}
],
'features': ['amd-sev', 'verbose-dynamic'],
'tags': [],
},
]

def fake_get_mtype(arch, machine):
Expand Down
48 changes: 27 additions & 21 deletions nova/virt/libvirt/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -1800,31 +1800,37 @@ def get_loader(
machine = self.get_canonical_machine_type(arch, machine)

for loader in self.loaders:
for target in loader['targets']:
if arch != target['architecture']:
continue

for machine_glob in target['machines']:
# the 'machines' attribute supports glob patterns (e.g.
# 'pc-q35-*') so we need to resolve these
if fnmatch.fnmatch(machine, machine_glob):
break
try:
for target in loader['targets']:
if arch != target['architecture']:
continue

for machine_glob in target['machines']:
# the 'machines' attribute supports glob patterns (e.g.
# 'pc-q35-*') so we need to resolve these
if fnmatch.fnmatch(machine, machine_glob):
break
else:
continue

# if we've got this far, we have a match on the target
break
else:
continue

# if we've got this far, we have a match on the target
break
else:
continue
# if we request secure boot then we should get it and vice
# versa
if has_secure_boot != ('secure-boot' in loader['features']):
continue

# if we request secure boot then we should get it and vice versa
if has_secure_boot != ('secure-boot' in loader['features']):
return (
loader['mapping']['executable']['filename'],
loader['mapping']['nvram-template']['filename'],
'requires-smm' in loader['features'],
)
except KeyError:
# This indicates that the description structure is new and nova
# does not how to handle it
continue

return (
loader['mapping']['executable']['filename'],
loader['mapping']['nvram-template']['filename'],
'requires-smm' in loader['features'],
)

raise exception.UEFINotSupported()
10 changes: 10 additions & 0 deletions releasenotes/notes/bug-2133416-80522b523ee74835.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
fixes:
- |
[`bug 2133416 <https://bugs.launchpad.net/nova/+bug/2133416>`_] Libvirt
virt driver now ignores the OVMF firmware files of the following types.
Previously nova failed to start instances with UEFI boot when it attempts
to check such firmware files.

- stateless mode
- memory device