Merge "service: remove useless PeriodicService class"
This commit is contained in:
commit
215c472692
@ -30,6 +30,7 @@ from ceilometer.openstack.common import gettextutils
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer.openstack.common import service as os_service
|
||||
from ceilometer.openstack.common.rpc import dispatcher as rpc_dispatcher
|
||||
from ceilometer.openstack.common.rpc import service as rpc_service
|
||||
|
||||
# Import rpc_notifier to register `notification_topics` flag so that
|
||||
# plugins can use it
|
||||
@ -118,7 +119,7 @@ def udp_collector():
|
||||
os_service.launch(UDPCollectorService()).wait()
|
||||
|
||||
|
||||
class CollectorService(service.PeriodicService):
|
||||
class CollectorService(rpc_service.Service):
|
||||
|
||||
COLLECTOR_NAMESPACE = 'ceilometer.collector'
|
||||
|
||||
@ -126,6 +127,11 @@ class CollectorService(service.PeriodicService):
|
||||
super(CollectorService, self).__init__(host, topic, manager)
|
||||
self.storage_conn = get_storage_connection(cfg.CONF)
|
||||
|
||||
def start(self):
|
||||
super(CollectorService, self).start()
|
||||
# Add a dummy thread to have wait() working
|
||||
self.tg.add_timer(604800, lambda: None)
|
||||
|
||||
def initialize_service_hook(self, service):
|
||||
'''Consumers must be declared before consume_thread start.'''
|
||||
LOG.debug('initialize_service_hooks')
|
||||
@ -225,6 +231,3 @@ class CollectorService(service.PeriodicService):
|
||||
LOG.warning(
|
||||
'message signature invalid, discarding message: %r',
|
||||
meter)
|
||||
|
||||
def periodic_tasks(self, context):
|
||||
pass
|
||||
|
@ -22,10 +22,8 @@ import socket
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer.openstack.common import rpc
|
||||
from ceilometer.openstack.common.rpc import service as rpc_service
|
||||
|
||||
|
||||
cfg.CONF.register_opts([
|
||||
@ -63,16 +61,6 @@ CLI_OPTIONS = [
|
||||
cfg.CONF.register_cli_opts(CLI_OPTIONS)
|
||||
|
||||
|
||||
class PeriodicService(rpc_service.Service):
|
||||
|
||||
def start(self):
|
||||
super(PeriodicService, self).start()
|
||||
admin_context = context.RequestContext('admin', 'admin', is_admin=True)
|
||||
self.tg.add_timer(cfg.CONF.periodic_interval,
|
||||
self.manager.periodic_tasks,
|
||||
context=admin_context)
|
||||
|
||||
|
||||
def _sanitize_cmd_line(argv):
|
||||
"""Remove non-nova CLI options from argv."""
|
||||
cli_opt_names = ['--%s' % o.name for o in CLI_OPTIONS]
|
||||
|
Loading…
Reference in New Issue
Block a user