Detect ilo6 and redirect to redfish

We got a report of ilo6 BMCs not working with the ilo hardware type,
and while information is limited, it seems reasonable to at least log
some information on this subject and start discussion of what should
we do.

Hence the creation of this patch.

See: https://meetings.opendev.org/irclogs/%23openstack-ironic/%23openstack-ironic.2023-07-05.log.html#t2023-07-05T11:06:08
Change-Id: I2d81ef736aca44f455f8233c32c0c8d12267d57f
This commit is contained in:
Julia Kreger 2023-07-12 09:13:05 -07:00
parent 76f68582d6
commit e8cb96efc5
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. # Check the current power state.
try: try:
power_status = ilo_object.get_host_power_status() power_status = ilo_object.get_host_power_status()
except ilo_error.IloError as ilo_exception: except ilo_error.IloError as ilo_exception:
LOG.error("iLO get_power_state failed for node %(node_id)s with " LOG.error("iLO get_power_state failed for node %(node_id)s with "
"error: %(error)s.", "error: %(error)s.",
{'node_id': node.uuid, 'error': ilo_exception}) {'node_id': node.uuid, 'error': ilo_exception})
operation = _('iLO get_power_status') 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, raise exception.IloOperationError(operation=operation,
error=ilo_exception) error=ilo_exception)

View File

@ -73,6 +73,25 @@ class IloPowerInternalMethodsTestCase(test_common.BaseIloTest):
self.node) self.node)
ilo_mock_object.get_host_power_status.assert_called_once_with() 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): def test__set_power_state_invalid_state(self, get_ilo_object_mock):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: 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.