Always try to delete bridge for ID on network_delete

If network_deletes are received before port creates
are processed, the agent might not have the network in
it's map even though it has a bridge to delete.

This adjusts the logic to always try to delete the bridge
corresponding to a network_id even if it's not in the
network_map yet.

Change-Id: I5e72bff2ffd9568f272ed48187ad543ab5a3d1ec
Closes-Bug: #1698271
This commit is contained in:
Kevin Benton 2017-06-19 03:05:39 -07:00
parent e55eeece02
commit 499faa3074
2 changed files with 7 additions and 5 deletions

View File

@ -848,9 +848,6 @@ class LinuxBridgeRpcCallbacks(
"bridge_mappings and cannot be deleted."),
network_id)
return
else:
LOG.debug("Network %s is not on this agent.", network_id)
return
bridge_name = self.agent.mgr.get_bridge_name(network_id)
LOG.debug("Delete %s", bridge_name)

View File

@ -942,11 +942,16 @@ class TestLinuxBridgeRpcCallbacks(base.BaseTestCase):
segment.segmentation_id = 1
self.lb_rpc.network_map['net_id'] = segment
def test_network_delete(self):
def test_network_delete_mapped_net(self):
mock_net = mock.Mock()
mock_net.physical_network = None
self._test_network_delete({NETWORK_ID: mock_net})
self.lb_rpc.network_map = {NETWORK_ID: mock_net}
def test_network_delete_unmapped_net(self):
self._test_network_delete({})
def _test_network_delete(self, net_map):
self.lb_rpc.network_map = net_map
with mock.patch.object(self.lb_rpc.agent.mgr,
"get_bridge_name") as get_br_fn,\