]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Sync oslo service module
authorJohn Griffith <john.griffith@solidfire.com>
Thu, 23 Apr 2015 15:05:57 +0000 (09:05 -0600)
committerWalter A. Boring IV (hemna) <walter.boring@hp.com>
Thu, 23 Apr 2015 21:56:20 +0000 (21:56 +0000)
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
cinder/openstack/common/service.py

index 1cdd52c5634ef089c7812e6b8eea4bc14e26d5f1..9fb89d8d379499e549ce8511b30c63703a283e42 100644 (file)
@@ -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))]
 
index c0701033e81319a47f55b73ba0a64dbedb183c64..48d0d4205edc38748f3d7cd97934f7c65009116f 100644 (file)
@@ -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: