Reraise retriable errors in ensure_tenant

Change-Id: I5851a4d7b92137c652cdc7f30a026a7314fc8afa
This commit is contained in:
Ivar Lazzaro 2018-05-17 11:22:51 -07:00
parent eaf16ba376
commit 487eb4bc36
No known key found for this signature in database
GPG Key ID: ACEEC8CB558DC3CF
1 changed files with 7 additions and 1 deletions

View File

@ -78,7 +78,13 @@ class MechanismManager(managers.MechanismManager):
if isinstance(driver.obj, driver_api.MechanismDriver):
try:
driver.obj.ensure_tenant(plugin_context, tenant_id)
except Exception:
except Exception as e:
if db_api.is_retriable(e):
with excutils.save_and_reraise_exception():
LOG.debug("DB exception raised by Mechanism "
"driver '%(name)s' in ensure_tenant",
{'name': driver.name},
exc_info=e)
LOG.exception("Mechanism driver '%s' failed in "
"ensure_tenant", driver.name)
raise ml2_exc.MechanismDriverError(method="ensure_tenant")