ovn: Don't fail db sync if new IP allocation fails for metadata

There is a scenario where IP allocation pool is depleted but OVN
metadata port got removed its IP manually. The DB sync script will
attempt to allocate a new IP address if DHCP is enabled in the subnet.
Since the pool has no available IP addresses an exception is raised and
the whole db sync stops.

This patch simply catches the exception, logs and error and continues
syncing other resources.

Closes-bug: #1987135
Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
Change-Id: Iaa7b0d7ceb244a38fddd7676066683bf2ca72341
This commit is contained in:
Jakub Libosvar
2022-08-19 20:16:09 +00:00
parent b0a257fd33
commit d237a2a830

View File

@@ -955,8 +955,13 @@ class OvnNbSynchronizer(OvnDbSynchronizer):
db_ports.pop(port['id'])
if self.mode == SYNC_MODE_REPAIR:
# Make sure that this port has an IP address in all the subnets
self._ovn_client.update_metadata_port(ctx, net['id'])
try:
# Make sure that this port has an IP address in all the
# subnets
self._ovn_client.update_metadata_port(ctx, net['id'])
except n_exc.IpAddressGenerationFailure:
LOG.error('Could not allocate IP addresses for '
'metadata port in network %s', net['id'])
LOG.debug('OVN sync metadata ports finished')
def sync_networks_ports_and_dhcp_opts(self, ctx):