Merge "Revert "Stop skipping compute owner in Linux Bridge loop""
This commit is contained in:
commit
d4a1f28879
@ -475,15 +475,25 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
|
|||||||
physical_network,
|
physical_network,
|
||||||
segmentation_id):
|
segmentation_id):
|
||||||
return False
|
return False
|
||||||
# Check if device needs to be added to bridge
|
# Avoid messing with plugging devices into a bridge that the agent
|
||||||
if not bridge_lib.BridgeDevice.get_interface_bridge(
|
# does not own
|
||||||
tap_device_name):
|
if not device_owner.startswith(constants.DEVICE_OWNER_COMPUTE_PREFIX):
|
||||||
|
# Check if device needs to be added to bridge
|
||||||
|
if not bridge_lib.BridgeDevice.get_interface_bridge(
|
||||||
|
tap_device_name):
|
||||||
|
data = {'tap_device_name': tap_device_name,
|
||||||
|
'bridge_name': bridge_name}
|
||||||
|
LOG.debug("Adding device %(tap_device_name)s to bridge "
|
||||||
|
"%(bridge_name)s", data)
|
||||||
|
if bridge_lib.BridgeDevice(bridge_name).addif(tap_device_name):
|
||||||
|
return False
|
||||||
|
else:
|
||||||
data = {'tap_device_name': tap_device_name,
|
data = {'tap_device_name': tap_device_name,
|
||||||
|
'device_owner': device_owner,
|
||||||
'bridge_name': bridge_name}
|
'bridge_name': bridge_name}
|
||||||
LOG.debug("Adding device %(tap_device_name)s to bridge "
|
LOG.debug("Skip adding device %(tap_device_name)s to "
|
||||||
"%(bridge_name)s", data)
|
"%(bridge_name)s. It is owned by %(device_owner)s and "
|
||||||
if bridge_lib.BridgeDevice(bridge_name).addif(tap_device_name):
|
"thus added elsewhere.", data)
|
||||||
return False
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def plug_interface(self, network_id, network_segment, tap_name,
|
def plug_interface(self, network_id, network_segment, tap_name,
|
||||||
|
@ -510,6 +510,15 @@ class TestLinuxBridgeManager(base.BaseTestCase):
|
|||||||
p_const.TYPE_VLAN, "physnet1", None, "tap1",
|
p_const.TYPE_VLAN, "physnet1", None, "tap1",
|
||||||
"foo")
|
"foo")
|
||||||
|
|
||||||
|
def test_add_tap_interface_owner_compute(self):
|
||||||
|
with mock.patch.object(ip_lib, "device_exists"):
|
||||||
|
with mock.patch.object(self.lbm, "ensure_local_bridge"):
|
||||||
|
self.assertTrue(self.lbm.add_tap_interface("123",
|
||||||
|
p_const.TYPE_LOCAL,
|
||||||
|
"physnet1", None,
|
||||||
|
"tap1",
|
||||||
|
"compute:1"))
|
||||||
|
|
||||||
def _test_add_tap_interface(self, dev_owner_prefix):
|
def _test_add_tap_interface(self, dev_owner_prefix):
|
||||||
with mock.patch.object(ip_lib, "device_exists") as de_fn:
|
with mock.patch.object(ip_lib, "device_exists") as de_fn:
|
||||||
de_fn.return_value = False
|
de_fn.return_value = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user