Ignore IPMI Address for IPMI Bridged nodes
When a node is behind an IPMI bridge the IPMI address stored in ironic is not a trust worthy identifier for recognising a node returning its introspection data, as it can be the same or multiple nodes. It will also cause unique constraint errors as the database will not allow multiple bmc_address attribute entries with the same value. This patch adds detection for ipmi bridging to the get_ipmi_address function, so if ipmi bridging is enabled then it returns None, and the node is added without any bmc_address listed. Change-Id: I09d17dffcde0f4a023bb03e1bce88bcf725cdf0a Closes-Bug: #1488501
This commit is contained in:
parent
038f72cf3c
commit
6d06f09e89
@ -171,6 +171,12 @@ class TestGetIpmiAddress(base.BaseTest):
|
||||
ip = utils.get_ipmi_address(node)
|
||||
self.assertEqual(ip, '192.168.1.1')
|
||||
|
||||
def test_ipmi_bridging_enabled(self):
|
||||
node = mock.Mock(spec=['driver_info', 'uuid'],
|
||||
driver_info={'ipmi_address': 'www.example.com',
|
||||
'ipmi_bridging': 'single'})
|
||||
self.assertIsNone(utils.get_ipmi_address(node))
|
||||
|
||||
|
||||
class TestCapabilities(unittest.TestCase):
|
||||
|
||||
|
@ -157,6 +157,10 @@ def get_auth_strategy():
|
||||
|
||||
def get_ipmi_address(node):
|
||||
ipmi_fields = ['ipmi_address'] + CONF.ipmi_address_fields
|
||||
# NOTE(sambetts): IPMI Address is useless to us if bridging is enabled so
|
||||
# just ignore it and return None
|
||||
if node.driver_info.get("ipmi_bridging", "no") != "no":
|
||||
return
|
||||
for name in ipmi_fields:
|
||||
value = node.driver_info.get(name)
|
||||
if value:
|
||||
|
Loading…
Reference in New Issue
Block a user