Make OVO exception NeutronDbObjectDuplicateEntry retriable

OVO object create() raises exception NeutronDbObjectDuplicateEntry
on seeing duplicate entries which should be handled by retrying the
transaction.

Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
Closes-Bug: #1627811

Change-Id: I2b311326c2caa7500aa9318d0b5bf753cf0eb543
This commit is contained in:
Mohit Malik 2016-09-26 13:25:25 -07:00
parent 0a27cf7fd6
commit 17ecc54493
1 changed files with 3 additions and 1 deletions

View File

@ -32,6 +32,7 @@ from sqlalchemy.orm import exc
import traceback
from neutron._i18n import _LE
from neutron.objects import exceptions as obj_exc
def set_hook(engine):
@ -54,7 +55,8 @@ def is_retriable(e):
return False
if _is_nested_instance(e, (db_exc.DBDeadlock, exc.StaleDataError,
db_exc.DBConnectionError,
db_exc.DBDuplicateEntry, db_exc.RetryRequest)):
db_exc.DBDuplicateEntry, db_exc.RetryRequest,
obj_exc.NeutronDbObjectDuplicateEntry)):
return True
# looking savepoints mangled by deadlocks. see bug/1590298 for details.
return _is_nested_instance(e, db_exc.DBError) and '1305' in str(e)