]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Port binding registration with NeutronDbPlugin causes Neutron crash
authorsukhdev <sukhdev@aristanetworks.com>
Mon, 16 Sep 2013 19:00:13 +0000 (12:00 -0700)
committersukhdev <sukhdev@aristanetworks.com>
Wed, 18 Sep 2013 01:41:06 +0000 (18:41 -0700)
fixes bug: 1226169

port binding feature of ML2 plugin registers a callback function with
db_base_plugin_v2.NeutronDbPluginV2, which is invoked during a query of
port DB. This function is registered by name instead by refefence. This
causes wrong context to be passed to the function upon invocation, which
causes the exception. If this query is made during neutron
initilization, Neutron service will fail to start.

This fix changes the registration from function name to function
pointer

Change-Id: I44f7f1a222f80c9ce35f7d49610e52170f76dfd1

neutron/plugins/ml2/plugin.py

index e3e646c81458166e565c61e5693069613d7c1218..dc520b7cef3b95463bc29cbd5dfab284188cd662 100644 (file)
@@ -235,13 +235,13 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
         self.mechanism_manager.unbind_port(mech_context)
         self._update_port_dict_binding(port, binding)
 
-    def _extend_port_dict_binding(self, port_res, port_db):
+    def _ml2_extend_port_dict_binding(self, port_res, port_db):
         # None when called during unit tests for other plugins.
         if port_db.port_binding:
             self._update_port_dict_binding(port_res, port_db.port_binding)
 
     db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(
-        attributes.PORTS, [_extend_port_dict_binding])
+        attributes.PORTS, ['_ml2_extend_port_dict_binding'])
 
     # Note - The following hook methods have "ml2" in their names so
     # that they are not called twice during unit tests due to global