diff --git a/neutron/conf/service.py b/neutron/conf/service.py index 6dcbe77d9b3..5c4a3289753 100644 --- a/neutron/conf/service.py +++ b/neutron/conf/service.py @@ -24,19 +24,23 @@ SERVICE_OPTS = [ default=40, help=_('Seconds between running periodic tasks.')), cfg.IntOpt('api_workers', + min=1, help=_('Number of separate API worker processes for service. ' 'If not specified, the default is equal to the number ' 'of CPUs available for best performance, capped by ' 'potential RAM usage.')), cfg.IntOpt('rpc_workers', + min=0, help=_('Number of RPC worker processes for service. ' 'If not specified, the default is equal to half the ' 'number of API workers. If set to 0, no RPC worker ' 'is launched.')), cfg.IntOpt('rpc_state_report_workers', default=1, + min=0, help=_('Number of RPC worker processes dedicated to the state ' - 'reports queue.')), + 'reports queue. If set to 0, no dedicated RPC worker ' + 'for state reports queue is launched.')), cfg.IntOpt('periodic_fuzzy_delay', default=5, help=_('Range of seconds to randomly delay when starting the ' diff --git a/neutron/tests/unit/test_service.py b/neutron/tests/unit/test_service.py index 3979018d67a..96381700b86 100644 --- a/neutron/tests/unit/test_service.py +++ b/neutron/tests/unit/test_service.py @@ -92,8 +92,8 @@ class TestRunWsgiApp(base.BaseTestCase): workers=expected_passed_value) self.assertEqual(expected_call, start_call) - def test_api_workers_zero(self): - self._test_api_workers(0, 0) + def test_api_workers_one(self): + self._test_api_workers(1, 1) def test_api_workers_default(self): self._test_api_workers(None, self.worker_count) @@ -102,7 +102,7 @@ class TestRunWsgiApp(base.BaseTestCase): self._test_api_workers(42, 42) def test_start_all_workers(self): - cfg.CONF.set_override('api_workers', 0) + cfg.CONF.set_override('api_workers', 1) mock.patch.object(service, '_get_rpc_workers').start() mock.patch.object(service, '_get_plugins_workers').start() mock.patch.object(service, '_start_workers').start() diff --git a/releasenotes/notes/min-workers-8705bf4f76c8b70d.yaml b/releasenotes/notes/min-workers-8705bf4f76c8b70d.yaml new file mode 100644 index 00000000000..5f8f5a44318 --- /dev/null +++ b/releasenotes/notes/min-workers-8705bf4f76c8b70d.yaml @@ -0,0 +1,11 @@ +--- +upgrade: + - | + The ``[DEFAULT] api_workers`` option no longer accepts 0 or negative + values. Previously 0 or a negative value was translated to 1 and + neutron-server launched 1 api worker. + + - | + The ``[DEFAULT] rpc_workers`` option and + the ``[DEFAULT] rpc_state_report_workers`` option no longer accept negative + values. To disable these workers, set these options to 0.