Skip to content

Commit c6438e2

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Fix ACL sync when default sg group is created" into stable/2023.1
2 parents 6bba3bd + c1f5bac commit c6438e2

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from neutron_lib.plugins import directory
2626
from neutron_lib.utils import helpers
2727
from oslo_log import log
28+
from ovsdbapp.backend.ovs_idl import idlutils
2829

2930
from neutron.common.ovn import acl as acl_utils
3031
from neutron.common.ovn import constants as ovn_const
@@ -100,7 +101,6 @@ def do_sync(self):
100101
LOG.debug("Starting OVN-Northbound DB sync process")
101102

102103
ctx = context.get_admin_context()
103-
104104
self.sync_port_groups(ctx)
105105
self.sync_networks_ports_and_dhcp_opts(ctx)
106106
self.sync_port_dns_records(ctx)
@@ -299,11 +299,32 @@ def get_num_acls(ovn_acls):
299299
'remove': num_acls_to_remove})
300300

301301
if self.mode == SYNC_MODE_REPAIR:
302-
with self.ovn_api.transaction(check_error=True) as txn:
303-
for acla in neutron_acls:
304-
LOG.warning('ACL found in Neutron but not in '
305-
'OVN DB for port group %s', acla['port_group'])
306-
txn.add(self.ovn_api.pg_acl_add(**acla, may_exist=True))
302+
pg_resync_count = 0
303+
while True:
304+
try:
305+
with self.ovn_api.transaction(check_error=True) as txn:
306+
for acla in neutron_acls:
307+
LOG.warning('ACL found in Neutron but not in '
308+
'OVN DB for port group %s',
309+
acla['port_group'])
310+
txn.add(self.ovn_api.pg_acl_add(
311+
**acla, may_exist=True))
312+
except idlutils.RowNotFound as row_err:
313+
if row_err.msg.startswith("Cannot find Port_Group"):
314+
if pg_resync_count < 1:
315+
LOG.warning('Port group row was not found during '
316+
'ACLs sync. Will attempt to sync port '
317+
'groups one more time. The caught '
318+
'exception is: %s', row_err)
319+
self.sync_port_groups(ctx)
320+
pg_resync_count += 1
321+
continue
322+
LOG.error('Port group exception during ACL sync '
323+
'even after one more port group resync. '
324+
'The caught exception is: %s', row_err)
325+
else:
326+
raise
327+
break
307328

308329
with self.ovn_api.transaction(check_error=True) as txn:
309330
for aclr in ovn_acls:

0 commit comments

Comments
 (0)