Add fallback test in __check_interfaces_correctness
In some cases, it may be OK for there to be an admin interface that is outside the admin network. To support this case we we will test if the interface mac matches the mac that contacted us, if this is the case, we will use this interface. This prevents the NetworkManager from erroneously removing interfaces from an otherwise valid node. Resolves-bug: #1271043 Change-Id: I04120d538e2efba6cb7a04cfbd7cb4852f2576c9
This commit is contained in:
parent
807ecd7b3c
commit
752aa4f87b
|
@ -629,6 +629,9 @@ class NetworkManager(object):
|
|||
# Interface was founded
|
||||
admin_interface = interface
|
||||
break
|
||||
elif interface['mac'].lower() == node.mac:
|
||||
admin_interface = interface
|
||||
break
|
||||
|
||||
if not admin_interface:
|
||||
raise errors.InvalidInterfacesInfo(
|
||||
|
|
|
@ -294,6 +294,16 @@ class TestHandlers(BaseIntegrationTest):
|
|||
self.assertNotEquals(node.timestamp, timestamp)
|
||||
self.assertEquals('new', node.manufacturer)
|
||||
|
||||
def test_node_create_ip_not_in_admin_range(self):
|
||||
node = self.env.create_node(api=False)
|
||||
|
||||
# Set IP outside of admin network range on eth1
|
||||
node.meta['interfaces'][1]['ip'] = '10.21.0.3'
|
||||
self.env.network_manager.update_interfaces_info(node)
|
||||
|
||||
# node.mac == eth0 mac so eth0 should now be admin interface
|
||||
self.assertEquals(node.admin_interface.name, 'eth0')
|
||||
|
||||
def test_node_create_ext_mac(self):
|
||||
node1 = self.env.create_node(
|
||||
api=False
|
||||
|
|
Loading…
Reference in New Issue