Allow ovn_db_sync to continue on duplicate normalised CIDR

OVN now uses normalised CIDR when adding a security group rule[1]. It
uses may_exist=True for adding ACL (secgroup rule), in case there are
multiple CIDRs in neutron that normalises to the same.

Do the same in ovn_db_sync, so that the sync don't fail hard on such
duplicates.

[1] https://review.opendev.org/c/openstack/neutron/+/736386/

It is manually cherry-picked from the patch
https://review.opendev.org/c/openstack/neutron/+/833562 in Neutron repo.

Change-Id: I9d9c21e460029e4a6a845520bfcc2889ad20429b
Related-Bug: #1869129
Closes-Bug: #1961112
(cherry picked from commit 5a0a2b7847da067817640404f53e0807755e08d7)
This commit is contained in:
Slawek Kaplonski 2022-03-14 15:16:10 +01:00
parent 788d8ef89e
commit 8e25f7f5be

@ -278,7 +278,7 @@ class OvnNbSynchronizer(OvnDbSynchronizer):
for acla in neutron_acls:
LOG.warning('ACL found in Neutron but not in '
'OVN DB for port group %s', acla['port_group'])
txn.add(self.ovn_api.pg_acl_add(**acla))
txn.add(self.ovn_api.pg_acl_add(may_exist=True, **acla))
with self.ovn_api.transaction(check_error=True) as txn:
for aclr in ovn_acls: