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
This commit is contained in:
Boden R 2018-05-01 14:12:37 -06:00
parent f2dec7112e
commit d034df15a1
3 changed files with 3 additions and 11 deletions

View File

@ -20,13 +20,6 @@ from neutron.db import _resource_extend
from neutron.db import _utils as ndb_utils 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 # TODO(HenryG): Deprecate and schedule for removal
class CommonDbMixin(object): class CommonDbMixin(object):
"""Deprecated.""" """Deprecated."""

View File

@ -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 _resource_extend as resource_extend
from neutron.db import _utils as db_utils from neutron.db import _utils as db_utils
from neutron.db import api as db_api 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.models import l3 as l3_models
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.db import standardattrdescription_db as st_attr 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) delete = functools.partial(self.delete_router, context)
update_gw = functools.partial(self._update_gw_for_create_router, update_gw = functools.partial(self._update_gw_for_create_router,
context, gw_info) context, gw_info)
router_db, _unused = common_db_mixin.safe_creation(context, create, router_db, _unused = db_utils.safe_creation(context, create,
delete, update_gw, delete, update_gw,
transaction=False) transaction=False)
new_router = self._make_router_dict(router_db) new_router = self._make_router_dict(router_db)
registry.notify(resources.ROUTER, events.AFTER_CREATE, self, registry.notify(resources.ROUTER, events.AFTER_CREATE, self,
context=context, router_id=router_db.id, context=context, router_id=router_db.id,