From 499ff807aedbbfb2606f816e55dbf0ff3805fd0a Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 29 May 2013 16:28:02 +0200 Subject: [PATCH] service: remove useless PeriodicService class Change-Id: Ic83c83f767956a97e991f1304dea4255ba47f7b8 Signed-off-by: Julien Danjou --- ceilometer/collector/service.py | 11 +++++++---- ceilometer/service.py | 12 ------------ 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/ceilometer/collector/service.py b/ceilometer/collector/service.py index b2cd4c783..b73e30866 100644 --- a/ceilometer/collector/service.py +++ b/ceilometer/collector/service.py @@ -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 diff --git a/ceilometer/service.py b/ceilometer/service.py index c6131d94b..fa91a1b14 100644 --- a/ceilometer/service.py +++ b/ceilometer/service.py @@ -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]