Blob Blame History Raw
From a77688f48f3ac2858aecb0a10dd44427fa30c0fb Mon Sep 17 00:00:00 2001
From: Alan Pevec <apevec@redhat.com>
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
---
 nova/openstack/common/service.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nova/openstack/common/service.py b/nova/openstack/common/service.py
index 80e345b..7c2dc1e 100644
--- a/nova/openstack/common/service.py
+++ b/nova/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()