From: sukhdev Date: Mon, 16 Sep 2013 19:00:13 +0000 (-0700) Subject: Port binding registration with NeutronDbPlugin causes Neutron crash X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=9b18a8035f2e804040f5d0778c83cf72b06b6c41;p=openstack-build%2Fneutron-build.git Port binding registration with NeutronDbPlugin causes Neutron crash 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 --- diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index e3e646c81..dc520b7ce 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -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