Fix iDRAC import configuration missing task handling

Older iDRACs delete the task after 1 minute, since 5.00.00.00
the task is being kept for 10 minutes.
However, if encountering the issue, handle it and advise
user to either upgrade iDRAC if not already or decrease
checking interval.
Prior this node got stuck in wait mode forever if task was
deleted as raised exception by periodic didn't make the step
fail.

Change-Id: I5d500b7d53e9804aa3b54dc400d8621f40cd5d0c
This commit is contained in:
Aija Jauntēva 2021-08-20 11:18:00 -04:00
parent 1c3e20d859
commit c174380db3
3 changed files with 54 additions and 1 deletions

View File

@ -504,7 +504,29 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
"""Checks progress of running import configuration task"""
node = task.node
task_monitor = redfish_utils.get_task_monitor(node, task_monitor_url)
try:
task_monitor = redfish_utils.get_task_monitor(
node, task_monitor_url)
except exception.RedfishError as e:
error_msg = (_("Failed import configuration task: "
"%(task_monitor_url)s. Message: '%(message)s'. "
"Most likely this happened because could not find "
"the task anymore as it got deleted by iDRAC. "
"If not already, upgrade iDRAC firmware to "
"5.00.00.00 or later that preserves tasks for "
"longer or decrease "
"[drac]query_import_config_job_status_interval")
% {'task_monitor_url': task_monitor_url,
'message': e})
log_msg = ("Import configuration task failed for node "
"%(node)s. %(error)s" % {'node': task.node.uuid,
'error': error_msg})
info = node.driver_internal_info
info.pop('import_task_monitor_url', None)
node.driver_internal_info = info
node.save()
self._set_failed(task, log_msg, error_msg)
return
if not task_monitor.is_processing:
import_task = task_monitor.get_task()

View File

@ -1088,6 +1088,25 @@ class DracRedfishManagementTestCase(test_utils.BaseDracTest):
._check_import_configuration_task
.assert_called_once_with(task, '/TaskService/123'))
@mock.patch.object(redfish_utils, 'get_task_monitor', autospec=True)
def test__check_import_configuration_task_missing(
self, mock_get_task_monitor):
mock_get_task_monitor.side_effect = exception.RedfishError(
error='Task not found')
self.management._set_success = mock.Mock()
self.management._set_failed = mock.Mock()
with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task:
self.management._check_import_configuration_task(
task, '/TaskService/123')
self.management._set_failed.assert_called_once_with(
task, mock.ANY, mock.ANY)
self.management._set_success.assert_not_called()
self.assertIsNone(
task.node.driver_internal_info.get('import_task_monitor_url'))
@mock.patch.object(drac_mgmt.LOG, 'debug', autospec=True)
@mock.patch.object(redfish_utils, 'get_task_monitor', autospec=True)
def test__check_import_configuration_task_still_processing(

View File

@ -0,0 +1,12 @@
---
fixes:
- |
Fix ``idrac-redfish`` clean/deploy step ``import_configuration`` to handle
completed import configuration tasks that are deleted by iDRAC before
Ironic has checked task's status.
Prior iDRAC firmware version 5.00.00.00 completed tasks are deleted after
1 minute in iDRAC Redfish. That is not always sufficient to check for
their status in periodic check that runs every minute by default. Before
this fix node got stuck in wait mode forever. This is fixed by failing the
step with error informing to decrease periodic check interval or upgrade
iDRAC firmware if not done already.