diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py index e53ba24fa98..196980393be 100644 --- a/neutron/db/l3_db.py +++ b/neutron/db/l3_db.py @@ -27,6 +27,7 @@ from neutron_lib import constants from neutron_lib import context as n_ctx from neutron_lib import exceptions as n_exc from neutron_lib.plugins import directory +from neutron_lib.services import base as base_services from oslo_log import log as logging from oslo_utils import uuidutils import six @@ -70,7 +71,7 @@ CORE_ROUTER_ATTRS = ('id', 'name', 'tenant_id', 'admin_state_up', 'status') @registry.has_registry_receivers class L3_NAT_dbonly_mixin(l3.RouterPluginBase, - neutron_worker.WorkerSupportServiceMixin, + base_services.WorkerBase, st_attr.StandardAttrDescriptionMixin): """Mixin class to add L3/NAT router methods to db_base_plugin_v2.""" diff --git a/neutron/neutron_plugin_base_v2.py b/neutron/neutron_plugin_base_v2.py index 513890f7822..58cd83cdffe 100644 --- a/neutron/neutron_plugin_base_v2.py +++ b/neutron/neutron_plugin_base_v2.py @@ -22,13 +22,12 @@ methods that needs to be implemented by a v2 Neutron Plug-in. import abc +from neutron_lib.services import base as base_services import six -from neutron import worker as neutron_worker - @six.add_metaclass(abc.ABCMeta) -class NeutronPluginBaseV2(neutron_worker.WorkerSupportServiceMixin): +class NeutronPluginBaseV2(base_services.WorkerBase): @abc.abstractmethod def create_subnet(self, context, subnet): diff --git a/neutron/worker.py b/neutron/worker.py index 97693daaf71..6d808352b22 100644 --- a/neutron/worker.py +++ b/neutron/worker.py @@ -14,39 +14,6 @@ from neutron_lib import worker from oslo_service import loopingcall -class WorkerSupportServiceMixin(object): - - @property - def _workers(self): - try: - return self.__workers - except AttributeError: - self.__workers = [] - return self.__workers - - def get_workers(self): - """Returns a collection neutron_lib.worker.BaseWorker instances - needed by this service - """ - return list(self._workers) - - def add_worker(self, worker): - """Adds neutron_lib.worker.BaseWorker needed for this service - - If a object needs to define workers thread/processes outside of API/RPC - workers then it will call this method to register worker. Should be - called on initialization stage before running services - """ - self._workers.append(worker) - - def add_workers(self, workers): - """Adds neutron_lib.worker.BaseWorker list needed for this service - - The same as add_worker but adds a list of workers - """ - self._workers.extend(workers) - - class PeriodicWorker(worker.BaseWorker): """A worker that runs a function at a fixed interval."""