From d034df15a1bfc55785f113ab1814a94765689c92 Mon Sep 17 00:00:00 2001 From: Boden R Date: Tue, 1 May 2018 14:12:37 -0600 Subject: [PATCH] remove common db alaises to db utils A handful of the functions implemented in neutron.db._utils are exposed in common_db_mixin as aliases. These are unneeded as they're already defined elsewhere. This patch removes the following aliases in common_db_mixin: - safe_creation - model_query_scope - model_query - resource_fields It also renames the UT for common db mixin to test__utils to reflect the fact that its testing functions from the _utils db module. NeutronLibImpact Change-Id: I53cd533f107d950f163ad5b19b47097546a4691d --- neutron/db/common_db_mixin.py | 7 ------- neutron/db/l3_db.py | 7 +++---- .../unit/db/{test_common_db_mixin.py => test__utils.py} | 0 3 files changed, 3 insertions(+), 11 deletions(-) rename neutron/tests/unit/db/{test_common_db_mixin.py => test__utils.py} (100%) diff --git a/neutron/db/common_db_mixin.py b/neutron/db/common_db_mixin.py index 99c6fdd20ea..472ce779c9f 100644 --- a/neutron/db/common_db_mixin.py +++ b/neutron/db/common_db_mixin.py @@ -20,13 +20,6 @@ from neutron.db import _resource_extend from neutron.db import _utils as ndb_utils -# TODO(HenryG): Remove these when available in neutron-lib -safe_creation = ndb_utils.safe_creation -model_query_scope = ndb_utils.model_query_scope_is_project -model_query = ndb_utils.model_query -resource_fields = ndb_utils.resource_fields - - # TODO(HenryG): Deprecate and schedule for removal class CommonDbMixin(object): """Deprecated.""" diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py index e3757472ce3..36aef4f9c13 100644 --- a/neutron/db/l3_db.py +++ b/neutron/db/l3_db.py @@ -46,7 +46,6 @@ from neutron.db import _model_query as model_query from neutron.db import _resource_extend as resource_extend from neutron.db import _utils as db_utils from neutron.db import api as db_api -from neutron.db import common_db_mixin from neutron.db.models import l3 as l3_models from neutron.db import models_v2 from neutron.db import standardattrdescription_db as st_attr @@ -249,9 +248,9 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase, delete = functools.partial(self.delete_router, context) update_gw = functools.partial(self._update_gw_for_create_router, context, gw_info) - router_db, _unused = common_db_mixin.safe_creation(context, create, - delete, update_gw, - transaction=False) + router_db, _unused = db_utils.safe_creation(context, create, + delete, update_gw, + transaction=False) new_router = self._make_router_dict(router_db) registry.notify(resources.ROUTER, events.AFTER_CREATE, self, context=context, router_id=router_db.id, diff --git a/neutron/tests/unit/db/test_common_db_mixin.py b/neutron/tests/unit/db/test__utils.py similarity index 100% rename from neutron/tests/unit/db/test_common_db_mixin.py rename to neutron/tests/unit/db/test__utils.py