Fix health manager initialization

With this patch we postpone health manager initialization until service
records are cleaned up. Also, we change the executor to 'threading'
which is recommended by oslo.messaging. A new INFO log is added for
debugging's purpose.

Closes-Bug: #1613552
Change-Id: I761b61ee164fe3532aaaaad5408b68df84d0d7ca
This commit is contained in:
tengqm 2016-08-16 02:34:50 -04:00
parent ad8a538094
commit 5a68ced6d2
3 changed files with 15 additions and 11 deletions

View File

@ -71,10 +71,10 @@ def ListenerProc(exchange, project_id, cluster_id):
NotificationEndpoint(project_id, cluster_id),
]
listener = messaging.get_notification_listener(
transport, targets, endpoints, pool="senlin-listeners")
transport, targets, endpoints, executor='threading',
pool="senlin-listeners")
listener.start()
listener.wait()
class HealthManager(service.Service):
@ -162,6 +162,9 @@ class HealthManager(service.Service):
'params': cluster.params,
}
LOG.info("Loading cluster %s for health monitoring",
cluster.cluster_id)
entry = self._start_check(entry)
if entry:
self.rt['registries'].append(entry)

View File

@ -114,13 +114,6 @@ class EngineService(service.Service):
LOG.info(_LI("Starting dispatcher for engine %s"), self.engine_id)
self.dispatcher.start()
# create a health manager RPC service for this engine.
self.health_mgr = health_manager.HealthManager(
self, self.health_mgr_topic, consts.RPC_API_VERSION)
LOG.info(_LI("Starting health manager for engine %s"), self.engine_id)
self.health_mgr.start()
target = oslo_messaging.Target(version=consts.RPC_API_VERSION,
server=self.host,
topic=self.topic)
@ -128,6 +121,14 @@ class EngineService(service.Service):
self._rpc_server = rpc_messaging.get_rpc_server(target, self)
self._rpc_server.start()
self.service_manage_cleanup()
# create a health manager RPC service for this engine.
self.health_mgr = health_manager.HealthManager(
self, self.health_mgr_topic, consts.RPC_API_VERSION)
LOG.info(_LI("Starting health manager for engine %s"), self.engine_id)
self.health_mgr.start()
self.TG.add_timer(cfg.CONF.periodic_interval,
self.service_manage_report)
super(EngineService, self).start()

View File

@ -64,9 +64,9 @@ class TestListenerProc(base.SenlinTestCase):
exchange='EXCHANGE')
mock_endpoint.assert_called_once_with('PROJECT_ID', 'CLUSTER_ID')
mock_listener.assert_called_once_with(
x_transport, [x_target], [x_endpoint], pool="senlin-listeners")
x_transport, [x_target], [x_endpoint],
executor='threading', pool="senlin-listeners")
x_listener.start.assert_called_once_with()
x_listener.wait.assert_called_once_with()
class TestHealthManager(base.SenlinTestCase):