NSXv: lock DHCP edge while making changes

When a network is attached to a VDR, we replace the DHCP edge which
the network subnets are using.
While doing so, a lock should be obtained on the DHCP edge.

Change-Id: Ib7b2975d00af816c4104fdac5bd68c53a7bd2320
This commit is contained in:
Kobi Samoray 2017-01-24 01:52:00 +02:00
parent 5ad22c9ec7
commit df95b51df3
1 changed files with 6 additions and 4 deletions

View File

@ -461,11 +461,13 @@ class RouterDistributedDriver(router_driver.RouterBaseDriver):
# inconsistency. We check for this anyway, in case that
# something is broken.
if vdr_dhcp_binding:
self.edge_manager.reset_sysctl_rp_filter_for_vdr_dhcp(
context, vdr_dhcp_binding['dhcp_edge_id'], network_id)
with locking.LockManager.get_lock(
vdr_dhcp_binding['dhcp_edge_id']):
self.edge_manager.reset_sysctl_rp_filter_for_vdr_dhcp(
context, vdr_dhcp_binding['dhcp_edge_id'], network_id)
self.edge_manager.remove_network_from_dhcp_edge(
context, network_id, vdr_dhcp_binding['dhcp_edge_id'])
self.edge_manager.remove_network_from_dhcp_edge(
context, network_id, vdr_dhcp_binding['dhcp_edge_id'])
else:
LOG.error(_LE('VDR DHCP binding is missing for %s'),
router_id)