Merge "Ignore IPMI Address for IPMI Bridged nodes"

This commit is contained in:
Jenkins 2015-09-22 10:18:45 +00:00 committed by Gerrit Code Review
commit 4c6c350447
2 changed files with 10 additions and 0 deletions

View File

@ -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):

View File

@ -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: