From 171b21a34c7c2827a9da946910f07db878b97820 Mon Sep 17 00:00:00 2001 From: Alan Pevec Date: Mon, 14 Apr 2014 18:11:04 +0200 Subject: [PATCH] Move notification point to a better place Follow-up for I80f325c9be9c171c2dc8d5526570bf64f0f87c78 "notify calling process we are ready to serve" Xavier Queralt found issue with sending readiness notification from inside run_service: it returns premature OK in case of multiple service endpoints in one systemd service like nova-api which by default provides osapi, ec2 and metadata services. Instead, send readiness notification before entering wait loop for each Launcher type. Change-Id: I69bf10f353f5fecaaf89e537c2d3c46b73e39d36 Implements: blueprint service-readiness --- openstack/common/service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openstack/common/service.py b/openstack/common/service.py index 60099e9..d286a2f 100644 --- a/openstack/common/service.py +++ b/openstack/common/service.py @@ -190,6 +190,7 @@ class ServiceLauncher(Launcher): return status, signo def wait(self, ready_callback=None): + systemd.notify_once() while True: self.handle_signal() status, signo = self._wait_for_exit_or_signal(ready_callback) @@ -382,6 +383,7 @@ class ProcessLauncher(object): def wait(self): """Loop waiting on children to die and respawning as necessary.""" + systemd.notify_once() LOG.debug('Full set of CONF:') CONF.log_opt_values(LOG, std_logging.DEBUG) @@ -488,7 +490,6 @@ class Services(object): """ service.start() - systemd.notify_once() done.wait()