From: Kevin Benton Date: Fri, 14 Mar 2014 19:15:18 +0000 (-0700) Subject: BigSwitch: Sync workaround for port del deadlock X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=9f3392f8984fbeca1d34e41e84b2f0b9d6f03e4d;p=openstack-build%2Fneutron-build.git BigSwitch: Sync workaround for port del deadlock Adds a synchronization barrier to the methods that lock the port table to avoid the mysql update-lock/eventlet-yield deadlock that occurs with simultaneous port deletions. Closes-Bug: #1292232 Change-Id: I8975a14a937a5843a0395ad7b599ebdc827565ed --- diff --git a/neutron/plugins/bigswitch/plugin.py b/neutron/plugins/bigswitch/plugin.py index 89c4f760e..ff6a28924 100644 --- a/neutron/plugins/bigswitch/plugin.py +++ b/neutron/plugins/bigswitch/plugin.py @@ -59,6 +59,7 @@ from neutron.common import constants as const from neutron.common import exceptions from neutron.common import rpc as q_rpc from neutron.common import topics +from neutron.common import utils from neutron import context as qcontext from neutron.db import agents_db from neutron.db import agentschedulers_db @@ -589,6 +590,8 @@ class NeutronRestProxyV2(NeutronRestProxyV2Base, self._send_update_network(new_net, context) return new_net + # NOTE(kevinbenton): workaround for eventlet/mysql deadlock + @utils.synchronized('bsn-port-barrier') def delete_network(self, context, net_id): """Delete a network. :param context: neutron api request context @@ -777,6 +780,8 @@ class NeutronRestProxyV2(NeutronRestProxyV2Base, # return new_port return new_port + # NOTE(kevinbenton): workaround for eventlet/mysql deadlock + @utils.synchronized('bsn-port-barrier') def delete_port(self, context, port_id, l3_port_check=True): """Delete a port. :param context: neutron api request context @@ -842,6 +847,8 @@ class NeutronRestProxyV2(NeutronRestProxyV2Base, self._send_update_network(orig_net, context) return new_subnet + # NOTE(kevinbenton): workaround for eventlet/mysql deadlock + @utils.synchronized('bsn-port-barrier') def delete_subnet(self, context, id): LOG.debug(_("NeutronRestProxyV2: delete_subnet() called")) orig_subnet = super(NeutronRestProxyV2, self).get_subnet(context, id) @@ -921,6 +928,9 @@ class NeutronRestProxyV2(NeutronRestProxyV2Base, # return updated router return new_router + # NOTE(kevinbenton): workaround for eventlet/mysql deadlock. + # delete_router ends up calling _delete_port instead of delete_port. + @utils.synchronized('bsn-port-barrier') def delete_router(self, context, router_id): LOG.debug(_("NeutronRestProxyV2: delete_router() called"))