Use correct retry mechanism in tags

This replaces wrap_db_retry with
neutron.db.api.retry_if_session_inactive() in the tags
plugin.

wrap_db_retry is missing a bunch of exception types we
can encounter and are expected to retry in normal database
operations in Neutron (e.g. staledataerror in the bug report).

This patch doesn't include a unit test because there is already
quite a bit of coverage ensuring the decorator handles these types
of exceptions.

Closes-Bug: #1673243
Change-Id: I65b10ee54301401cd4525152a82a604ac8744582
(cherry picked from commit 44b6fcb4d2)
This commit is contained in:
Kevin Benton 2017-03-15 12:42:33 -07:00 committed by Jakub Libosvar
parent 085afaa649
commit 185d372835

View File

@ -15,7 +15,6 @@
import functools
from neutron_lib.plugins import directory
from oslo_db import api as oslo_db_api
from oslo_db import exception as db_exc
from oslo_log import helpers as log_helpers
from sqlalchemy.orm import exc
@ -75,9 +74,7 @@ class TagPlugin(common_db_mixin.CommonDbMixin, tag_ext.TagPluginBase):
raise tag_ext.TagNotFound(tag=tag)
@log_helpers.log_method_call
@oslo_db_api.wrap_db_retry(
max_retries=db_api.MAX_RETRIES,
exception_checker=lambda e: isinstance(e, db_exc.DBDuplicateEntry))
@db_api.retry_if_session_inactive()
def update_tags(self, context, resource, resource_id, body):
with db_api.context_manager.writer.using(context):
# We get and do all operations with objects in one session