delete common_db_mixin
The functionality within neutron.db.common_db_mixin is available via neutron-lib APIs. This patch removes common_db_mixin and updates any uses of it to use neutron-lib instead. Depends-On: https://review.openstack.org/#/c/636159/ NeutronLibImpact Change-Id: I2388f90b37abb09408809dda8c21da551bcd94bb
This commit is contained in:
parent
e9e76ce4b7
commit
957eca96f4
@ -1,62 +0,0 @@
|
||||
# Copyright (c) 2014 OpenStack Foundation.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.db import model_query
|
||||
from neutron_lib.db import utils as db_utils
|
||||
|
||||
|
||||
# TODO(HenryG): Deprecate and schedule for removal
|
||||
class CommonDbMixin(object):
|
||||
"""Deprecated."""
|
||||
|
||||
@staticmethod
|
||||
def _model_query(context, model):
|
||||
return model_query.query_with_hooks(context, model)
|
||||
|
||||
@staticmethod
|
||||
def _fields(resource, fields):
|
||||
return db_utils.resource_fields(resource, fields)
|
||||
|
||||
@staticmethod
|
||||
def _get_by_id(context, model, id):
|
||||
return model_query.get_by_id(context, model, id)
|
||||
|
||||
@staticmethod
|
||||
def _get_collection_query(context, model,
|
||||
filters=None, sorts=None,
|
||||
limit=None, marker_obj=None,
|
||||
page_reverse=False):
|
||||
return model_query.get_collection_query(context, model,
|
||||
filters, sorts,
|
||||
limit, marker_obj,
|
||||
page_reverse)
|
||||
|
||||
@staticmethod
|
||||
def _get_collection(context, model, dict_func,
|
||||
filters=None, fields=None, sorts=None,
|
||||
limit=None, marker_obj=None,
|
||||
page_reverse=False):
|
||||
return model_query.get_collection(context, model, dict_func,
|
||||
filters, fields, sorts,
|
||||
limit, marker_obj,
|
||||
page_reverse)
|
||||
|
||||
@staticmethod
|
||||
def _get_collection_count(context, model, filters=None):
|
||||
return model_query.get_collection_count(context, model, filters)
|
||||
|
||||
# TODO(HenryG): Remove this when available in neutron-lib
|
||||
def _get_marker_obj(self, context, resource, limit, marker):
|
||||
return db_utils.get_marker_obj(self, context, resource, limit, marker)
|
@ -34,7 +34,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import models_v2
|
||||
from neutron.objects import base as base_obj
|
||||
from neutron.objects import ports as port_obj
|
||||
@ -78,7 +77,7 @@ def filter_fields(f):
|
||||
return inner_filter
|
||||
|
||||
|
||||
class DbBasePluginCommon(common_db_mixin.CommonDbMixin):
|
||||
class DbBasePluginCommon(object):
|
||||
"""Stores getters and helper methods for db_base_plugin_v2
|
||||
|
||||
All private getters and simple helpers like _make_*_dict were moved from
|
||||
|
@ -18,7 +18,6 @@ from neutron_lib.exceptions import flavors as flav_exc
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import servicetype_db as sdb
|
||||
from neutron.objects import base as base_obj
|
||||
from neutron.objects import flavor as obj_flavor
|
||||
@ -27,7 +26,7 @@ from neutron.objects import flavor as obj_flavor
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FlavorsDbMixin(common_db_mixin.CommonDbMixin):
|
||||
class FlavorsDbMixin(object):
|
||||
|
||||
"""Class to support flavors and service profiles."""
|
||||
|
||||
|
@ -21,7 +21,6 @@ from oslo_db import exception as db_exc
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.api.rpc.agentnotifiers import metering_rpc_agent_api
|
||||
from neutron.db import common_db_mixin as base_db
|
||||
from neutron.db import l3_dvr_db
|
||||
from neutron.extensions import metering
|
||||
from neutron.objects import base as base_obj
|
||||
@ -29,8 +28,7 @@ from neutron.objects import metering as metering_objs
|
||||
from neutron.objects import router as l3_obj
|
||||
|
||||
|
||||
class MeteringDbMixin(metering.MeteringPluginBase,
|
||||
base_db.CommonDbMixin):
|
||||
class MeteringDbMixin(metering.MeteringPluginBase):
|
||||
|
||||
def __init__(self):
|
||||
self.meter_rpc = metering_rpc_agent_api.MeteringAgentNotifyAPI()
|
||||
|
@ -22,13 +22,12 @@ from neutron_lib.db import utils as db_utils
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_db import exception as db_exc
|
||||
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.extensions import rbac as ext_rbac
|
||||
from neutron.objects import base as base_obj
|
||||
from neutron.objects import rbac as rbac_obj
|
||||
|
||||
|
||||
class RbacPluginMixin(common_db_mixin.CommonDbMixin):
|
||||
class RbacPluginMixin(object):
|
||||
"""Plugin mixin that implements the RBAC DB operations."""
|
||||
|
||||
object_type_cache = {}
|
||||
|
@ -19,15 +19,13 @@ from neutron_lib.plugins.ml2 import api
|
||||
from neutron_lib.utils import net
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import portsecurity_db_common as ps_db_common
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PortSecurityExtensionDriver(api.ExtensionDriver,
|
||||
ps_db_common.PortSecurityDbCommon,
|
||||
common_db_mixin.CommonDbMixin):
|
||||
ps_db_common.PortSecurityDbCommon):
|
||||
_supported_extension_alias = 'port-security'
|
||||
|
||||
def initialize(self):
|
||||
|
@ -31,7 +31,6 @@ from neutron_lib.plugins import utils as p_utils
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.objects import auto_allocate as auto_allocate_obj
|
||||
from neutron.objects import base as base_obj
|
||||
from neutron.objects import network as net_obj
|
||||
@ -88,7 +87,7 @@ def _ensure_external_network_default_value_callback(
|
||||
|
||||
|
||||
@resource_extend.has_resource_extenders
|
||||
class AutoAllocatedTopologyMixin(common_db_mixin.CommonDbMixin):
|
||||
class AutoAllocatedTopologyMixin(object):
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
# NOTE(kevinbenton): we subscribe on object construction because
|
||||
|
@ -37,7 +37,6 @@ from oslo_utils import importutils
|
||||
|
||||
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
||||
from neutron.api.rpc.handlers import l3_rpc
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import dns_db
|
||||
from neutron.db import extraroute_db
|
||||
from neutron.db import l3_dvr_ha_scheduler_db
|
||||
@ -73,7 +72,6 @@ def disable_l3_qos_extension_by_plugins(ext, aliases):
|
||||
|
||||
@resource_extend.has_resource_extenders
|
||||
class L3RouterPlugin(service_base.ServicePluginBase,
|
||||
common_db_mixin.CommonDbMixin,
|
||||
extraroute_db.ExtraRoute_db_mixin,
|
||||
l3_hamode_db.L3_HA_NAT_db_mixin,
|
||||
l3_gateway_ip_qos.L3_gw_ip_qos_db_mixin,
|
||||
|
@ -29,7 +29,6 @@ from oslo_db import exception as db_exc
|
||||
from oslo_log import helpers as log_helpers
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import segments_db as db
|
||||
from neutron.extensions import segment as extension
|
||||
from neutron import manager
|
||||
@ -58,7 +57,7 @@ def check_user_configured_segment_plugin():
|
||||
return _USER_CONFIGURED_SEGMENT_PLUGIN
|
||||
|
||||
|
||||
class SegmentDbMixin(common_db_mixin.CommonDbMixin):
|
||||
class SegmentDbMixin(object):
|
||||
"""Mixin class to add segment."""
|
||||
|
||||
@staticmethod
|
||||
|
@ -20,7 +20,6 @@ from neutron_lib.plugins import directory
|
||||
from oslo_log import helpers as log_helpers
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import standard_attr
|
||||
from neutron.extensions import tagging
|
||||
from neutron.objects import tag as tag_obj
|
||||
@ -31,7 +30,7 @@ resource_model_map = standard_attr.get_standard_attr_resource_model_map()
|
||||
|
||||
|
||||
@resource_extend.has_resource_extenders
|
||||
class TagPlugin(common_db_mixin.CommonDbMixin, tagging.TagPluginBase):
|
||||
class TagPlugin(tagging.TagPluginBase):
|
||||
"""Implementation of the Neutron Tag Service Plugin."""
|
||||
|
||||
supported_extension_aliases = ['standard-attr-tag']
|
||||
|
@ -29,7 +29,6 @@ from neutron_lib.services import base as service_base
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import db_base_plugin_common
|
||||
from neutron.objects import base as objects_base
|
||||
from neutron.objects import trunk as trunk_objects
|
||||
@ -45,8 +44,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
@resource_extend.has_resource_extenders
|
||||
@registry.has_registry_receivers
|
||||
class TrunkPlugin(service_base.ServicePluginBase,
|
||||
common_db_mixin.CommonDbMixin):
|
||||
class TrunkPlugin(service_base.ServicePluginBase):
|
||||
|
||||
supported_extension_aliases = [trunk_apidef.ALIAS,
|
||||
trunk_details.ALIAS]
|
||||
|
@ -28,7 +28,6 @@ import testtools
|
||||
import neutron
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.db import agents_db
|
||||
from neutron.db import common_db_mixin
|
||||
|
||||
HOST = 'localhost'
|
||||
DEFAULT_AZ = 'nova'
|
||||
@ -52,8 +51,7 @@ def get_test_log_path():
|
||||
return os.environ.get('OS_LOG_PATH', '/tmp')
|
||||
|
||||
|
||||
class FakePlugin(common_db_mixin.CommonDbMixin,
|
||||
agents_db.AgentDbMixin):
|
||||
class FakePlugin(agents_db.AgentDbMixin):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -24,7 +24,6 @@ import testscenarios
|
||||
|
||||
from neutron.db import agents_db
|
||||
from neutron.db import agentschedulers_db
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.objects import network
|
||||
from neutron.scheduler import dhcp_agent_scheduler
|
||||
from neutron.tests.common import helpers
|
||||
@ -106,7 +105,6 @@ class BaseTestScheduleNetwork(object):
|
||||
class TestChanceScheduleNetwork(test_dhcp_sch.TestDhcpSchedulerBaseTestCase,
|
||||
agentschedulers_db.DhcpAgentSchedulerDbMixin,
|
||||
agents_db.AgentDbMixin,
|
||||
common_db_mixin.CommonDbMixin,
|
||||
BaseTestScheduleNetwork):
|
||||
"""Test various scenarios for ChanceScheduler.schedule."""
|
||||
|
||||
@ -144,7 +142,6 @@ class TestChanceScheduleNetwork(test_dhcp_sch.TestDhcpSchedulerBaseTestCase,
|
||||
class TestWeightScheduleNetwork(test_dhcp_sch.TestDhcpSchedulerBaseTestCase,
|
||||
agentschedulers_db.DhcpAgentSchedulerDbMixin,
|
||||
agents_db.AgentDbMixin,
|
||||
common_db_mixin.CommonDbMixin,
|
||||
BaseTestScheduleNetwork):
|
||||
"""Test various scenarios for WeightScheduler.schedule."""
|
||||
|
||||
@ -190,8 +187,7 @@ class TestWeightScheduleNetwork(test_dhcp_sch.TestDhcpSchedulerBaseTestCase,
|
||||
|
||||
class TestAutoSchedule(test_dhcp_sch.TestDhcpSchedulerBaseTestCase,
|
||||
agentschedulers_db.DhcpAgentSchedulerDbMixin,
|
||||
agents_db.AgentDbMixin,
|
||||
common_db_mixin.CommonDbMixin):
|
||||
agents_db.AgentDbMixin):
|
||||
"""Test various scenarios for ChanceScheduler.auto_schedule_networks.
|
||||
|
||||
Below is the brief description of the scenario variables
|
||||
@ -435,8 +431,7 @@ class TestAutoSchedule(test_dhcp_sch.TestDhcpSchedulerBaseTestCase,
|
||||
|
||||
class TestAZAwareWeightScheduler(test_dhcp_sch.TestDhcpSchedulerBaseTestCase,
|
||||
agentschedulers_db.DhcpAgentSchedulerDbMixin,
|
||||
agents_db.AgentDbMixin,
|
||||
common_db_mixin.CommonDbMixin):
|
||||
agents_db.AgentDbMixin):
|
||||
"""Test various scenarios for AZAwareWeightScheduler.schedule.
|
||||
|
||||
az_count
|
||||
|
@ -20,13 +20,11 @@ from neutron_lib import context
|
||||
from neutron_lib.plugins import constants
|
||||
from neutron_lib.plugins import directory
|
||||
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import extraroute_db
|
||||
from neutron.tests.unit import testlib_api
|
||||
|
||||
|
||||
class _Plugin(common_db_mixin.CommonDbMixin,
|
||||
extraroute_db.ExtraRoute_dbonly_mixin):
|
||||
class _Plugin(extraroute_db.ExtraRoute_dbonly_mixin):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -28,7 +28,6 @@ from neutron_lib.plugins import utils as plugin_utils
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.db import agents_db
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import l3_dvr_db
|
||||
from neutron.db import l3_dvrscheduler_db
|
||||
from neutron.db.models import l3 as l3_models
|
||||
@ -43,7 +42,6 @@ _uuid = uuidutils.generate_uuid
|
||||
|
||||
|
||||
class FakeL3Plugin(test_l3.TestL3PluginBaseAttributes,
|
||||
common_db_mixin.CommonDbMixin,
|
||||
l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
l3_dvrscheduler_db.L3_DVRsch_db_mixin,
|
||||
agents_db.AgentDbMixin):
|
||||
|
@ -42,7 +42,6 @@ import testtools
|
||||
from neutron.agent.common import utils as agent_utils
|
||||
from neutron.api.rpc.handlers import l3_rpc
|
||||
from neutron.db import agents_db
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import l3_agentschedulers_db
|
||||
from neutron.db import l3_hamode_db
|
||||
from neutron.objects import l3_hamode
|
||||
@ -56,7 +55,6 @@ _uuid = uuidutils.generate_uuid
|
||||
|
||||
|
||||
class FakeL3PluginWithAgents(test_l3.TestL3PluginBaseAttributes,
|
||||
common_db_mixin.CommonDbMixin,
|
||||
l3_hamode_db.L3_HA_NAT_db_mixin,
|
||||
l3_agentschedulers_db.L3AgentSchedulerDbMixin,
|
||||
agents_db.AgentDbMixin):
|
||||
|
@ -13,7 +13,6 @@
|
||||
import mock
|
||||
from neutron_lib.api.definitions import port_security as psec
|
||||
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import portsecurity_db_common as pdc
|
||||
from neutron.objects import base as objects_base
|
||||
from neutron.objects import network
|
||||
@ -21,7 +20,7 @@ from neutron.objects.port.extensions import port_security as p_ps
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
class FakePlugin(pdc.PortSecurityDbCommon, common_db_mixin.CommonDbMixin):
|
||||
class FakePlugin(pdc.PortSecurityDbCommon):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -23,7 +23,6 @@ from neutron_lib import context
|
||||
import sqlalchemy
|
||||
import testtools
|
||||
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import securitygroups_db
|
||||
from neutron.extensions import securitygroup
|
||||
from neutron.services.revisions import revision_plugin
|
||||
@ -61,8 +60,7 @@ def fake_callback(resource, event, *args, **kwargs):
|
||||
raise KeyError('bar')
|
||||
|
||||
|
||||
class SecurityGroupDbMixinImpl(securitygroups_db.SecurityGroupDbMixin,
|
||||
common_db_mixin.CommonDbMixin):
|
||||
class SecurityGroupDbMixinImpl(securitygroups_db.SecurityGroupDbMixin):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -44,7 +44,6 @@ from webob import exc
|
||||
|
||||
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
||||
from neutron.api.rpc.handlers import l3_rpc
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import dns_db
|
||||
from neutron.db import external_net_db
|
||||
@ -336,7 +335,6 @@ class TestNoL3NatPlugin(TestL3NatBasePlugin):
|
||||
# A L3 routing service plugin class for tests with plugins that
|
||||
# delegate away L3 routing functionality
|
||||
class TestL3NatServicePlugin(TestL3PluginBaseAttributes,
|
||||
common_db_mixin.CommonDbMixin,
|
||||
l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
l3_db.L3_NAT_db_mixin, dns_db.DNSDbMixin):
|
||||
|
||||
|
@ -17,7 +17,6 @@ from neutron_lib import constants as lib_const
|
||||
from neutron_lib.plugins import constants
|
||||
|
||||
from neutron.db.availability_zone import router as router_az_db
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import l3_agentschedulers_db
|
||||
from neutron.db import l3_db
|
||||
from neutron.extensions import l3
|
||||
@ -32,8 +31,7 @@ class AZL3ExtensionManager(test_az.AZExtensionManager):
|
||||
l3.L3.get_resources())
|
||||
|
||||
|
||||
class AZRouterTestPlugin(common_db_mixin.CommonDbMixin,
|
||||
l3_db.L3_NAT_db_mixin,
|
||||
class AZRouterTestPlugin(l3_db.L3_NAT_db_mixin,
|
||||
router_az_db.RouterAvailabilityZoneMixin,
|
||||
l3_agentschedulers_db.AZL3AgentSchedulerDbMixin):
|
||||
supported_extension_aliases = [l3_apidef.ALIAS,
|
||||
|
@ -30,7 +30,6 @@ from oslo_serialization import jsonutils
|
||||
import testtools
|
||||
|
||||
from neutron.db import agents_db
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import l3_agentschedulers_db
|
||||
from neutron.db import l3_hamode_db
|
||||
from neutron.plugins.ml2 import driver_context
|
||||
@ -59,8 +58,7 @@ DEVICE_OWNER_COMPUTE = constants.DEVICE_OWNER_COMPUTE_PREFIX + 'fake'
|
||||
DEVICE_OWNER_ROUTER_HA_INTF = constants.DEVICE_OWNER_ROUTER_HA_INTF + 'fake'
|
||||
|
||||
|
||||
class FakeL3PluginWithAgents(common_db_mixin.CommonDbMixin,
|
||||
l3_hamode_db.L3_HA_NAT_db_mixin,
|
||||
class FakeL3PluginWithAgents(l3_hamode_db.L3_HA_NAT_db_mixin,
|
||||
l3_agentschedulers_db.L3AgentSchedulerDbMixin,
|
||||
agents_db.AgentDbMixin):
|
||||
pass
|
||||
|
@ -26,7 +26,6 @@ from oslo_utils import uuidutils
|
||||
import testscenarios
|
||||
|
||||
from neutron.db import agentschedulers_db as sched_db
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.objects import agent
|
||||
from neutron.objects import network as network_obj
|
||||
from neutron.scheduler import dhcp_agent_scheduler
|
||||
@ -405,8 +404,7 @@ class TestAutoScheduleSegments(test_plugin.Ml2PluginV2TestCase,
|
||||
|
||||
|
||||
class TestNetworksFailover(TestDhcpSchedulerBaseTestCase,
|
||||
sched_db.DhcpAgentSchedulerDbMixin,
|
||||
common_db_mixin.CommonDbMixin):
|
||||
sched_db.DhcpAgentSchedulerDbMixin):
|
||||
def test_reschedule_network_from_down_agent(self):
|
||||
net_id = uuidutils.generate_uuid()
|
||||
agents = self._create_and_set_agents_down(['host-a', 'host-b'], 1)
|
||||
|
Loading…
Reference in New Issue
Block a user