Fix Redfish handle no continuous override boot src

Some hardware Redfish services have dropped support for continuously
overriding the boot source when the boot mode is Unified Extensible
Firmware Interface (UEFI). See this discussion:
http://lists.openstack.org/pipermail/openstack-discuss/2020-April/014543.html

A workaround falls back to one-time override, restoring it on every
reboot or power on. [1] However, it does not work, because, per the
Distributed Management Task Force (DMTF) Redfish standard, one-time
override is disabled on the next boot cycle. [2] This fixes that by
explicitly setting the boot source override to one-time every time it is
restored.

[1] https://storyboard.openstack.org/#!/story/2007527
[2] https://redfish.dmtf.org/schemas/v1/ComputerSystem.v1_11_0.json

# Conflicts:
#	ironic/drivers/modules/redfish/management.py

Story: 2007733
Task: 39897
Change-Id: I6f5a11a77e7b16cdd0d837fdec51c3e9aeea9a31
(cherry picked from commit c56777929a)
This commit is contained in:
Richard Pioso 2020-05-28 21:54:42 -04:00
parent e314d95564
commit 49ce9993e1
2 changed files with 23 additions and 11 deletions

View File

@ -57,34 +57,35 @@ if sushy:
BOOT_DEVICE_PERSISTENT_MAP.items()} BOOT_DEVICE_PERSISTENT_MAP.items()}
def _set_boot_device(task, system, device, def _set_boot_device(task, system, device, persistent=False):
enabled=sushy.BOOT_SOURCE_ENABLED_ONCE):
"""An internal routine to set the boot device. """An internal routine to set the boot device.
:param task: a task from TaskManager. :param task: a task from TaskManager.
:param system: a Redfish System object. :param system: a Redfish System object.
:param device: the Redfish boot device. :param device: the Redfish boot device.
:param enabled: Redfish boot device persistence value. :param persistent: Boolean value. True if the boot device will
persist to all future boots, False if not.
Default: False.
:raises: SushyError on an error from the Sushy library :raises: SushyError on an error from the Sushy library
""" """
desired_enabled = enabled desired_enabled = BOOT_DEVICE_PERSISTENT_MAP_REV[persistent]
current_enabled = system.boot.get('enabled') current_enabled = system.boot.get('enabled')
# NOTE(etingof): this can be racy, esp if BMC is not RESTful # NOTE(etingof): this can be racy, esp if BMC is not RESTful
new_enabled = (desired_enabled enabled = (desired_enabled
if desired_enabled != current_enabled else None) if desired_enabled != current_enabled else None)
use_new_set_system_boot = True use_new_set_system_boot = True
try: try:
try: try:
system.set_system_boot_options(device, enabled=new_enabled) system.set_system_boot_options(device, enabled=enabled)
except AttributeError: except AttributeError:
new_enabled = enabled enabled = desired_enabled
use_new_set_system_boot = False use_new_set_system_boot = False
system.set_system_boot_source(device, enabled=new_enabled) system.set_system_boot_source(device, enabled=enabled)
except sushy.exceptions.SushyError as e: except sushy.exceptions.SushyError as e:
if new_enabled == sushy.BOOT_SOURCE_ENABLED_CONTINUOUS: if desired_enabled == sushy.BOOT_SOURCE_ENABLED_CONTINUOUS:
# NOTE(dtantsur): continuous boot device settings have been # NOTE(dtantsur): continuous boot device settings have been
# removed from Redfish, and some vendors stopped supporting # removed from Redfish, and some vendors stopped supporting
# it before an alternative was provided. As a work around, # it before an alternative was provided. As a work around,
@ -206,7 +207,7 @@ class RedfishManagement(base.ManagementInterface):
try: try:
_set_boot_device( _set_boot_device(
task, system, BOOT_DEVICE_MAP_REV[device], task, system, BOOT_DEVICE_MAP_REV[device],
enabled=BOOT_DEVICE_PERSISTENT_MAP_REV[persistent]) persistent=persistent)
except sushy.exceptions.SushyError as e: except sushy.exceptions.SushyError as e:
error_msg = (_('Redfish set boot device failed for node ' error_msg = (_('Redfish set boot device failed for node '
'%(node)s. Error: %(error)s') % '%(node)s. Error: %(error)s') %

View File

@ -0,0 +1,11 @@
---
fixes:
- |
Fixes a workaround for hardware that does not support persistent
boot device setting with the ``redfish`` or ``idrac-redfish``
management interface implementation. When such situation is
detected, ironic falls back to one-time boot device setting,
restoring it on every reboot or power on.
For more information, see `story 2007733
<https://storyboard.openstack.org/#!/story/2007733>`_.