From 8854a24c588afec467da22f95837645ed4692137 Mon Sep 17 00:00:00 2001 From: Roman Podoliaka Date: Thu, 4 May 2017 18:29:16 +0300 Subject: [PATCH] service: use restart_method='mutate' for all services I8f09f9482736b496e3ad7117f170e476e92c2b7d changed the way SIGHUP is handled by nova-api by telling oslo_service to reload config files and run 'mutation' hooks for a set of supported options. Make sure we use the very same mechanism for other service like nova-compute, that do not use process_launcher() directly, but rely on launch() helper from oslo_service instead. Change-Id: Ie4e7c06814310f661d054d2181340418fd0df7bc --- nova/service.py | 3 ++- nova/tests/unit/test_service.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nova/service.py b/nova/service.py index 05fa8ddf5d94..91f25f821c23 100644 --- a/nova/service.py +++ b/nova/service.py @@ -427,7 +427,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(): diff --git a/nova/tests/unit/test_service.py b/nova/tests/unit/test_service.py index c6b36f34d0f5..e5eeb87ecd3b 100644 --- a/nova/tests/unit/test_service.py +++ b/nova/tests/unit/test_service.py @@ -340,7 +340,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): @@ -348,7 +349,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):