Merge "replace WorkerSupportServiceMixin with neutron-lib's WorkerBase"

This commit is contained in:
Jenkins 2017-06-16 15:36:08 +00:00 committed by Gerrit Code Review
commit 5a1de1be7d
3 changed files with 4 additions and 37 deletions

View File

@ -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."""

View File

@ -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):

View File

@ -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."""