Fix BootSourceOverrideMode enumeration

Fixes one of the allowed values for ``BootSourceOverrideMode``
element - Redfish specification requires UEFI boot mode to be
indicated as ``UEFI``, not ``Uefi`` as the dynamic Redfish emulator
erroneously adopted.

Change-Id: Ie7c743f27c005a92f500c17dcbb25320747cee4b
This commit is contained in:
Ilya Etingof 2019-10-14 18:54:31 +02:00
parent eb2943dfab
commit 4279ee0622
6 changed files with 21 additions and 14 deletions

View File

@ -22,7 +22,7 @@ SUSHY_EMULATOR_LIBVIRT_URI = u'qemu:///system'
# The map of firmware loaders dependant on the boot mode and
# system architecture
SUSHY_EMULATOR_BOOT_LOADER_MAP = {
u'Uefi': {
u'UEFI': {
u'x86_64': u'/usr/share/OVMF/OVMF_CODE.fd',
u'aarch64': u'/usr/share/AAVMF/AAVMF_CODE.fd'
},

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixes one of the allowed values for ``BootSourceOverrideMode``
element - Redfish specification requires UEFI boot mode to be indicated
as ``UEFI``, not ``Uefi`` as the dynamic Redfish emulator erroneously
adopted.

View File

@ -103,7 +103,7 @@ class AbstractSystemsDriver(DriverBase):
def get_boot_mode(self, identity):
"""Get computer system boot mode.
:returns: either *Uefi* or *Legacy* as `str` or `None` if
:returns: either *UEFI* or *Legacy* as `str` or `None` if
current boot mode can't be determined
"""
@ -111,7 +111,7 @@ class AbstractSystemsDriver(DriverBase):
"""Set computer system boot mode.
:param boot_mode: string literal requesting boot mode
change on the system. Valid values are: *Uefi*, *Legacy*.
change on the system. Valid values are: *UEFI*, *Legacy*.
:raises: `FishyError` if boot mode can't be set
"""

View File

@ -99,13 +99,13 @@ class LibvirtDriver(AbstractSystemsDriver):
BOOT_MODE_MAP = {
'Legacy': 'rom',
'Uefi': 'pflash'
'UEFI': 'pflash'
}
BOOT_MODE_MAP_REV = {v: k for k, v in BOOT_MODE_MAP.items()}
BOOT_LOADER_MAP = {
'Uefi': {
'UEFI': {
'x86_64': '/usr/share/OVMF/OVMF_CODE.fd',
'aarch64': '/usr/share/AAVMF/AAVMF_CODE.fd'
},
@ -441,7 +441,7 @@ class LibvirtDriver(AbstractSystemsDriver):
def get_boot_mode(self, identity):
"""Get computer system boot mode.
:returns: either *Uefi* or *Legacy* as `str` or `None` if
:returns: either *UEFI* or *Legacy* as `str` or `None` if
current boot mode can't be determined
"""
domain = self._get_domain(identity, readonly=True)
@ -462,7 +462,7 @@ class LibvirtDriver(AbstractSystemsDriver):
"""Set computer system boot mode.
:param boot_mode: string literal requesting boot mode
change on the system. Valid values are: *Uefi*, *Legacy*.
change on the system. Valid values are: *UEFI*, *Legacy*.
:raises: `error.FishyError` if boot mode can't be set
"""
@ -785,7 +785,7 @@ class LibvirtDriver(AbstractSystemsDriver):
inserted = (self.get_boot_device(identity) ==
constants.DEVICE_TYPE_CD)
if inserted:
inserted = self.get_boot_mode(identity) == 'Uefi'
inserted = self.get_boot_mode(identity) == 'UEFI'
return boot_image, read_only, inserted

View File

@ -47,7 +47,7 @@ class OpenStackDriver(AbstractSystemsDriver):
BOOT_MODE_MAP = {
'Legacy': 'bios',
'Uefi': 'uefi',
'UEFI': 'uefi',
}
BOOT_MODE_MAP_REV = {v: k for k, v in BOOT_MODE_MAP.items()}
@ -246,7 +246,7 @@ class OpenStackDriver(AbstractSystemsDriver):
def get_boot_mode(self, identity):
"""Get computer system boot mode.
:returns: either *Uefi* or *Legacy* as `str` or `None` if
:returns: either *UEFI* or *Legacy* as `str` or `None` if
current boot mode can't be determined
"""
instance = self._get_instance(identity)
@ -261,7 +261,7 @@ class OpenStackDriver(AbstractSystemsDriver):
"""Set computer system boot mode.
:param boot_mode: string literal requesting boot mode
change on the system. Valid values are: *Uefi*, *Legacy*.
change on the system. Valid values are: *UEFI*, *Legacy*.
:raises: `error.FishyError` if boot mode can't be set
"""

View File

@ -282,7 +282,7 @@ class LibvirtDriverTestCase(base.BaseTestCase):
domain_mock = conn_mock.lookupByUUID.return_value
domain_mock.XMLDesc.return_value = data
self.test_driver.set_boot_mode(self.uuid, 'Uefi')
self.test_driver.set_boot_mode(self.uuid, 'UEFI')
conn_mock = libvirt_rw_mock.return_value
conn_mock.defineXML.assert_called_once_with(mock.ANY)
@ -297,7 +297,7 @@ class LibvirtDriverTestCase(base.BaseTestCase):
domain_mock = conn_mock.lookupByUUID.return_value
domain_mock.XMLDesc.return_value = data
self.test_driver.set_boot_mode(self.uuid, 'Uefi')
self.test_driver.set_boot_mode(self.uuid, 'UEFI')
conn_mock = libvirt_rw_mock.return_value
xml_document = conn_mock.defineXML.call_args[0][0]
@ -404,7 +404,7 @@ class LibvirtDriverTestCase(base.BaseTestCase):
domain_mock = conn_mock.lookupByUUID.return_value
domain_mock.XMLDesc.return_value = data
self.test_driver.set_boot_mode(self.uuid, 'Uefi')
self.test_driver.set_boot_mode(self.uuid, 'UEFI')
conn_mock = libvirt_rw_mock.return_value
xml_document = conn_mock.defineXML.call_args[0][0]