Browse Source

Migrate scheduler-generic parameters to nova::scheduler

This patch migrates some parameters from nova::scheduler::filter to
nova::scheduler, because these are parameters to determine behavior of
nova-scheduler, and not specific to scheduler filters.

Note that the default value for max_attempts parameter has been changed
from 3 to $::os_service_default, because its default is defined as 3 in
nova implementation.

Change-Id: Ic74e1fdb4adf9f954b6e58343050c5e166d40889
changes/63/755263/5
Takashi Kajinami 10 months ago
parent
commit
248deef18e
  1. 19
      manifests/scheduler.pp
  2. 43
      manifests/scheduler/filter.pp
  3. 11
      releasenotes/notes/migrate-parameters-to-nova-scheduler-58e73aede02f712b.yaml
  4. 7
      spec/classes/nova_scheduler_filter_spec.rb
  5. 18
      spec/classes/nova_scheduler_spec.rb

19
manifests/scheduler.pp

@ -20,6 +20,16 @@
# (Optional) The amount of scheduler workers.
# Defaults to $::os_workers
#
# [*max_attempts*]
# (optional) Maximum number of attempts to schedule an instance
# Defaults to $::os_service_default
#
# [*periodic_task_interval*]
# (Optional) This value controls how often (in seconds) to run periodic tasks
# in the scheduler. The specific tasks that are run for each period are
# determined by the particular scheduler being used.
# Defaults to $::os_service_default
#
# [*discover_hosts_in_cells_interval*]
# (Optional) This value controls how often (in seconds) the scheduler should
# attempt to discover new hosts that have been added to cells.
@ -75,6 +85,8 @@ class nova::scheduler(
$manage_service = true,
$ensure_package = 'present',
$workers = $::os_workers,
$max_attempts = $::os_service_default,
$periodic_task_interval = $::os_service_default,
$discover_hosts_in_cells_interval = $::os_service_default,
$query_placement_for_image_type_support = $::os_service_default,
$limit_tenants_to_placement_aggregate = $::os_service_default,
@ -99,8 +111,15 @@ class nova::scheduler(
ensure_package => $ensure_package,
}
# TODO(tkajinam): Remove this when we remove the deprecated parameters
# from the nova::scheduler::filter class
$max_attempts_real = pick($::nova::scheduler::filter::scheduler_max_attempts, $max_attempts)
$periodic_task_interval_real = pick($::nova::scheduler::filter::periodic_task_interval, $periodic_task_interval)
nova_config {
'scheduler/workers': value => $workers;
'scheduler/max_attempts': value => $max_attempts_real;
'scheduler/periodic_task_interval': value => $periodic_task_interval_real;
'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/limit_tenants_to_placement_aggregate': value => $limit_tenants_to_placement_aggregate;

43
manifests/scheduler/filter.pp

@ -4,10 +4,6 @@
#
# === Parameters:
#
# [*scheduler_max_attempts*]
# (optional) Maximum number of attempts to schedule an instance
# Defaults to '3'
#
# [*scheduler_host_subset_size*]
# (optional) defines the subset size that a host is chosen from
# Defaults to '1'
@ -41,12 +37,6 @@
# (optional) Which weight class names to use for weighing hosts
# Defaults to 'nova.scheduler.weights.all_weighers'
#
# [*periodic_task_interval*]
# (optional) This value controls how often (in seconds) to run periodic tasks
# in the scheduler. The specific tasks that are run for each period are
# determined by the particular scheduler being used.
# Defaults to $::os_service_default
#
# [*track_instance_changes*]
# (optional) Enable querying of individual hosts for instance information.
# Defaults to $::os_service_default
@ -97,8 +87,19 @@
# (optional) Separator character(s) for image property namespace and name
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS
#
# [*scheduler_max_attempts*]
# (optional) Maximum number of attempts to schedule an instance
# Defaults to undef
#
# [*periodic_task_interval*]
# (optional) This value controls how often (in seconds) to run periodic tasks
# in the scheduler. The specific tasks that are run for each period are
# determined by the particular scheduler being used.
# Defaults to undef
#
class nova::scheduler::filter (
$scheduler_max_attempts = '3',
$scheduler_host_subset_size = '1',
$max_io_ops_per_host = '8',
$max_instances_per_host = '50',
@ -107,7 +108,6 @@ class nova::scheduler::filter (
$scheduler_available_filters = ['nova.scheduler.filters.all_filters'],
$scheduler_default_filters = $::os_service_default,
$scheduler_weight_classes = 'nova.scheduler.weights.all_weighers',
$periodic_task_interval = $::os_service_default,
$track_instance_changes = $::os_service_default,
$ram_weight_multiplier = $::os_service_default,
$cpu_weight_multiplier = $::os_service_default,
@ -119,10 +119,23 @@ class nova::scheduler::filter (
$restrict_isolated_hosts_to_isolated_images = $::os_service_default,
$aggregate_image_properties_isolation_namespace = $::os_service_default,
$aggregate_image_properties_isolation_separator = $::os_service_default,
# DEPRECATED PARAMETERS
$scheduler_max_attempts = undef,
$periodic_task_interval = undef,
) {
include nova::deps
if $scheduler_max_attempts != undef {
warning('The nova::scheduler::filter::scheduler_max_attempts parameter has been deprecated and \
will be removed in a future release. Use the nova::scheduler::max_attempts parameter instead.')
}
if $periodic_task_interval != undef {
warning('The nova::scheduler::filter::periodic_task_interval parameter has been deprecated and \
will be removed in a future release. Use the nova::scheduler::periodic_task_interval parameter instead.')
}
# The following values are following this rule:
# - default is $::os_service_default so Puppet won't try to configure it.
# - if set, we'll validate it's an array that is not empty and configure the parameter.
@ -158,12 +171,6 @@ class nova::scheduler::filter (
$isolated_hosts_real = $::os_service_default
}
# TODO(aschultz): these should probably be in nova::scheduler ...
nova_config {
'scheduler/max_attempts': value => $scheduler_max_attempts;
'scheduler/periodic_task_interval': value => $periodic_task_interval;
}
nova_config {
'filter_scheduler/host_subset_size':
value => $scheduler_host_subset_size;

11
releasenotes/notes/migrate-parameters-to-nova-scheduler-58e73aede02f712b.yaml

@ -0,0 +1,11 @@
---
deprecations:
- |
The following parmaeters in the ``nova::scheduler::filter`` class have been
deprecated and will be removed in a future release. Use the new parameters
in the ``nova::scheduler`` class.
- ``nova::scheduler::filter::scheduler_max_attempts`` is replaced by
``nova::scheduler::max_attempts``
- ``nova::scheduler::filter::periodic_task_interval`` is replaced by
``nova::scheduler::periodic_task_interval``

7
spec/classes/nova_scheduler_filter_spec.rb

@ -9,8 +9,6 @@ describe 'nova::scheduler::filter' do
shared_examples 'nova::scheduler::filter' do
context 'with default parameters' do
it { is_expected.to contain_nova_config('scheduler/max_attempts').with_value('3') }
it { is_expected.to contain_nova_config('scheduler/periodic_task_interval').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('filter_scheduler/host_subset_size').with_value('1') }
it { is_expected.to contain_nova_config('filter_scheduler/max_io_ops_per_host').with_value('8') }
it { is_expected.to contain_nova_config('filter_scheduler/max_instances_per_host').with_value('50') }
@ -38,7 +36,7 @@ describe 'nova::scheduler::filter' do
context 'when overriding params' do
let :params do
{ :scheduler_max_attempts => '4',
{
:scheduler_host_subset_size => '3',
:max_io_ops_per_host => '16',
:max_instances_per_host => '100',
@ -47,7 +45,6 @@ describe 'nova::scheduler::filter' do
:scheduler_default_filters => ['RetryFilter','AvailabilityZoneFilter'],
:scheduler_available_filters => ['nova_filter1','nova_filter2'],
:scheduler_weight_classes => 'nova.scheduler.weights.compute.BuildFailureWeigher',
:periodic_task_interval => 120,
:track_instance_changes => true,
:ram_weight_multiplier => 10,
:cpu_weight_multiplier => 20,
@ -59,8 +56,6 @@ describe 'nova::scheduler::filter' do
}
end
it { is_expected.to contain_nova_config('scheduler/max_attempts').with_value('4') }
it { is_expected.to contain_nova_config('scheduler/periodic_task_interval').with_value(120) }
it { is_expected.to contain_nova_config('filter_scheduler/host_subset_size').with_value('3') }
it { is_expected.to contain_nova_config('filter_scheduler/max_io_ops_per_host').with_value('16') }
it { is_expected.to contain_nova_config('filter_scheduler/max_instances_per_host').with_value('100') }

18
spec/classes/nova_scheduler_spec.rb

@ -18,6 +18,8 @@ describe 'nova::scheduler' do
)}
it { is_expected.to contain_nova_config('scheduler/workers').with_value(4) }
it { is_expected.to contain_nova_config('scheduler/max_attempts').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('scheduler/periodic_task_interval').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('scheduler/driver').with_ensure('absent') }
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>') }
@ -56,6 +58,22 @@ describe 'nova::scheduler' do
it { is_expected.to contain_nova_config('scheduler/workers').with_value(8) }
end
context 'with max_attempts' do
let :params do
{ :max_attempts => 10 }
end
it { is_expected.to contain_nova_config('scheduler/max_attempts').with_value(10) }
end
context 'with periodic_task_interval' do
let :params do
{ :periodic_task_interval => 300 }
end
it { is_expected.to contain_nova_config('scheduler/periodic_task_interval').with_value(300) }
end
context 'with scheduler driver' do
let :params do
{ :scheduler_driver => 'custom driver' }

Loading…
Cancel
Save