Merge "NSX|V: ensure that the subinterface validations are atomic"

This commit is contained in:
Jenkins 2017-05-16 09:26:44 +00:00 committed by Gerrit Code Review
commit 387efd8657
2 changed files with 23 additions and 17 deletions

View File

@ -1998,6 +1998,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
self._create_dhcp_static_binding(context, ret_port)
elif owner == constants.DEVICE_OWNER_DHCP:
# Update the ip of the dhcp port
with locking.LockManager.get_lock(ret_port['network_id']):
address_groups = self._create_network_dhcp_address_group(
context, ret_port['network_id'])
self._update_dhcp_edge_service(
@ -2259,10 +2260,11 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
self._delete_dhcp_edge_service(context, network_id)
else:
# Update address group and delete the DHCP port only
address_groups = self._create_network_dhcp_address_group(
with locking.LockManager.get_lock(network_id):
addr_groups = self._create_network_dhcp_address_group(
context, network_id)
self._update_dhcp_edge_service(context, network_id,
address_groups)
addr_groups)
def _is_overlapping_reserved_subnets(self, subnet):
"""Return True if the subnet overlaps with reserved subnets.
@ -2562,6 +2564,8 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
self.create_port(context, {'port': port_dict})
# First time binding network with dhcp edge
else:
with locking.LockManager.get_lock(
subnet['subnet']['network_id']):
self._update_dhcp_service_with_subnet(context, subnet)
return
else:
@ -2586,9 +2590,11 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
network_id)
self._delete_dhcp_edge_service(context, network_id)
return
address_groups = self._create_network_dhcp_address_group(context,
network_id)
self._update_dhcp_edge_service(context, network_id, address_groups)
with locking.LockManager.get_lock(network_id):
address_groups = self._create_network_dhcp_address_group(
context, network_id)
self._update_dhcp_edge_service(context, network_id,
address_groups)
def _get_conflict_network_ids_by_overlapping(self, context, subnets):
with locking.LockManager.get_lock('nsx-networking'):

View File

@ -1529,7 +1529,7 @@ class EdgeManager(object):
LOG.error('Database conflict could not be recovered '
'for VDR %(vdr)s DHCP edge %(dhcp)s',
{'vdr': vdr_router_id, 'dhcp': dhcp_edge_id})
with locking.LockManager.get_lock(network_id):
address_groups = self.plugin._create_network_dhcp_address_group(
context, network_id)
self.update_dhcp_edge_service(