Merge "NSX|V: ensures updates on subnet are atomic"

This commit is contained in:
Jenkins 2017-08-03 21:10:53 +00:00 committed by Gerrit Code Review
commit 435702a6a2
1 changed files with 6 additions and 0 deletions

View File

@ -2503,6 +2503,12 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
router_driver._update_nexthop(context, router_id, new_gateway)
def update_subnet(self, context, id, subnet):
# Lock the subnet so that no other conflicting action can occur on
# the same subnet
with locking.LockManager.get_lock('subnet-%s' % id):
return self._safe_update_subnet(context, id, subnet)
def _safe_update_subnet(self, context, id, subnet):
s = subnet['subnet']
orig = self._get_subnet(context, id)
gateway_ip = orig['gateway_ip']