Fix DBDuplicateEntry in HA configurations

With multiple neutron-server processes and controllers,
there is a race-condition for creation of certain resources
on startup. This patch adds the retry decorator, which will
retry DBDuplicateEntry exceptions, and ignore creation if
the resource has been created already.

Change-Id: I58d2737e585cee13ae1a5f37ec6e567ccc06339f
This commit is contained in:
Thomas Bachman 2019-01-08 01:58:52 +00:00
parent 2210d27f48
commit e19764972e
1 changed files with 1 additions and 0 deletions

View File

@ -292,6 +292,7 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
raise exceptions.ExhaustedApicRouterIdPool(
pool=self.apic_router_id_pool)
@db_api.retry_db_errors
def _ensure_static_resources(self):
session = db_api.get_writer_session()
aim_ctx = aim_context.AimContext(session)