There are various cases where the DHCP agent will try to
create a DHCP port for a network and there will be a failure.
This has primarily been caused by a lack of available IP addresses
in the allocation pool. Trying to fix all availability corner cases
on the server side will be very difficult due to race conditions between
multiple ports being created, the dhcp_agents_per_network parameter, etc.
This patch just stops the resync attempt on the agent side if a failure
is caused by an IP address generation problem. Future updates to the subnet
will cause another attempt so if the tenant does fix the issue they will
get DHCP service.
Change-Id: I0896730126d6dca13fe9284b4d812cfb081b6218
Closes-Bug: #
1447883
'still exist.'),
{'net_id': network.id, 'action': action})
except Exception as e:
- self.schedule_resync(e, network.id)
+ if getattr(e, 'exc_type', '') != 'IpAddressGenerationFailure':
+ # Don't resync if port could not be created because of an IP
+ # allocation failure. When the subnet is updated with a new
+ # allocation pool or a port is deleted to free up an IP, this
+ # will automatically be retried on the notification
+ self.schedule_resync(e, network.id)
if (isinstance(e, oslo_messaging.RemoteError)
and e.exc_type == 'NetworkNotFound'
or isinstance(e, exceptions.NetworkNotFound)):
self.assertEqual(log.call_count, 1)
self.assertEqual(expected_sync, schedule_resync.called)
+ def test_call_driver_ip_address_generation_failure(self):
+ error = oslo_messaging.RemoteError(
+ exc_type='IpAddressGenerationFailure')
+ self._test_call_driver_failure(exc=error, expected_sync=False)
+
def test_call_driver_failure(self):
self._test_call_driver_failure()