Merge "Detect ilo6 and redirect to redfish"

This commit is contained in:
Zuul 2024-03-08 02:25:13 +00:00 committed by Gerrit Code Review
commit c139b22e8a
3 changed files with 38 additions and 1 deletions

View File

@ -79,12 +79,21 @@ def _get_power_state(node):
# Check the current power state.
try:
power_status = ilo_object.get_host_power_status()
except ilo_error.IloError as ilo_exception:
LOG.error("iLO get_power_state failed for node %(node_id)s with "
"error: %(error)s.",
{'node_id': node.uuid, 'error': ilo_exception})
operation = _('iLO get_power_status')
if 'RIBCLI is disabled' in str(ilo_exception):
warn_msg = ("Node %s appears to have a disabled API "
"required for the \'%s\' hardware type to function. "
"Please consider using the \'redfish\' hardware "
"type." % (node.uuid, node.driver))
manager_utils.node_history_record(node, event=warn_msg,
event_type=node.provision_state,
error=True)
raise exception.IloOperationError(operation=operation,
error=warn_msg)
raise exception.IloOperationError(operation=operation,
error=ilo_exception)

View File

@ -73,6 +73,25 @@ class IloPowerInternalMethodsTestCase(test_common.BaseIloTest):
self.node)
ilo_mock_object.get_host_power_status.assert_called_once_with()
@mock.patch.object(manager_utils, 'node_history_record', autospec=True)
def test__get_power_state_ilo6_redirect(self, record_history_mock,
get_ilo_object_mock):
ilo_mock_object = get_ilo_object_mock.return_value
exc = ilo_error.IloError('Error: RIBCLI is disabled.')
ilo_mock_object.get_host_power_status.side_effect = exc
self.assertRaisesRegex(exception.IloOperationError,
'appears to have a disabled API required',
ilo_power._get_power_state,
self.node)
ilo_mock_object.get_host_power_status.assert_called_once_with()
record_history_mock.assert_called_once_with(
mock.ANY,
event=('Node %s appears to have a disabled API required for the '
'\'ilo\' hardware type to function. Please consider using '
'the \'redfish\' hardware type.' % self.node.uuid),
event_type='available',
error=True)
def test__set_power_state_invalid_state(self, get_ilo_object_mock):
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Fixes a vague error when attempting to use the ``ilo`` hardware type with
iLO6 hardware, by returning a more specific error suggesting action to
take in order to remedy the issue. Specifically, one of the API's
used by the ``ilo`` hardware type is disabled in iLO6 BMCs in favor
of users utilizing Redfish. Operators are advised to utilize the
``redfish`` hardware type for these machines.