Scan for mac through all devices
The first device the agent happens to pick could be something without a mac address like a 6in6 interface. This was causing the agent to fail to start if it was unlucky enough to pick that address. This patch just adjusts the logic to keep iterating through the list until we find a mac. Closes-Bug: #1669087 Change-Id: I6e934a2dff8fd441e1c70c9a5857fd6150835e2a
This commit is contained in:
parent
f3f87f8d7f
commit
42631e3117
|
@ -716,8 +716,10 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
|
|||
list(self.bridge_mappings.values())[0])
|
||||
else:
|
||||
devices = ip_lib.IPWrapper().get_devices(True)
|
||||
if devices:
|
||||
mac = ip_lib.get_device_mac(devices[0].name)
|
||||
for device in devices:
|
||||
mac = ip_lib.get_device_mac(device.name)
|
||||
if mac:
|
||||
break
|
||||
else:
|
||||
LOG.error(_LE("Unable to obtain MAC address for unique ID. "
|
||||
"Agent terminated!"))
|
||||
|
|
|
@ -871,11 +871,11 @@ class TestLinuxBridgeManager(base.BaseTestCase):
|
|||
mock.patch.object(
|
||||
ip_lib,
|
||||
"get_device_mac",
|
||||
return_value='16:63:69:10:a0:59') as mock_gim:
|
||||
side_effect=[None, '16:63:69:10:a0:59']) as mock_gim:
|
||||
|
||||
agent_id = lbm.get_agent_id()
|
||||
self.assertEqual("lb16636910a059", agent_id)
|
||||
mock_gim.assert_called_with("eth1")
|
||||
mock_gim.assert_has_calls([mock.call("eth1"), mock.call("eth2")])
|
||||
|
||||
|
||||
class TestLinuxBridgeRpcCallbacks(base.BaseTestCase):
|
||||
|
|
Loading…
Reference in New Issue