Zero downtime config reload (log handling)
Pick up changes to log configuration on reload. Closes-bug: 1436274 Change-Id: I80dabe93729dd5ba7a27515aa78e5457413d0084
This commit is contained in:
parent
26d8eeb3a9
commit
9218069124
|
@ -392,6 +392,10 @@ class Server(object):
|
|||
os.killpg(self.pgid, signal.SIGHUP)
|
||||
self.stale_children = self.children
|
||||
self.children = set()
|
||||
|
||||
# Ensure any logging config changes are picked up
|
||||
logging.setup(CONF, 'glance')
|
||||
|
||||
self.configure(old_conf, has_changed)
|
||||
self.start_wsgi()
|
||||
|
||||
|
|
|
@ -238,3 +238,16 @@ class TestReload(functional.FunctionalTest):
|
|||
response = requests.get(path)
|
||||
self.assertEqual(300, response.status_code)
|
||||
del response
|
||||
|
||||
# Test logging configuration change
|
||||
# This recycles the existing socket
|
||||
conf_dir = os.path.join(self.test_dir, 'etc')
|
||||
log_file = conf_dir + 'new.log'
|
||||
self.assertFalse(os.path.exists(log_file))
|
||||
set_config_value(self._conffile('api'), 'log_file', log_file)
|
||||
cmd = "kill -HUP %s" % self._get_parent('api')
|
||||
execute(cmd, raise_error=True)
|
||||
msg = 'No new log file created'
|
||||
for _ in self.ticker(msg):
|
||||
if os.path.exists(log_file):
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue