diff options
Diffstat (limited to 'ironic/drivers/modules/redfish/bios.py')
-rw-r--r-- | ironic/drivers/modules/redfish/bios.py | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/ironic/drivers/modules/redfish/bios.py b/ironic/drivers/modules/redfish/bios.py index c2eb8fcbc..44742795e 100644 --- a/ironic/drivers/modules/redfish/bios.py +++ b/ironic/drivers/modules/redfish/bios.py @@ -19,7 +19,6 @@ from oslo_utils import importutils from ironic.common import exception from ironic.common.i18n import _ from ironic.common import states -from ironic.conductor import task_manager from ironic.conductor import utils as manager_utils from ironic.drivers import base from ironic.drivers.modules import deploy_utils @@ -55,20 +54,23 @@ class RedfishBIOS(base.BIOSInterface): driver='redfish', reason=_("Unable to import the sushy library")) - def _parse_allowable_values(self, allowable_values): + def _parse_allowable_values(self, node, allowable_values): """Convert the BIOS registry allowable_value list to expected strings :param allowable_values: list of dicts of valid values for enumeration :returns: list containing only allowable value names """ - # Get name from ValueName if it exists, otherwise use DisplayValueName + # Get name from ValueName if it exists, otherwise use ValueDisplayName new_list = [] for dic in allowable_values: - for key in dic: - if key == 'ValueName' or key == 'DisplayValueName': - new_list.append(dic[key]) - break + key = dic.get('ValueName') or dic.get('ValueDisplayName') + if key: + new_list.append(key) + else: + LOG.warning('Cannot detect the value name for enumeration ' + 'item %(item)s for node %(node)s', + {'item': dic, 'node': node.uuid}) return new_list @@ -130,7 +132,8 @@ class RedfishBIOS(base.BIOSInterface): setting[k] = getattr(reg, k, None) if k == "allowable_values" and isinstance(setting[k], list): - setting[k] = self._parse_allowable_values(setting[k]) + setting[k] = self._parse_allowable_values( + task.node, setting[k]) LOG.debug('Cache BIOS settings for node %(node_uuid)s', {'node_uuid': task.node.uuid}) @@ -185,9 +188,8 @@ class RedfishBIOS(base.BIOSInterface): LOG.error(error_msg) raise exception.RedfishError(error=error_msg) - self.post_reset(task) self._set_reboot(task) - return deploy_utils.get_async_step_return_state(task.node) + return self.post_reset(task) else: current_attrs = bios.attributes LOG.debug('Post factory reset, BIOS configuration for node ' @@ -244,9 +246,8 @@ class RedfishBIOS(base.BIOSInterface): LOG.error(error_msg) raise exception.RedfishError(error=error_msg) - self.post_configuration(task, settings) self._set_reboot_requested(task, attributes) - return deploy_utils.get_async_step_return_state(task.node) + return self.post_configuration(task, settings) else: # Step 2: Verify requested BIOS settings applied requested_attrs = info.get('requested_bios_attrs') @@ -267,8 +268,7 @@ class RedfishBIOS(base.BIOSInterface): :param task: a TaskManager instance containing the node to act on. """ - deploy_utils.prepare_agent_boot(task) - self._reboot(task) + return deploy_utils.reboot_to_finish_step(task) def post_configuration(self, task, settings): """Perform post configuration action to store the BIOS settings. @@ -281,8 +281,7 @@ class RedfishBIOS(base.BIOSInterface): :param task: a TaskManager instance containing the node to act on. :param settings: a list of BIOS settings to be updated. """ - deploy_utils.prepare_agent_boot(task) - self._reboot(task) + return deploy_utils.reboot_to_finish_step(task) def get_properties(self): """Return the properties of the interface. @@ -322,17 +321,6 @@ class RedfishBIOS(base.BIOSInterface): LOG.debug('Verification of BIOS settings for node %(node_uuid)s ' 'successful.', {'node_uuid': task.node.uuid}) - @task_manager.require_exclusive_lock - def _reboot(self, task): - """Reboot the target Redfish service. - - :param task: a TaskManager instance containing the node to act on. - :raises: InvalidParameterValue when the wrong state is specified - or the wrong driver info is specified. - :raises: RedfishError on an error from the Sushy library - """ - manager_utils.node_power_action(task, states.REBOOT) - def _set_reboot(self, task): """Set driver_internal_info flags for deployment or cleaning reboot. |