Merge "Do not rely on the older ipmi_address field on lookup"
This commit is contained in:
commit
a530a02e1e
|
@ -222,9 +222,9 @@ class ValidateInterfacesHook(base.ProcessingHook):
|
||||||
"""Validate information about network interfaces."""
|
"""Validate information about network interfaces."""
|
||||||
|
|
||||||
bmc_address = utils.get_ipmi_address_from_data(introspection_data)
|
bmc_address = utils.get_ipmi_address_from_data(introspection_data)
|
||||||
if bmc_address:
|
# Overwrite the old ipmi_address field to avoid inconsistency
|
||||||
introspection_data['ipmi_address'] = bmc_address
|
introspection_data['ipmi_address'] = bmc_address
|
||||||
else:
|
if not bmc_address:
|
||||||
LOG.debug('No BMC address provided in introspection data, '
|
LOG.debug('No BMC address provided in introspection data, '
|
||||||
'assuming virtual environment', data=introspection_data)
|
'assuming virtual environment', data=introspection_data)
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ def _store_logs(introspection_data, node_info):
|
||||||
def _find_node_info(introspection_data, failures):
|
def _find_node_info(introspection_data, failures):
|
||||||
try:
|
try:
|
||||||
return node_cache.find_node(
|
return node_cache.find_node(
|
||||||
bmc_address=introspection_data.get('ipmi_address'),
|
bmc_address=utils.get_ipmi_address_from_data(introspection_data),
|
||||||
mac=utils.get_valid_macs(introspection_data))
|
mac=utils.get_valid_macs(introspection_data))
|
||||||
except utils.NotFoundInCacheError as exc:
|
except utils.NotFoundInCacheError as exc:
|
||||||
not_found_hook = plugins_base.node_not_found_hook_manager()
|
not_found_hook = plugins_base.node_not_found_hook_manager()
|
||||||
|
|
|
@ -112,6 +112,18 @@ class TestProcess(BaseProcessTest):
|
||||||
self.process_mock.assert_called_once_with(self.node_info, self.node,
|
self.process_mock.assert_called_once_with(self.node_info, self.node,
|
||||||
self.data)
|
self.data)
|
||||||
|
|
||||||
|
def test_ipmi_not_detected_with_old_field(self):
|
||||||
|
self.inventory['bmc_address'] = '0.0.0.0'
|
||||||
|
self.data['ipmi_address'] = '0.0.0.0'
|
||||||
|
process.process(self.data)
|
||||||
|
|
||||||
|
self.find_mock.assert_called_once_with(bmc_address=None, mac=mock.ANY)
|
||||||
|
actual_macs = self.find_mock.call_args[1]['mac']
|
||||||
|
self.assertEqual(sorted(self.all_macs), sorted(actual_macs))
|
||||||
|
self.cli.node.get.assert_called_once_with(self.uuid)
|
||||||
|
self.process_mock.assert_called_once_with(self.node_info, self.node,
|
||||||
|
self.data)
|
||||||
|
|
||||||
def test_not_found_in_cache(self):
|
def test_not_found_in_cache(self):
|
||||||
self.find_mock.side_effect = utils.Error('not found')
|
self.find_mock.side_effect = utils.Error('not found')
|
||||||
self.assertRaisesRegex(utils.Error,
|
self.assertRaisesRegex(utils.Error,
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
The older ``ipmi_address`` field in the introspection data no longer has
|
||||||
|
priority over the newer ``bmc_address`` inventory field during lookup.
|
||||||
|
This fixes lookup based on MAC addresses, when the BMC address is reported
|
||||||
|
as ``0.0.0.0`` for any reason (see `bug 1714944
|
||||||
|
<https://bugs.launchpad.net/ironic-python-agent/+bug/1714944>`_).
|
Loading…
Reference in New Issue