Merge "Handle servicing failures in the Redfish BIOS interface" into stable/2024.1

This commit is contained in:
Zuul 2024-04-15 10:31:32 +00:00 committed by Gerrit Code Review
commit 4081a71633
2 changed files with 17 additions and 6 deletions

View File

@ -1561,6 +1561,22 @@ def reboot_to_finish_step(task, timeout=None):
return get_async_step_return_state(task.node)
def step_error_handler(task, logmsg, errmsg=None):
"""Run the correct handler for the current step.
:param task: a TaskManager instance.
:param logmsg: Message to be logged.
:param errmsg: Message for the user. Optional, if not provided `logmsg` is
used.
"""
if task.node.provision_state in [states.CLEANING, states.CLEANWAIT]:
manager_utils.cleaning_error_handler(task, logmsg, errmsg=errmsg)
elif task.node.provision_state in [states.DEPLOYING, states.DEPLOYWAIT]:
manager_utils.deploying_error_handler(task, logmsg, errmsg=errmsg)
elif task.node.provision_state in [states.SERVICING, states.SERVICEWAIT]:
manager_utils.servicing_error_handler(task, logmsg, errmsg=errmsg)
def get_root_device_for_deploy(node):
"""Get a root device requested for deployment or None.

View File

@ -18,8 +18,6 @@ import sushy
from ironic.common import exception
from ironic.common.i18n import _
from ironic.common import states
from ironic.conductor import utils as manager_utils
from ironic.drivers import base
from ironic.drivers.modules import deploy_utils
from ironic.drivers.modules.redfish import utils as redfish_utils
@ -364,7 +362,4 @@ class RedfishBIOS(base.BIOSInterface):
last_error = (_('Redfish BIOS apply_configuration step failed. '
'Attributes %(attrs)s are not updated.') %
{'attrs': attrs_not_updated})
if task.node.provision_state in [states.CLEANING, states.CLEANWAIT]:
manager_utils.cleaning_error_handler(task, last_error)
if task.node.provision_state in [states.DEPLOYING, states.DEPLOYWAIT]:
manager_utils.deploying_error_handler(task, error_msg, last_error)
deploy_utils.step_error_handler(task, error_msg, last_error)