Add scheduler workers support

The configuration option scheduler/workers was added
in Rocky [1]. This patch adds the nova::scheduler::workers
parameter which can be used to set this new config option.

[1] https://docs.openstack.org/releasenotes/nova/rocky.html

Change-Id: I217444b2c30d62347cd9e25def769e94d12a70fc
This commit is contained in:
Tobias Urdin 2018-09-25 14:57:27 +02:00 committed by Alex Schultz
parent 14116ff299
commit 3878df1f36
3 changed files with 22 additions and 3 deletions

View File

@ -16,6 +16,10 @@
# (optional) The state of the scheduler package
# Defaults to 'present'
#
# [*workers*]
# (optional) The amount of scheduler workers.
# Defaults to $::os_workers
#
# [*scheduler_driver*]
# (optional) Default driver to use for the scheduler
# Defaults to 'filter_scheduler'
@ -29,6 +33,7 @@ class nova::scheduler(
$enabled = true,
$manage_service = true,
$ensure_package = 'present',
$workers = $::os_workers,
$scheduler_driver = 'filter_scheduler',
$discover_hosts_in_cells_interval = $::os_service_default,
) {
@ -46,6 +51,7 @@ class nova::scheduler(
}
nova_config {
'scheduler/workers': value => $workers;
'scheduler/driver': value => $scheduler_driver;
'scheduler/discover_hosts_in_cells_interval': value => $discover_hosts_in_cells_interval;
}

View File

@ -0,0 +1,5 @@
---
features:
- |
Added new parameter nova::scheduler::workers which can be used to set the
amount of scheduler workers.

View File

@ -8,7 +8,6 @@ describe 'nova::scheduler' do
shared_examples 'nova-scheduler' do
it { is_expected.to contain_package('nova-scheduler').with(
:name => platform_params[:scheduler_package_name],
:ensure => 'present'
@ -20,6 +19,7 @@ describe 'nova::scheduler' do
:ensure => 'running'
)}
it { is_expected.to contain_nova_config('scheduler/workers').with_value(4) }
it { is_expected.to contain_nova_config('scheduler/driver').with_value('filter_scheduler') }
it { is_expected.to contain_nova_config('scheduler/discover_hosts_in_cells_interval').with_value('<SERVICE DEFAULT>') }
@ -42,6 +42,14 @@ describe 'nova::scheduler' do
)}
end
context 'with workers' do
let :params do
{ :workers => 8 }
end
it { is_expected.to contain_nova_config('scheduler/workers').with_value(8) }
end
context 'with scheduler driver' do
let :params do
{ :scheduler_driver => 'custom driver' }
@ -89,7 +97,7 @@ describe 'nova::scheduler' do
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
@default_facts.merge({ :osfamily => 'Debian', :os_workers => 4 })
end
let :platform_params do
@ -102,7 +110,7 @@ describe 'nova::scheduler' do
context 'on Redhat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
@default_facts.merge({ :osfamily => 'RedHat', :os_workers => 4 })
end
let :platform_params do