From 5acaa4e1085b5710b101a9f85da1765e12b1d902 Mon Sep 17 00:00:00 2001 From: John Griffith Date: Thu, 23 Apr 2015 09:05:57 -0600 Subject: [PATCH] Sync oslo service module This does a full sync of the oslo.service module. Note that we've cherry picked some critical bug-fix changes to this module already, this commit just syncs the full module properly and gets us up to date where we should be. Current HEAD in OSLO: ----------------------- commit: d5edda00b4eca65d57f94bd0ac1b790e6d1f732e Date: Wed Apr 22 19:49:00 2015 +0000 Merge "service child process normal SIGTERM exit" Changes merged with this patch: --------------------------------- d5edda00 - Merge "service child process normal SIGTERM exit" 702bc569 - service child process normal SIGTERM exit 64b5819e - Revert "Revert "Revert "Optimization of waiting subprocesses in ProcessLauncher f5646edc - Revert "Revert "Optimization of waiting subprocesses in ProcessLauncher d23b6589 - Revert "Optimization of waiting subprocesses in ProcessLauncher" 593005b7 - ProcessLauncher: reload config file in parent process on SIGHUP f29e865d - Store ProcessLauncher signal handlers on class level bf92010c - Optimization of waiting subprocesses in ProcessLauncher NOTE: Commit 702bc569 was actually pulled in with commit d73ac96d . We shouldn't have merged that individual commit. I include the commit here to document Oslo level that the service module is at cumulatively between that commit and patch. Change-Id: I613ba5ba442cf533c0f68d06281d117fbac20bd6 --- cinder/openstack/common/eventlet_backdoor.py | 4 ++-- cinder/openstack/common/service.py | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cinder/openstack/common/eventlet_backdoor.py b/cinder/openstack/common/eventlet_backdoor.py index 1cdd52c56..9fb89d8d3 100644 --- a/cinder/openstack/common/eventlet_backdoor.py +++ b/cinder/openstack/common/eventlet_backdoor.py @@ -28,7 +28,7 @@ import traceback import eventlet.backdoor import greenlet -from oslo.config import cfg +from oslo_config import cfg from cinder.openstack.common._i18n import _LI @@ -50,7 +50,7 @@ LOG = logging.getLogger(__name__) def list_opts(): - """Entry point for oslo.config-generator. + """Entry point for oslo-config-generator. """ return [(None, copy.deepcopy(eventlet_backdoor_opts))] diff --git a/cinder/openstack/common/service.py b/cinder/openstack/common/service.py index c0701033e..48d0d4205 100644 --- a/cinder/openstack/common/service.py +++ b/cinder/openstack/common/service.py @@ -35,7 +35,7 @@ except ImportError: import eventlet from eventlet import event -from oslo.config import cfg +from oslo_config import cfg from cinder.openstack.common import eventlet_backdoor from cinder.openstack.common._i18n import _LE, _LI, _LW @@ -199,6 +199,13 @@ class ServiceWrapper(object): class ProcessLauncher(object): + _signal_handlers_set = set() + + @classmethod + def _handle_class_signals(cls, *args, **kwargs): + for handler in cls._signal_handlers_set: + handler(*args, **kwargs) + def __init__(self, wait_interval=0.01): """Constructor. @@ -214,7 +221,8 @@ class ProcessLauncher(object): self.handle_signal() def handle_signal(self): - _set_signals_handler(self._handle_signal) + self._signal_handlers_set.add(self._handle_signal) + _set_signals_handler(self._handle_class_signals) def _handle_signal(self, signo, frame): self.sigcaught = signo @@ -388,8 +396,14 @@ class ProcessLauncher(object): if not _is_sighup_and_daemon(self.sigcaught): break + cfg.CONF.reload_config_files() + for service in set( + [wrap.service for wrap in self.children.values()]): + service.reset() + for pid in self.children: os.kill(pid, signal.SIGHUP) + self.running = True self.sigcaught = None except eventlet.greenlet.GreenletExit: -- 2.45.2