Skip to content

Commit d0c5478

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Fix ACL sync when default sg group is created" into stable/yoga
2 parents 47187e1 + d55b308 commit d0c5478

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
@@ -99,7 +100,6 @@ def do_sync(self):
99100
LOG.debug("Starting OVN-Northbound DB sync process")
100101

101102
ctx = context.get_admin_context()
102-
103103
self.sync_port_groups(ctx)
104104
self.sync_networks_ports_and_dhcp_opts(ctx)
105105
self.sync_port_dns_records(ctx)
@@ -298,11 +298,32 @@ def get_num_acls(ovn_acls):
298298
'remove': num_acls_to_remove})
299299

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

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

0 commit comments

Comments
 (0)