Skip to content

Commit

Permalink
Move network and port locks to separate locks
Browse files Browse the repository at this point in the history
* Because any plugin call can (in theory) be called from any other
  plugin call, each resource type needs its own lock to avoid
  deadlocks

Change-Id: Ia910aa8420f110d56140078e2502d86fc9a9eb4c
Signed-off-by: Joe Mills <[email protected]>
(cherry picked from commit 2798517)
  • Loading branch information
JoeMido authored and ryu25ish committed Nov 21, 2014
1 parent 57270d7 commit 5fb2c41
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions midonet/neutron/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def update_network(self, context, id, network):
return net

@util.handle_api_error
@utils.synchronized('midonet-critical-section', external=True)
@utils.synchronized('midonet-network-lock', external=True)
def delete_network(self, context, id):
"""Delete a network and its corresponding MidoNet bridge."""
LOG.info(_("MidonetPluginV2.delete_network called: id=%r"), id)
Expand Down Expand Up @@ -285,7 +285,7 @@ def _process_create_port(self, context, port):
return new_port

@util.handle_api_error
@utils.synchronized('midonet-critical-section', external=True)
@utils.synchronized('midonet-port-lock', external=True)
def create_port(self, context, port):
"""Create a L2 port in Neutron/MidoNet."""
LOG.info(_("MidonetPluginV2.create_port called: port=%r"), port)
Expand All @@ -305,7 +305,7 @@ def create_port(self, context, port):
return new_port

@util.handle_api_error
@utils.synchronized('midonet-critical-section', external=True)
@utils.synchronized('midonet-port-lock', external=True)
def delete_port(self, context, id, l3_port_check=True):
"""Delete a neutron port and corresponding MidoNet bridge port."""
LOG.info(_("MidonetPluginV2.delete_port called: id=%(id)s "
Expand Down

0 comments on commit 5fb2c41

Please sign in to comment.