From 3316b45665a99b0f61e45a8c7facf538618861bf Mon Sep 17 00:00:00 2001 From: Boden R <bodenvmw@gmail.com> Date: Tue, 30 Oct 2018 07:12:28 -0600 Subject: [PATCH] use MAX_RETRIES from neutron-lib The MAX_RETRIES constant from neutron.db.api is available in neutron-lib and is already used by most of the code today. This patch changes the remaining references over to use lib's constant and removes the MAX_RETRIES from neutron.db.api NeutronLibImpact Change-Id: I79480daca9cca3d4e1504767d286aab22504e0b9 --- neutron/common/utils.py | 4 ++-- neutron/db/api.py | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/neutron/common/utils.py b/neutron/common/utils.py index 8d8654072f4..f8612287188 100644 --- a/neutron/common/utils.py +++ b/neutron/common/utils.py @@ -34,6 +34,7 @@ import eventlet from eventlet.green import subprocess import netaddr from neutron_lib import constants as n_const +from neutron_lib.db import api as db_api from neutron_lib.utils import helpers from oslo_config import cfg from oslo_db import exception as db_exc @@ -44,7 +45,6 @@ import six import neutron from neutron._i18n import _ from neutron.api import api_common -from neutron.db import api as db_api TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ" LOG = logging.getLogger(__name__) @@ -552,7 +552,7 @@ def create_object_with_dependency(creator, dep_getter, dep_creator, This function protects against all of the cases where the dependency can be concurrently removed by catching exceptions and restarting the process of creating the dependency if one no longer exists. It will - give up after neutron.db.api.MAX_RETRIES and raise the exception it + give up after neutron_lib.db.api.MAX_RETRIES and raise the exception it encounters after that. """ result, dependency, dep_id, made_locally = None, None, None, False diff --git a/neutron/db/api.py b/neutron/db/api.py index 7182b591172..a93b19fe764 100644 --- a/neutron/db/api.py +++ b/neutron/db/api.py @@ -41,9 +41,6 @@ profiler_opts.set_defaults(cfg.CONF) context_manager.append_on_engine_create(set_hook) -MAX_RETRIES = 10 - - # Expire relationships when foreign key changes. # # NOTE(ihrachys) Arguably, it's a sqlalchemy anti-pattern to access child