]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Don't process network_delete events on OVS agent
authorKevin Benton <blak111@gmail.com>
Wed, 24 Jun 2015 09:15:29 +0000 (02:15 -0700)
committerKevin Benton <blak111@gmail.com>
Wed, 24 Jun 2015 09:15:29 +0000 (02:15 -0700)
There is no reason to reclaim the local VLAN on a network_delete
event since it will be reclaimed when the last port is deleted anyway.

This method was racey with recent port creation events and lead to
occasional traces when it would yank the local VLAN out from underneath
an ongoing port wiring process.

Change-Id: I5eee6175c053006b35b6efe274d27931a9d5d89f
Closes-Bug: #1468251

neutron/plugins/openvswitch/agent/ovs_neutron_agent.py
neutron/tests/unit/plugins/openvswitch/agent/test_ovs_neutron_agent.py

index 968fec88a2654c7c3372ae337a7fa4f89dfc17dc..6c966d561f89617414b22fdebf7299912083b2fd 100644 (file)
@@ -336,7 +336,6 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
         # Define the listening consumers for the agent
         consumers = [[topics.PORT, topics.UPDATE],
                      [topics.PORT, topics.DELETE],
-                     [topics.NETWORK, topics.DELETE],
                      [constants.TUNNEL, topics.UPDATE],
                      [constants.TUNNEL, topics.DELETE],
                      [topics.SECURITY_GROUP, topics.UPDATE],
@@ -354,17 +353,6 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
             if vif_id in vlan_mapping.vif_ports:
                 return network_id
 
-    def network_delete(self, context, **kwargs):
-        LOG.debug("network_delete received")
-        network_id = kwargs.get('network_id')
-        LOG.debug("Delete %s", network_id)
-        # The network may not be defined on this agent
-        lvm = self.local_vlan_map.get(network_id)
-        if lvm:
-            self.reclaim_local_vlan(network_id)
-        else:
-            LOG.debug("Network %s not used on agent.", network_id)
-
     def port_update(self, context, **kwargs):
         port = kwargs.get('port')
         # Put the port identifier in the updated_ports set.
index fec863aa523a1fa546e3e107b6f386f2469992bb..e2d2dfc37b38693aa0ee9ad1925aa076e982ee67 100644 (file)
@@ -506,19 +506,6 @@ class TestOvsNeutronAgent(object):
             report_st.assert_called_with(self.agent.context,
                                          self.agent.agent_state, True)
 
-    def test_network_delete(self):
-        with mock.patch.object(self.agent, "reclaim_local_vlan") as recl_fn,\
-                mock.patch.object(self.agent.tun_br,
-                                  "cleanup_tunnel_port") as clean_tun_fn:
-            self.agent.network_delete("unused_context",
-                                      network_id="123")
-            self.assertFalse(recl_fn.called)
-            self.agent.local_vlan_map["123"] = "LVM object"
-            self.agent.network_delete("unused_context",
-                                      network_id="123")
-            self.assertFalse(clean_tun_fn.called)
-            recl_fn.assert_called_with("123")
-
     def test_port_update(self):
         port = {"id": "123",
                 "network_id": "124",