From 1083ee680a36dca5a89881f0e9d6662a464e4e0b Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Thu, 27 Oct 2016 15:19:34 -0600 Subject: [PATCH] Update scheduler config options The scheduler and scheduler filter options have been moved out of the DEFAULT name space to scheduler and filter_scheduler namespaces. This change updates the configuration namespace for the existing configuration options, removes the DEFAULT version and adds additional configuration options. Change-Id: I8f1da7546bf6aa20bb2cb17d3c8163963ef32e2a --- manifests/scheduler.pp | 7 +- manifests/scheduler/filter.pp | 161 +++++++++++++++--- .../scheduler-options-56584924232d7ab7.yaml | 7 + spec/classes/nova_scheduler_filter_spec.rb | 69 +++++--- spec/classes/nova_scheduler_spec.rb | 5 +- 5 files changed, 195 insertions(+), 54 deletions(-) create mode 100644 releasenotes/notes/scheduler-options-56584924232d7ab7.yaml diff --git a/manifests/scheduler.pp b/manifests/scheduler.pp index 63e8f2b77..61fe91558 100644 --- a/manifests/scheduler.pp +++ b/manifests/scheduler.pp @@ -40,6 +40,11 @@ class nova::scheduler( } nova_config { - 'DEFAULT/scheduler_driver': value => $scheduler_driver; + 'scheduler/driver': value => $scheduler_driver; + } + + # TODO(aschultz): old options, remove in P + nova_config { + 'DEFAULT/scheduler_driver': ensure => 'absent'; } } diff --git a/manifests/scheduler/filter.pp b/manifests/scheduler/filter.pp index 41687046c..c7dc2cb23 100644 --- a/manifests/scheduler/filter.pp +++ b/manifests/scheduler/filter.pp @@ -5,7 +5,8 @@ # === Parameters: # # [*scheduler_host_manager*] -# (optional) The scheduler host manager class to use +# (optional) The scheduler host manager class to use. Should be either +# 'host_manager' or 'ironic_host_manager' # Defaults to 'host_manager' # # [*scheduler_max_attempts*] @@ -53,6 +54,51 @@ # (optional) Use baremetal_scheduler_default_filters or not. # Defaults to false # +# [*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 +# +# [*ram_weight_multiplier*] +# (optional) Ram weight multipler ratio. This option determines how hosts +# with more or less available RAM are weighed. +# Defaults to $::os_service_default +# +# [*disk_weight_multiplier*] +# (optional) Disk weight multipler ratio. Multiplier used for weighing free +# disk space. Negative numbers mean to stack vs spread. +# Defaults to $::os_service_default +# +# [*io_ops_weight_multiplier*] +# (optional) IO operations weight multipler ratio. This option determines +# how hosts with differing workloads are weighed +# Defaults to $::os_service_default +# +# [*soft_affinity_weight_multiplier*] +# (optional) Multiplier used for weighing hosts for group soft-affinity +# Defaults to $::os_service_default +# +# [*soft_anti_affinity_weight_multiplier*] +# (optional) Multiplier used for weighing hosts for group soft-anti-affinity +# Defaults to $::os_service_default +# +# [*restrict_isolated_hosts_to_isolated_images*] +# (optional) Prevent non-isolated images from being built on isolated hosts. +# Defaults to $::os_service_default +# +# [*aggregate_image_properties_isolation_namespace*] +# (optional) Image property namespace for use in the host aggregate +# Defaults to $::os_service_default +# +# [*aggregate_image_properties_isolation_separator*] +# (optional) Separator character(s) for image property namespace and name +# Defaults to $::os_service_default +# # DEPRECATED PARAMETERS # # [*cpu_allocation_ratio*] @@ -68,22 +114,32 @@ # Defaults to undef # class nova::scheduler::filter ( - $scheduler_host_manager = 'host_manager', - $scheduler_max_attempts = '3', - $scheduler_host_subset_size = '1', - $max_io_ops_per_host = '8', - $max_instances_per_host = '50', - $isolated_images = $::os_service_default, - $isolated_hosts = $::os_service_default, - $scheduler_available_filters = ['nova.scheduler.filters.all_filters'], - $scheduler_default_filters = $::os_service_default, - $scheduler_weight_classes = 'nova.scheduler.weights.all_weighers', - $baremetal_scheduler_default_filters = $::os_service_default, - $scheduler_use_baremetal_filters = false, + $scheduler_host_manager = 'host_manager', + $scheduler_max_attempts = '3', + $scheduler_host_subset_size = '1', + $max_io_ops_per_host = '8', + $max_instances_per_host = '50', + $isolated_images = $::os_service_default, + $isolated_hosts = $::os_service_default, + $scheduler_available_filters = ['nova.scheduler.filters.all_filters'], + $scheduler_default_filters = $::os_service_default, + $scheduler_weight_classes = 'nova.scheduler.weights.all_weighers', + $baremetal_scheduler_default_filters = $::os_service_default, + $scheduler_use_baremetal_filters = false, + $periodic_task_interval = $::os_service_default, + $track_instance_changes = $::os_service_default, + $ram_weight_multiplier = $::os_service_default, + $disk_weight_multiplier = $::os_service_default, + $io_ops_weight_multiplier = $::os_service_default, + $soft_affinity_weight_multiplier = $::os_service_default, + $soft_anti_affinity_weight_multiplier = $::os_service_default, + $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 - $cpu_allocation_ratio = undef, - $ram_allocation_ratio = undef, - $disk_allocation_ratio = undef, + $cpu_allocation_ratio = undef, + $ram_allocation_ratio = undef, + $disk_allocation_ratio = undef, ) { include ::nova::deps @@ -137,19 +193,68 @@ class nova::scheduler::filter ( warning('disk_allocation_ratio is deprecated in nova::scheduler::filter, please add to nova::init instead') } + # TODO(aschultz): these should probably be in nova::scheduler ... nova_config { - 'DEFAULT/scheduler_host_manager': value => $scheduler_host_manager; - 'DEFAULT/scheduler_max_attempts': value => $scheduler_max_attempts; - 'DEFAULT/scheduler_host_subset_size': value => $scheduler_host_subset_size; - 'DEFAULT/max_io_ops_per_host': value => $max_io_ops_per_host; - 'DEFAULT/max_instances_per_host': value => $max_instances_per_host; - 'DEFAULT/scheduler_available_filters': value => $scheduler_available_filters_real; - 'DEFAULT/scheduler_weight_classes': value => $scheduler_weight_classes; - 'DEFAULT/scheduler_use_baremetal_filters': value => $scheduler_use_baremetal_filters; - 'DEFAULT/scheduler_default_filters': value => $scheduler_default_filters_real; - 'DEFAULT/baremetal_scheduler_default_filters': value => $baremetal_scheduler_default_filters_real; - 'DEFAULT/isolated_images': value => $isolated_images_real; - 'DEFAULT/isolated_hosts': value => $isolated_hosts_real; + 'scheduler/host_manager': value => $scheduler_host_manager; + '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; + 'filter_scheduler/max_io_ops_per_host': + value => $max_io_ops_per_host; + 'filter_scheduler/max_instances_per_host': + value => $max_instances_per_host; + 'filter_scheduler/track_instance_changes': + value => $track_instance_changes; + 'filter_scheduler/available_filters': + value => $scheduler_available_filters_real; + 'filter_scheduler/weight_classes': + value => $scheduler_weight_classes; + 'filter_scheduler/use_baremetal_filters': + value => $scheduler_use_baremetal_filters; + 'filter_scheduler/enabled_filters': + value => $scheduler_default_filters_real; + 'filter_scheduler/baremetal_enabled_filters': + value => $baremetal_scheduler_default_filters_real; + 'filter_scheduler/isolated_images': + value => $isolated_images_real; + 'filter_scheduler/isolated_hosts': + value => $isolated_hosts_real; + 'filter_scheduler/ram_weight_multiplier': + value => $ram_weight_multiplier; + 'filter_scheduler/disk_weight_multiplier': + value => $disk_weight_multiplier; + 'filter_scheduler/io_ops_weight_multiplier': + value => $io_ops_weight_multiplier; + 'filter_scheduler/soft_affinity_weight_multiplier': + value => $soft_affinity_weight_multiplier; + 'filter_scheduler/soft_anti_affinity_weight_multiplier': + value => $soft_anti_affinity_weight_multiplier; + 'filter_scheduler/restrict_isolated_hosts_to_isolated_images': + value => $restrict_isolated_hosts_to_isolated_images; + 'filter_scheduler/aggregate_image_properties_isolation_namespace': + value => $aggregate_image_properties_isolation_namespace; + 'filter_scheduler/aggregate_image_properties_isolation_separator': + value => $aggregate_image_properties_isolation_separator; + } + + # TODO(aschultz): old options, remove in P + nova_config { + 'DEFAULT/scheduler_host_manager': ensure => 'absent'; + 'DEFAULT/scheduler_max_attempts': ensure => 'absent'; + 'DEFAULT/scheduler_host_subset_size': ensure => 'absent'; + 'DEFAULT/max_io_ops_per_host': ensure => 'absent'; + 'DEFAULT/max_instances_per_host': ensure => 'absent'; + 'DEFAULT/scheduler_available_filters': ensure => 'absent'; + 'DEFAULT/scheduler_weight_classes': ensure => 'absent'; + 'DEFAULT/scheduler_use_baremetal_filters': ensure => 'absent'; + 'DEFAULT/scheduler_default_filters': ensure => 'absent'; + 'DEFAULT/baremetal_scheduler_default_filters': ensure => 'absent'; + 'DEFAULT/isolated_images': ensure => 'absent'; + 'DEFAULT/isolated_hosts': ensure => 'absent'; } } diff --git a/releasenotes/notes/scheduler-options-56584924232d7ab7.yaml b/releasenotes/notes/scheduler-options-56584924232d7ab7.yaml new file mode 100644 index 000000000..34bb37804 --- /dev/null +++ b/releasenotes/notes/scheduler-options-56584924232d7ab7.yaml @@ -0,0 +1,7 @@ +--- +other: + - The scheduler and scheduler filter options have been moved out + of the DEFAULT namespace to the scheduler and filter_scheduler + namespaces. The module has been updated with the current options + setable for Ocata and removes the old DEFAULT/* options under the + covers. diff --git a/spec/classes/nova_scheduler_filter_spec.rb b/spec/classes/nova_scheduler_filter_spec.rb index 3c1a0bad2..4fe80b2a5 100644 --- a/spec/classes/nova_scheduler_filter_spec.rb +++ b/spec/classes/nova_scheduler_filter_spec.rb @@ -9,18 +9,41 @@ describe 'nova::scheduler::filter' do shared_examples 'nova::scheduler::filter' do context 'with default parameters' do - it { is_expected.to contain_nova_config('DEFAULT/scheduler_host_manager').with_value('host_manager') } - it { is_expected.to contain_nova_config('DEFAULT/scheduler_max_attempts').with_value('3') } - it { is_expected.to contain_nova_config('DEFAULT/scheduler_host_subset_size').with_value('1') } - it { is_expected.to contain_nova_config('DEFAULT/max_io_ops_per_host').with_value('8') } - it { is_expected.to contain_nova_config('DEFAULT/max_instances_per_host').with_value('50') } - it { is_expected.to contain_nova_config('DEFAULT/scheduler_available_filters').with_value(['nova.scheduler.filters.all_filters']) } - it { is_expected.to contain_nova_config('DEFAULT/scheduler_weight_classes').with_value('nova.scheduler.weights.all_weighers') } - it { is_expected.to contain_nova_config('DEFAULT/scheduler_use_baremetal_filters').with_value(false) } - it { is_expected.to contain_nova_config('DEFAULT/isolated_images').with_value('') } - it { is_expected.to contain_nova_config('DEFAULT/isolated_hosts').with_value('') } - it { is_expected.to contain_nova_config('DEFAULT/scheduler_default_filters').with_value('') } - it { is_expected.to contain_nova_config('DEFAULT/baremetal_scheduler_default_filters').with_value('') } + it { is_expected.to contain_nova_config('scheduler/host_manager').with_value('host_manager') } + 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('') } + 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') } + it { is_expected.to contain_nova_config('filter_scheduler/available_filters').with_value(['nova.scheduler.filters.all_filters']) } + it { is_expected.to contain_nova_config('filter_scheduler/weight_classes').with_value('nova.scheduler.weights.all_weighers') } + it { is_expected.to contain_nova_config('filter_scheduler/use_baremetal_filters').with_value(false) } + it { is_expected.to contain_nova_config('filter_scheduler/isolated_images').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/isolated_hosts').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/enabled_filters').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/baremetal_enabled_filters').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/track_instance_changes').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/ram_weight_multiplier').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/disk_weight_multiplier').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/io_ops_weight_multiplier').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/soft_affinity_weight_multiplier').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/soft_anti_affinity_weight_multiplier').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/restrict_isolated_hosts_to_isolated_images').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/aggregate_image_properties_isolation_namespace').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/aggregate_image_properties_isolation_separator').with_value('') } + + it { is_expected.to contain_nova_config('DEFAULT/scheduler_host_manager').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/scheduler_max_attempts').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/scheduler_host_subset_size').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/max_io_ops_per_host').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/max_instances_per_host').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/scheduler_available_filters').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/scheduler_weight_classes').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/scheduler_use_baremetal_filters').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/isolated_images').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/isolated_hosts').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/scheduler_default_filters').with_ensure('absent') } + it { is_expected.to contain_nova_config('DEFAULT/baremetal_scheduler_default_filters').with_ensure('absent') } end context 'when overriding params with non-empty arrays' do @@ -35,13 +58,13 @@ describe 'nova::scheduler::filter' do } end - it { is_expected.to contain_nova_config('DEFAULT/scheduler_max_attempts').with_value('4') } - it { is_expected.to contain_nova_config('DEFAULT/isolated_images').with_value('ubuntu1,centos2') } - it { is_expected.to contain_nova_config('DEFAULT/isolated_hosts').with_value('192.168.1.2,192.168.1.3') } - it { is_expected.to contain_nova_config('DEFAULT/scheduler_default_filters').with_value('RetryFilter,AvailabilityZoneFilter,RamFilter') } - it { is_expected.to contain_nova_config('DEFAULT/scheduler_use_baremetal_filters').with_value(true) } - it { is_expected.to contain_nova_config('DEFAULT/baremetal_scheduler_default_filters').with_value('ExactRamFilter,ExactDiskFilter,ExactCoreFilter') } - it { is_expected.to contain_nova_config('DEFAULT/scheduler_available_filters').with_value(['nova_filter1','nova_filter2']) } + it { is_expected.to contain_nova_config('scheduler/max_attempts').with_value('4') } + it { is_expected.to contain_nova_config('filter_scheduler/isolated_images').with_value('ubuntu1,centos2') } + it { is_expected.to contain_nova_config('filter_scheduler/isolated_hosts').with_value('192.168.1.2,192.168.1.3') } + it { is_expected.to contain_nova_config('filter_scheduler/enabled_filters').with_value('RetryFilter,AvailabilityZoneFilter,RamFilter') } + it { is_expected.to contain_nova_config('filter_scheduler/use_baremetal_filters').with_value(true) } + it { is_expected.to contain_nova_config('filter_scheduler/baremetal_enabled_filters').with_value('ExactRamFilter,ExactDiskFilter,ExactCoreFilter') } + it { is_expected.to contain_nova_config('filter_scheduler/available_filters').with_value(['nova_filter1','nova_filter2']) } end context 'when overriding params with empty arrays' do @@ -52,10 +75,10 @@ describe 'nova::scheduler::filter' do :baremetal_scheduler_default_filters => [], } end - it { is_expected.to contain_nova_config('DEFAULT/isolated_images').with_value('') } - it { is_expected.to contain_nova_config('DEFAULT/isolated_hosts').with_value('') } - it { is_expected.to contain_nova_config('DEFAULT/scheduler_default_filters').with_value('') } - it { is_expected.to contain_nova_config('DEFAULT/baremetal_scheduler_default_filters').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/isolated_images').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/isolated_hosts').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/enabled_filters').with_value('') } + it { is_expected.to contain_nova_config('filter_scheduler/baremetal_enabled_filters').with_value('') } end end diff --git a/spec/classes/nova_scheduler_spec.rb b/spec/classes/nova_scheduler_spec.rb index 34873482e..ad1c6e1d2 100644 --- a/spec/classes/nova_scheduler_spec.rb +++ b/spec/classes/nova_scheduler_spec.rb @@ -20,7 +20,8 @@ describe 'nova::scheduler' do :ensure => 'running' )} - it { is_expected.to contain_nova_config('DEFAULT/scheduler_driver').with_value('filter_scheduler') } + it { is_expected.to contain_nova_config('DEFAULT/scheduler_driver').with_ensure('absent') } + it { is_expected.to contain_nova_config('scheduler/driver').with_value('filter_scheduler') } context 'with manage_service as false' do let :params do @@ -46,7 +47,7 @@ describe 'nova::scheduler' do { :scheduler_driver => 'custom driver' } end - it { is_expected.to contain_nova_config('DEFAULT/scheduler_driver').with_value('custom driver') } + it { is_expected.to contain_nova_config('scheduler/driver').with_value('custom driver') } end context 'with default database parameters' do