Merge "NSX|V: ensure locking when removing a network from DHCP edge"
This commit is contained in:
commit
3f56cc8669
@ -1401,11 +1401,12 @@ class EdgeManager(object):
|
||||
network_id)
|
||||
if dhcp_binding:
|
||||
edge_id = dhcp_binding['edge_id']
|
||||
vnic_index = dhcp_binding['vnic_index']
|
||||
tunnel_index = dhcp_binding['tunnel_index']
|
||||
LOG.debug('Update the dhcp service for %s on vnic %d tunnel %d',
|
||||
edge_id, vnic_index, tunnel_index)
|
||||
with locking.LockManager.get_lock(str(edge_id)):
|
||||
vnic_index = dhcp_binding['vnic_index']
|
||||
tunnel_index = dhcp_binding['tunnel_index']
|
||||
LOG.debug('Update the dhcp service for %s on vnic %d tunnel '
|
||||
'%d',
|
||||
edge_id, vnic_index, tunnel_index)
|
||||
try:
|
||||
self._update_dhcp_internal_interface(
|
||||
context, edge_id, vnic_index, tunnel_index, network_id,
|
||||
@ -1451,29 +1452,29 @@ class EdgeManager(object):
|
||||
context.session, edge_binding['edge_id'], network_id)
|
||||
if dhcp_binding:
|
||||
edge_id = dhcp_binding['edge_id']
|
||||
vnic_index = dhcp_binding['vnic_index']
|
||||
tunnel_index = dhcp_binding['tunnel_index']
|
||||
with locking.LockManager.get_lock(str(edge_id)):
|
||||
vnic_index = dhcp_binding['vnic_index']
|
||||
tunnel_index = dhcp_binding['tunnel_index']
|
||||
|
||||
LOG.debug("Delete the tunnel %d on vnic %d from DHCP Edge %s",
|
||||
tunnel_index, vnic_index, edge_id)
|
||||
nsxv_db.free_edge_vnic_by_network(context.session,
|
||||
edge_id,
|
||||
network_id)
|
||||
try:
|
||||
with locking.LockManager.get_lock(str(edge_id)):
|
||||
LOG.debug("Delete the tunnel %d on vnic %d from DHCP Edge "
|
||||
"%s", tunnel_index, vnic_index, edge_id)
|
||||
nsxv_db.free_edge_vnic_by_network(context.session,
|
||||
edge_id,
|
||||
network_id)
|
||||
try:
|
||||
self._delete_dhcp_internal_interface(context, edge_id,
|
||||
vnic_index,
|
||||
tunnel_index,
|
||||
network_id)
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception('Failed to delete the tunnel '
|
||||
'%(tunnel_index)d on vnic '
|
||||
'%(vnic_index)d'
|
||||
'from DHCP Edge %(edge_id)s',
|
||||
{'tunnel_index': tunnel_index,
|
||||
'vnic_index': vnic_index,
|
||||
'edge_id': edge_id})
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception('Failed to delete the tunnel '
|
||||
'%(tunnel_index)d on vnic '
|
||||
'%(vnic_index)d'
|
||||
'from DHCP Edge %(edge_id)s',
|
||||
{'tunnel_index': tunnel_index,
|
||||
'vnic_index': vnic_index,
|
||||
'edge_id': edge_id})
|
||||
|
||||
def _update_address_in_dict(self, address_groups, old_ip, new_ip,
|
||||
subnet_mask):
|
||||
|
Loading…
x
Reference in New Issue
Block a user