Add scheduler max_placement_results param

Adds the max_placement_results config option
for the scheduler.

Change-Id: I6652b1321dd64f428fff2bc920f65e09e294ddfe
This commit is contained in:
Tobias Urdin
2019-11-22 22:16:04 +01:00
parent 890dc6fa44
commit e75c6fbd63
3 changed files with 31 additions and 15 deletions

View File

@@ -5,42 +5,47 @@
# === Parameters: # === Parameters:
# #
# [*enabled*] # [*enabled*]
# (optional) Whether to run the scheduler service # (Optional) Whether to run the scheduler service
# Defaults to true # Defaults to true
# #
# [*manage_service*] # [*manage_service*]
# (optional) Whether to start/stop the service # (Optional) Whether to start/stop the service
# Defaults to true # Defaults to true
# #
# [*ensure_package*] # [*ensure_package*]
# (optional) The state of the scheduler package # (Optional) The state of the scheduler package
# Defaults to 'present' # Defaults to 'present'
# #
# [*workers*] # [*workers*]
# (optional) The amount of scheduler workers. # (Optional) The amount of scheduler workers.
# Defaults to $::os_workers # Defaults to $::os_workers
# #
# [*scheduler_driver*] # [*scheduler_driver*]
# (optional) Default driver to use for the scheduler # (Optional) Default driver to use for the scheduler
# Defaults to 'filter_scheduler' # Defaults to 'filter_scheduler'
# #
# [*discover_hosts_in_cells_interval*] # [*discover_hosts_in_cells_interval*]
# (optional) This value controls how often (in seconds) the scheduler should # (Optional) This value controls how often (in seconds) the scheduler should
# attempt to discover new hosts that have been added to cells. # attempt to discover new hosts that have been added to cells.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*query_placement_for_image_type_support*] # [*query_placement_for_image_type_support*]
# (optional) This setting causes the scheduler to ask placement only for # (Optional) This setting causes the scheduler to ask placement only for
# compute hosts that support the ``disk_format`` of the image used in the # compute hosts that support the ``disk_format`` of the image used in the
# request. # request.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*limit_tenants_to_placement_aggregate*] # [*limit_tenants_to_placement_aggregate*]
# (optional) This setting allows to have tenant isolation with placement. # (Optional) This setting allows to have tenant isolation with placement.
# It ensures hosts in tenant-isolated host aggregate and availability # It ensures hosts in tenant-isolated host aggregate and availability
# zones will only be available to specific set of tenants. # zones will only be available to specific set of tenants.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*max_placement_results*]
# (Optional) This setting determines the maximum limit on results received
# from the placement service during a scheduling operation.
# Defaults to $::os_service_default
#
class nova::scheduler( class nova::scheduler(
$enabled = true, $enabled = true,
$manage_service = true, $manage_service = true,
@@ -50,6 +55,7 @@ class nova::scheduler(
$discover_hosts_in_cells_interval = $::os_service_default, $discover_hosts_in_cells_interval = $::os_service_default,
$query_placement_for_image_type_support = $::os_service_default, $query_placement_for_image_type_support = $::os_service_default,
$limit_tenants_to_placement_aggregate = $::os_service_default, $limit_tenants_to_placement_aggregate = $::os_service_default,
$max_placement_results = $::os_service_default,
) { ) {
include ::nova::deps include ::nova::deps
@@ -71,6 +77,6 @@ class nova::scheduler(
'scheduler/discover_hosts_in_cells_interval': value => $discover_hosts_in_cells_interval; 'scheduler/discover_hosts_in_cells_interval': value => $discover_hosts_in_cells_interval;
'scheduler/query_placement_for_image_type_support': value => $query_placement_for_image_type_support; 'scheduler/query_placement_for_image_type_support': value => $query_placement_for_image_type_support;
'scheduler/limit_tenants_to_placement_aggregate': value => $limit_tenants_to_placement_aggregate; 'scheduler/limit_tenants_to_placement_aggregate': value => $limit_tenants_to_placement_aggregate;
'scheduler/max_placement_results': value => $max_placement_results;
} }
} }

View File

@@ -0,0 +1,4 @@
---
features:
- |
Added nova::scheduler::max_placement_results parameter.

View File

@@ -1,13 +1,11 @@
require 'spec_helper' require 'spec_helper'
describe 'nova::scheduler' do describe 'nova::scheduler' do
let :pre_condition do let :pre_condition do
'include nova' 'include nova'
end end
shared_examples 'nova-scheduler' do shared_examples 'nova::scheduler' do
it { is_expected.to contain_package('nova-scheduler').with( it { is_expected.to contain_package('nova-scheduler').with(
:name => platform_params[:scheduler_package_name], :name => platform_params[:scheduler_package_name],
:ensure => 'present' :ensure => 'present'
@@ -23,7 +21,8 @@ describe 'nova::scheduler' do
it { is_expected.to contain_nova_config('scheduler/driver').with_value('filter_scheduler') } 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>') } it { is_expected.to contain_nova_config('scheduler/discover_hosts_in_cells_interval').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('scheduler/query_placement_for_image_type_support').with_value('<SERVICE DEFAULT>') } it { is_expected.to contain_nova_config('scheduler/query_placement_for_image_type_support').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('scheduler/limit_tenants_to_placement_aggregate').with_value('<SERVICE DEFAULT>')} it { is_expected.to contain_nova_config('scheduler/limit_tenants_to_placement_aggregate').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('scheduler/max_placement_results').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_class('nova::availability_zone') } it { is_expected.to contain_class('nova::availability_zone') }
@@ -86,6 +85,14 @@ describe 'nova::scheduler' do
it { is_expected.to contain_nova_config('scheduler/limit_tenants_to_placement_aggregate').with_value(true) } it { is_expected.to contain_nova_config('scheduler/limit_tenants_to_placement_aggregate').with_value(true) }
end end
context 'with max_placement_results' do
let :params do
{ :max_placement_results => 10 }
end
it { is_expected.to contain_nova_config('scheduler/max_placement_results').with_value(10) }
end
context 'with default database parameters' do context 'with default database parameters' do
let :pre_condition do let :pre_condition do
"include nova" "include nova"
@@ -134,8 +141,7 @@ describe 'nova::scheduler' do
end end
end end
it_configures 'nova-scheduler' it_behaves_like 'nova::scheduler'
end end
end end
end end