replace WorkerSupportServiceMixin with neutron-lib's WorkerBase
neutron-lib contains the WorkerBase class [1] that is the equivalent of neutron's WorkerSupportServiceMixin. This patch switches over to neutron-lib's version. Note: IIUC no consumers are using WorkerSupportServiceMixin so this patch can land without waiting for them to sync-up. I've included the lib impact tag just in case. NeutronLibImpact [1] https://review.openstack.org/#/c/424151/ [2] http://codesearch.openstack.org/?q=WorkerSupportServiceMixin Change-Id: Iacf1b6dfe318e3e6cfc76e61c65d407cf9ae7b36
This commit is contained in:
parent
1a8901a1ed
commit
7cae827b6b
@ -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."""
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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."""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user