Add workers to magnum api and conductor

This patch adds two new parameters that can
be used to specify the number of workers for
the api and conductor services.

Change-Id: I71dcfba1f162b395c3d9e68513dfcf9a099800df
This commit is contained in:
Tobias Urdin 2018-08-22 17:43:26 +02:00
parent 1c219c60e9
commit d59bd32b1d
5 changed files with 32 additions and 1 deletions

View File

@ -47,6 +47,10 @@
# Required when $enabled_ssl is set to 'true'.
# Defaults to $::os_service_default.
#
# [*workers*]
# (Optional) Number of API workers.
# Defaults to $::os_workers
#
class magnum::api(
$package_ensure = 'present',
$enabled = true,
@ -58,6 +62,7 @@ class magnum::api(
$enabled_ssl = false,
$ssl_cert_file = $::os_service_default,
$ssl_key_file = $::os_service_default,
$workers = $::os_workers,
) {
include ::magnum::deps
@ -85,6 +90,7 @@ class magnum::api(
'api/enabled_ssl': value => $enabled_ssl;
'api/ssl_cert_file': value => $ssl_cert_file;
'api/ssl_key_file': value => $ssl_key_file;
'api/workers': value => $workers;
}
# Install package

View File

@ -25,12 +25,17 @@
# (optional) Type of authentication to be used.
# Defaults to 'keystone'
#
# [*workers*]
# (optional) Number of conductor workers.
# Defaults to $::os_workers
#
class magnum::conductor(
$enabled = true,
$manage_service = true,
$package_ensure = 'present',
$conductor_life_check_timeout = $::os_service_default,
$auth_strategy = 'keystone',
$workers = $::os_workers,
) {
include ::magnum::db
@ -63,6 +68,7 @@ class magnum::conductor(
magnum_config {
'conductor/conductor_life_check_timeout': value => $conductor_life_check_timeout;
'conductor/workers': value => $workers;
}
if $auth_strategy == 'keystone' {

View File

@ -0,0 +1,5 @@
---
features:
- |
Added magnum::api::workers and magnum::conductor::workers which can be used
to specify the number of worker processes.

View File

@ -59,6 +59,7 @@ describe 'magnum::api' do
is_expected.to contain_magnum_config('api/enabled_ssl').with_value(p[:enabled_ssl])
is_expected.to contain_magnum_config('api/ssl_cert_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('api/ssl_key_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('api/workers').with_value(facts[:os_workers])
end
context 'when overriding parameters' do
@ -67,6 +68,7 @@ describe 'magnum::api' do
:port => '1234',
:host => '0.0.0.0',
:max_limit => '10',
:workers => 10,
)
end
@ -74,6 +76,7 @@ describe 'magnum::api' do
is_expected.to contain_magnum_config('api/port').with_value(p[:port])
is_expected.to contain_magnum_config('api/host').with_value(p[:host])
is_expected.to contain_magnum_config('api/max_limit').with_value(p[:max_limit])
is_expected.to contain_magnum_config('api/workers').with_value(p[:workers])
end
end

View File

@ -23,7 +23,10 @@ describe 'magnum::conductor' do
:ensure => 'running'
) }
it { is_expected.to contain_magnum_config('conductor/conductor_life_check_timeout').with_value('<SERVICE DEFAULT>') }
it {
is_expected.to contain_magnum_config('conductor/conductor_life_check_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('conductor/workers').with_value(facts[:os_workers])
}
context 'with conductor_life_check_timeout specified' do
let :params do
@ -42,6 +45,14 @@ describe 'magnum::conductor' do
it { is_expected.to contain_service('magnum-conductor').without_ensure }
end
context 'with workers specified' do
let :params do
{ :workers => 10 }
end
it { is_expected.to contain_magnum_config('conductor/workers').with_value(10) }
end
end
on_supported_os({