diff options
author | Zuul <zuul@review.opendev.org> | 2021-03-22 13:16:06 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-03-22 13:16:06 +0000 |
commit | acd4b451dc866f4aee48b46f958cc46fd2220d09 (patch) | |
tree | 129e16ddbb3305ff31da17901a8336df0358ed86 /ironic/drivers/modules/redfish/management.py | |
parent | 8251885db551b4ff539e9ebd99f3e436a65308b6 (diff) | |
parent | 05df3d7aa4aa7a1fd25a2f2d55726197e1b5f9df (diff) | |
download | ironic-acd4b451dc866f4aee48b46f958cc46fd2220d09.tar.gz |
Merge "Use OOB inspection to fetch MACs for IB inspection"
Diffstat (limited to 'ironic/drivers/modules/redfish/management.py')
-rw-r--r-- | ironic/drivers/modules/redfish/management.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ironic/drivers/modules/redfish/management.py b/ironic/drivers/modules/redfish/management.py index 32233903c..3dd11ff3d 100644 --- a/ironic/drivers/modules/redfish/management.py +++ b/ironic/drivers/modules/redfish/management.py @@ -1161,3 +1161,22 @@ class RedfishManagement(base.ManagementInterface): self._reset_keys(task, sushy.SECURE_BOOT_RESET_KEYS_DELETE_ALL) LOG.info('Secure boot keys have been removed from node %s', task.node.uuid) + + def get_mac_addresses(self, task): + """Get MAC address information for the node. + + :param task: A TaskManager instance containing the node to act on. + :raises: RedfishConnectionError when it fails to connect to Redfish + :raises: RedfishError on an error from the Sushy library + :returns: a dictionary containing MAC addresses of enabled interfaces + in a {'mac': 'state'} format + """ + try: + system = redfish_utils.get_system(task.node) + return redfish_utils.get_enabled_macs(task, system) + except sushy.exceptions.SushyError as exc: + msg = (_('Failed to get network interface information on node ' + '%(node)s: %(exc)s') + % {'node': task.node.uuid, 'exc': exc}) + LOG.error(msg) + raise exception.RedfishError(error=msg) |