Enable mutable config in Masakari

New releases of oslo.config support a 'mutable' parameter to Opts.
This is only respected when the new method mutate_config_files is
called instead of reload_config_files. Masakari delegates making
this call to oslo.service, so how do we switch?
Icec3e664f3fe72614e373b2938e8dee53cf8bc5e allows services to tell
oslo.service they want mutate_config_files to be called by passing a
parameter, which this patch does.

This allows Masakari to benefit from
I1e7a69de169cc85f4c09954b2f46ce2da7106d90, where the 'debug' option
(owned by oslo.log) is made mutable. We should be able to turn debug
logging on and off by changing the config and sending SIGHUP.
Also in this patch configuration parameter
'retry_notification_new_status_interval' is marked as mutable.

Part of bp:mutable-config

Change-Id: Icf4438b98420eb0e9d35a19cf88831f359c74fe5
This commit is contained in:
bhagyashris 2018-04-09 18:46:50 +05:30 committed by Neha Alhat
parent bfdaae6646
commit 4299b38883
4 changed files with 16 additions and 4 deletions

View File

@ -90,6 +90,7 @@ notification_opts = [
'are in error or new state.'),
cfg.IntOpt('retry_notification_new_status_interval',
default=60,
mutable=True,
help="Interval in seconds for identifying notifications which "
"are in new state. If the notification is in new state "
"till this config option value after it's "

View File

@ -271,7 +271,7 @@ class WSGIService(service.Service):
def process_launcher():
return service.ProcessLauncher(CONF)
return service.ProcessLauncher(CONF, restart_method='mutate')
# NOTE: the global launcher is to maintain the existing
@ -285,7 +285,8 @@ def serve(server, workers=None):
if _launcher:
raise RuntimeError(_('serve() can only be called once'))
_launcher = service.launch(CONF, server, workers=workers)
_launcher = service.launch(CONF, server, workers=workers,
restart_method='mutate')
def wait():

View File

@ -160,7 +160,8 @@ class TestLauncher(test.NoDBTestCase):
service.serve(mock.sentinel.service)
mock_launch.assert_called_once_with(mock.ANY,
mock.sentinel.service,
workers=None)
workers=None,
restart_method='mutate')
@mock.patch.object(_service, 'launch')
def test_launch_app_with_workers(self, mock_launch):
@ -168,7 +169,8 @@ class TestLauncher(test.NoDBTestCase):
service.serve(mock.sentinel.service, workers=mock.sentinel.workers)
mock_launch.assert_called_once_with(mock.ANY,
mock.sentinel.service,
workers=mock.sentinel.workers)
workers=mock.sentinel.workers,
restart_method='mutate')
@mock.patch.object(_service, 'launch')
def test_launch_app_more_than_once_raises(self, mock_launch):

View File

@ -0,0 +1,8 @@
---
features:
- |
Masakari has been enabled for mutable config.
Below option may be reloaded by sending SIGHUP to the correct process.
'retry_notification_new_status_interval' option will apply to process
unfinished notifications.