Browse Source

Retry DHCP server deletion

In some cases deletion might fail because a segment port
is still reported as attached.

This change will ensure the operation is retried so it
eventually succeeds.

Change-Id: Ic40f8162f127414653ebeebca4cae5481b01585f
changes/76/818576/1
Salvatore Orlando 6 months ago committed by Salvatore Orlando
parent
commit
5a80f1d59c
  1. 7
      vmware_nsx/plugins/common_v3/plugin.py

7
vmware_nsx/plugins/common_v3/plugin.py

@ -1773,6 +1773,11 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
LOG.error('Unable to create DHCP bindings for existing ports '
'on subnet %s', subnet['id'])
@nsxlib_utils.retry_upon_exception(
Exception, max_attempts=cfg.CONF.nsx_v3.retries)
def _safe_delete_dhcp_server(self, nsx_service_id):
self.nsxlib.dhcp_server.delete(nsx_service_id)
def _disable_native_dhcp(self, context, network_id):
# Disable native DHCP service on the backend for this network.
# First delete the DHCP port in this network. Then delete the
@ -1802,7 +1807,7 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
network_id)
try:
self.nsxlib.dhcp_server.delete(dhcp_service['nsx_service_id'])
self._safe_delete_dhcp_server(dhcp_service['nsx_service_id'])
LOG.debug("Deleted logical DHCP server %(server)s for network "
"%(network)s",
{'server': dhcp_service['nsx_service_id'],

Loading…
Cancel
Save