Follow up of Use OOB inspection to fetch MACs for IB inspection

This is a follow up to commit 05df3d7aa4
addressing issues with excessive logging and adding a missing unit test.

Change-Id: I827fa5dd813acbf1d478c64508f10c42d1460b4a
This commit is contained in:
Jacob Anders 2021-03-23 20:55:32 +10:00
parent acd4b451dc
commit f96ce69818
4 changed files with 19 additions and 7 deletions

View File

@ -256,8 +256,8 @@ class Inspector(base.InspectInterface):
'node': task.node.uuid})
except exception.UnsupportedDriverExtension:
LOG.info('Pre-creating ports prior to inspection not supported'
' on node %s.', task.node.uuid)
LOG.debug('Pre-creating ports prior to inspection not supported'
' on node %s.', task.node.uuid)
ironic_manages_boot = _ironic_manages_boot(
task, raise_exc=CONF.inspector.require_managed_boot)

View File

@ -370,5 +370,5 @@ def get_enabled_macs(task, system):
if nic_state == sushy.STATE_ENABLED}
return enabled_macs
else:
LOG.warning("No NIC information discovered "
"for node %(node)s", {'node': task.node.uuid})
LOG.debug("No ethernet interface information is available "
"for node %(node)s", {'node': task.node.uuid})

View File

@ -103,6 +103,20 @@ class RedfishInspectTestCase(db_base.DbTestCase):
mock_get_system.assert_called_once_with(task.node)
self.assertEqual(expected_properties, task.node.properties)
@mock.patch.object(redfish_utils, 'get_system', autospec=True)
@mock.patch.object(inspect_utils, 'create_ports_if_not_exist',
autospec=True)
def test_inspect_port_creation(self, mock_create_ports_if_not_exist,
mock_get_system):
self.init_system_mock(mock_get_system.return_value)
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
task.driver.inspect.inspect_hardware(task)
result = task.driver.management.get_mac_addresses(task)
inspect_utils.create_ports_if_not_exist.assert_called_once_with(
task, result, mock.ANY)
@mock.patch.object(redfish_utils, 'get_system', autospec=True)
def test_inspect_hardware_fail_missing_cpu(self, mock_get_system):
system_mock = self.init_system_mock(mock_get_system.return_value)

View File

@ -1515,11 +1515,9 @@ class RedfishManagementTestCase(db_base.DbTestCase):
@mock.patch.object(redfish_utils, 'get_system', autospec=True)
def test_get_mac_addresses_no_ports_found(self, mock_get_system):
expected_properties = None
system_mock = self.init_system_mock(mock_get_system.return_value)
system_mock.ethernet_interfaces.summary = None
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
self.assertEqual(expected_properties,
task.driver.management.get_mac_addresses(task))
self.assertIsNone(task.driver.management.get_mac_addresses(task))