diff options
author | Jacob Anders <janders@redhat.com> | 2023-04-17 14:39:50 +1000 |
---|---|---|
committer | Jacob Anders <janders@redhat.com> | 2023-05-02 22:09:26 +1000 |
commit | f10958a542dd58ff301c386ce0981ec218e9eef6 (patch) | |
tree | 15a5840fd657fd052dd8256ec0cab3b17bf3d102 /ironic/drivers/modules/redfish/management.py | |
parent | 8ef9db15704c0c2cb1342c7c1554bfa8d8a7a2e3 (diff) | |
download | ironic-f10958a542dd58ff301c386ce0981ec218e9eef6.tar.gz |
Handle MissingAttributeError when using OOB inspections to fetch MACs
Currently, if an attempt is made to fetch MAC address information using
OOB inspection on a Redfish-managed node and EthernetInterfaces
attribute is missing on the node, inspection fails due to a
MissingAttributeError exception being raised by sushy. This change adds
catching and handling this exception.
Change-Id: I6f16da05e19c7efc966128fdf79f13546f51b5a6
Diffstat (limited to 'ironic/drivers/modules/redfish/management.py')
-rw-r--r-- | ironic/drivers/modules/redfish/management.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ironic/drivers/modules/redfish/management.py b/ironic/drivers/modules/redfish/management.py index a669d09bc..8bd7058a5 100644 --- a/ironic/drivers/modules/redfish/management.py +++ b/ironic/drivers/modules/redfish/management.py @@ -1197,9 +1197,18 @@ class RedfishManagement(base.ManagementInterface): :raises: RedfishError on an error from the Sushy library :returns: A list of MAC addresses for the node """ + system = redfish_utils.get_system(task.node) try: - system = redfish_utils.get_system(task.node) return list(redfish_utils.get_enabled_macs(task, system)) + # NOTE(janders) we should handle MissingAttributeError separately + # from other SushyErrors - some servers (e.g. some Cisco UCSB and UCSX + # blades) are missing EthernetInterfaces attribute yet could be + # provisioned successfully if MAC information is provided manually AND + # this exception is caught and handled accordingly. + except sushy.exceptions.MissingAttributeError as exc: + LOG.warning('Cannot get MAC addresses for node %(node)s: %(exc)s', + {'node': task.node.uuid, 'exc': exc}) + # if the exception is not a MissingAttributeError, raise it except sushy.exceptions.SushyError as exc: msg = (_('Failed to get network interface information on node ' '%(node)s: %(exc)s') |