Enable mutable config in Murano

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. Heat 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 Murano 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.

Change-Id: Ia7e405392fe67eb9c4abf2408db0fa25c5546958
Story: 2001545
This commit is contained in:
zhurong 2018-03-22 19:56:44 +08:00
parent 4d7567883a
commit a11afbe704
4 changed files with 18 additions and 9 deletions

View File

@ -63,7 +63,9 @@ def main():
workers = CONF.murano.api_workers
if not workers:
workers = processutils.get_worker_count()
launcher = service.launch(CONF, server.ApiService(), workers=workers)
launcher = service.launch(
CONF, server.ApiService(),
workers=workers, restart_method='mutate')
app = app_loader.load_paste_app('murano')
port, host = (CONF.bind_port, CONF.bind_host)

View File

@ -53,8 +53,9 @@ def main():
workers = CONF.engine.engine_workers
if not workers:
workers = processutils.get_worker_count()
launcher = service.launch(CONF,
engine.EngineService(), workers=workers)
launcher = service.launch(
CONF, engine.EngineService(),
workers=workers, restart_method='mutate')
launcher.wait()
except RuntimeError as e:
sys.stderr.write("ERROR: %s\n" % e)

View File

@ -39,7 +39,8 @@ class TestAPIWorkers(base.MuranoTestCase):
load_paste_app, set_middleware_defaults):
api.main()
launch.assert_called_once_with(mock.ANY, mock.ANY,
workers=processutils.get_worker_count())
workers=processutils.get_worker_count(),
restart_method='mutate')
@mock.patch.object(config, 'parse_args')
@mock.patch.object(logging, 'setup')
@ -51,7 +52,8 @@ class TestAPIWorkers(base.MuranoTestCase):
load_paste_app, set_middleware_defaults):
self.override_config("api_workers", 8, "murano")
api.main()
launch.assert_called_once_with(mock.ANY, mock.ANY, workers=8)
launch.assert_called_once_with(mock.ANY, mock.ANY, workers=8,
restart_method='mutate')
@mock.patch.object(config, 'parse_args')
@mock.patch.object(logging, 'setup')
@ -64,4 +66,5 @@ class TestAPIWorkers(base.MuranoTestCase):
self.override_config("api_workers", 0, "murano")
api.main()
launch.assert_called_once_with(mock.ANY, mock.ANY,
workers=processutils.get_worker_count())
workers=processutils.get_worker_count(),
restart_method='mutate')

View File

@ -30,7 +30,8 @@ class TestEngineWorkers(base.MuranoTestCase):
def test_workers_default(self, launch, setup, parse_args):
engine.main()
launch.assert_called_once_with(mock.ANY, mock.ANY,
workers=processutils.get_worker_count())
workers=processutils.get_worker_count(),
restart_method='mutate')
@mock.patch.object(config, 'parse_args')
@mock.patch.object(logging, 'setup')
@ -38,7 +39,8 @@ class TestEngineWorkers(base.MuranoTestCase):
def test_workers_good_setting(self, launch, setup, parse_args):
self.override_config("engine_workers", 8, "engine")
engine.main()
launch.assert_called_once_with(mock.ANY, mock.ANY, workers=8)
launch.assert_called_once_with(mock.ANY, mock.ANY, workers=8,
restart_method='mutate')
@mock.patch.object(config, 'parse_args')
@mock.patch.object(logging, 'setup')
@ -47,4 +49,5 @@ class TestEngineWorkers(base.MuranoTestCase):
self.override_config("engine_workers", 0, "engine")
engine.main()
launch.assert_called_once_with(mock.ANY, mock.ANY,
workers=processutils.get_worker_count())
workers=processutils.get_worker_count(),
restart_method='mutate')