Support more scheduler options
Increase coverage of scheduler options configurable via native class parameters. Change-Id: I1ffa4a77cd206665adfd8aecf9fe284c201f38de
This commit is contained in:
parent
a45143dd47
commit
242d08bf4d
@ -4,10 +4,23 @@
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*scheduler_driver*]
|
||||
# [*driver*]
|
||||
# (Optional) Default scheduler driver to use
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*driver_init_wait_time*]
|
||||
# (Optional) Maximum time in seconds to wait for the driver to report as
|
||||
# ready.
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*host_manager*]
|
||||
# (Optional) The scheduler host manager class to use.
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*max_attempts*]
|
||||
# (Optional) Maximum number of attempts to schedule a volume.
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (Optional) The state of the package.
|
||||
# Defaults to 'present'.
|
||||
@ -20,18 +33,41 @@
|
||||
# (Optional) Whether to start/stop the service (boolean value)
|
||||
# Defaults to true.
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*scheduler_driver*]
|
||||
# (Optional) Default scheduler driver to use
|
||||
# Defaults to undef
|
||||
#
|
||||
class cinder::scheduler (
|
||||
$scheduler_driver = $facts['os_service_default'],
|
||||
$driver = $facts['os_service_default'],
|
||||
$driver_init_wait_time = $facts['os_service_default'],
|
||||
$host_manager = $facts['os_service_default'],
|
||||
$max_attempts = $facts['os_service_default'],
|
||||
$package_ensure = 'present',
|
||||
Boolean $enabled = true,
|
||||
Boolean $manage_service = true
|
||||
Boolean $manage_service = true,
|
||||
# DEPRECATED PARAMETERS
|
||||
$scheduler_driver = undef
|
||||
) {
|
||||
|
||||
include cinder::deps
|
||||
include cinder::params
|
||||
|
||||
cinder_config { 'DEFAULT/scheduler_driver': value => $scheduler_driver; }
|
||||
if $scheduler_driver != undef {
|
||||
warning("The scheduler_driver parameter has been deprecated. \
|
||||
Use the driver parameter instead")
|
||||
$driver_real = $scheduler_driver
|
||||
} else {
|
||||
$driver_real = $driver
|
||||
}
|
||||
|
||||
cinder_config {
|
||||
'DEFAULT/scheduler_driver': value => $driver_real;
|
||||
'DEFAULT/scheduler_driver_init_wait_time': value => $driver_init_wait_time;
|
||||
'DEFAULT/scheduler_host_manager': value => $host_manager;
|
||||
'DEFAULT/scheduler_max_attempts': value => $max_attempts;
|
||||
}
|
||||
|
||||
if $::cinder::params::scheduler_package {
|
||||
package { 'cinder-scheduler':
|
||||
|
@ -4,8 +4,16 @@
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*scheduler_default_filters*]
|
||||
# (Optional) A comma separated list of filters to be used by default
|
||||
# [*default_filters*]
|
||||
# (Optional) List of filter class names to use for filtering hosts.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*default_weighers*]
|
||||
# (Optional) List of weigher class names to use for weighning hosts.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*weight_handler*]
|
||||
# (Optional) Handler to use for selecting the host/pool after weighing.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*capacity_weight_multiplier*]
|
||||
@ -20,18 +28,40 @@
|
||||
# (Optional) Multiplier used for weighing volume number..
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*scheduler_default_filters*]
|
||||
# (Optional) List of filter class names to use for filtering hosts.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
class cinder::scheduler::filter (
|
||||
$scheduler_default_filters = $facts['os_service_default'],
|
||||
$default_filters = $facts['os_service_default'],
|
||||
$default_weighers = $facts['os_service_default'],
|
||||
$weight_handler = $facts['os_service_default'],
|
||||
$capacity_weight_multiplier = $facts['os_service_default'],
|
||||
$allocated_capacity_weight_multiplier = $facts['os_service_default'],
|
||||
$volume_number_multiplier = $facts['os_service_default'],
|
||||
# DEPRECATED PARAMETERS
|
||||
$scheduler_default_filters = undef,
|
||||
) {
|
||||
|
||||
include cinder::deps
|
||||
|
||||
if $scheduler_default_filters != undef {
|
||||
warning("The scheduler_default_filters parameter has been deprecated. \
|
||||
Use the default_filters parameter instead")
|
||||
$default_filters_real = $scheduler_default_filters
|
||||
} else {
|
||||
$default_filters_real = $default_filters
|
||||
}
|
||||
|
||||
cinder_config {
|
||||
'DEFAULT/scheduler_default_filters':
|
||||
value => join(any2array($scheduler_default_filters),',');
|
||||
value => join(any2array($default_filters_real),',');
|
||||
'DEFAULT/scheduler_default_weighers':
|
||||
value => join(any2array($default_weighers),',');
|
||||
'DEFAULT/scheduler_weight_handler':
|
||||
value => $weight_handler;
|
||||
'DEFAULT/capacity_weight_multiplier':
|
||||
value => $capacity_weight_multiplier;
|
||||
'DEFAULT/allocated_capacity_weight_multiplier':
|
||||
|
25
releasenotes/notes/more-scheduler-opts-7f53704ed415f9be.yaml
Normal file
25
releasenotes/notes/more-scheduler-opts-7f53704ed415f9be.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The following parameters have been added to the ``cinder::scheduler``
|
||||
class.
|
||||
|
||||
- ``driver_init_wait_time``
|
||||
- ``host_manager``
|
||||
- ``max_attempts``
|
||||
|
||||
- |
|
||||
The following parameters have been added to
|
||||
the ``cinder::scheduler::filter`` class.
|
||||
|
||||
- ``default_weighers``
|
||||
- ``weight_handler``
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
The ``cinder::scheduler::scheduler_driver`` parameter has been deprecated,
|
||||
in favor of the new ``driver`` parameter.
|
||||
|
||||
- |
|
||||
The ``cinder::scheduler::filter::scheduler_default_filters`` parameter has
|
||||
been deprecated, in favor of the new ``default_filters`` parameter.
|
@ -1,72 +1,65 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::scheduler::filter' do
|
||||
let :default_params do
|
||||
shared_examples 'cinder::scheduler::filter' do
|
||||
|
||||
|
||||
context 'with defaults' do
|
||||
it 'contains default values' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_weighers').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_weight_handler').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cinder_config('DEFAULT/capacity_weight_multiplier').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cinder_config('DEFAULT/allocated_capacity_weight_multiplier').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cinder_config('DEFAULT/volume_number_multiplier').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parmeters' do
|
||||
let :params do
|
||||
{
|
||||
:scheduler_default_filters => '<SERVICE DEFAULT>',
|
||||
:capacity_weight_multiplier => '<SERVICE DEFAULT>',
|
||||
:allocated_capacity_weight_multiplier => '<SERVICE DEFAULT>',
|
||||
:volume_number_multiplier => '<SERVICE DEFAULT>',
|
||||
:default_filters => 'AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter',
|
||||
:default_weighers => 'CapacityWeigher,AllocatedCapacityWeigher',
|
||||
:weight_handler => 'cinder.scheduler.weights.OrderedHostWeightHandler',
|
||||
:capacity_weight_multiplier => 1.0,
|
||||
:allocated_capacity_weight_multiplier => -1.0,
|
||||
:volume_number_multiplier => -1.1,
|
||||
}
|
||||
end
|
||||
|
||||
it 'contains overridden values' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_value(
|
||||
'AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter'
|
||||
)
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_weighers').with_value(
|
||||
'CapacityWeigher,AllocatedCapacityWeigher'
|
||||
)
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_weight_handler').with_value(
|
||||
'cinder.scheduler.weights.OrderedHostWeightHandler'
|
||||
)
|
||||
is_expected.to contain_cinder_config('DEFAULT/capacity_weight_multiplier').with_value(1.0)
|
||||
is_expected.to contain_cinder_config('DEFAULT/allocated_capacity_weight_multiplier').with_value(-1.0)
|
||||
is_expected.to contain_cinder_config('DEFAULT/volume_number_multiplier').with_value(-1.1)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters (array values)' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
shared_examples 'cinder scheduler filter' do
|
||||
|
||||
let :p do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
it 'contains default values' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_value(p[:scheduler_default_filters])
|
||||
is_expected.to contain_cinder_config('DEFAULT/capacity_weight_multiplier').with_value(p[:capacity_weight_multiplier])
|
||||
is_expected.to contain_cinder_config('DEFAULT/allocated_capacity_weight_multiplier').with_value(p[:allocated_capacity_weight_multiplier])
|
||||
is_expected.to contain_cinder_config('DEFAULT/volume_number_multiplier').with_value(p[:volume_number_multiplier])
|
||||
end
|
||||
|
||||
context 'configure parameters' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:capacity_weight_multiplier => 1.0,
|
||||
:allocated_capacity_weight_multiplier => -1.0,
|
||||
:volume_number_multiplier => -1.0,
|
||||
})
|
||||
{
|
||||
:default_filters => ['AvailabilityZoneFilter', 'CapacityFilter', 'CapabilitiesFilter'],
|
||||
:default_weighers => ['CapacityWeigher', 'AllocatedCapacityWeigher'],
|
||||
}
|
||||
end
|
||||
|
||||
it 'contains overridden values' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/capacity_weight_multiplier').with_value(p[:capacity_weight_multiplier])
|
||||
is_expected.to contain_cinder_config('DEFAULT/allocated_capacity_weight_multiplier').with_value(p[:allocated_capacity_weight_multiplier])
|
||||
is_expected.to contain_cinder_config('DEFAULT/volume_number_multiplier').with_value(p[:volume_number_multiplier])
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_value(
|
||||
'AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter'
|
||||
)
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_weighers').with_value(
|
||||
'CapacityWeigher,AllocatedCapacityWeigher'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'configure filters with array' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:scheduler_default_filters => ['AvailabilityZoneFilter', 'CapacityFilter', 'CapabilitiesFilter']
|
||||
})
|
||||
end
|
||||
|
||||
it 'contains overridden values' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_value(p[:scheduler_default_filters].join(','))
|
||||
end
|
||||
end
|
||||
|
||||
context 'configure filters with string' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:scheduler_default_filters => 'AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter'
|
||||
})
|
||||
end
|
||||
|
||||
it 'contains overridden values' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_value(p[:scheduler_default_filters])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
@ -77,7 +70,7 @@ describe 'cinder::scheduler::filter' do
|
||||
facts.merge(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'cinder scheduler filter'
|
||||
it_behaves_like 'cinder::scheduler::filter'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -5,6 +5,9 @@ describe 'cinder::scheduler' do
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_class('cinder::params') }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver_init_wait_time').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_host_manager').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_max_attempts').with_value('<SERVICE DEFAULT>') }
|
||||
|
||||
it { is_expected.to contain_package('cinder-scheduler').with(
|
||||
:name => 'cinder-scheduler',
|
||||
@ -24,12 +27,22 @@ describe 'cinder::scheduler' do
|
||||
context 'with parameters' do
|
||||
let :params do
|
||||
{
|
||||
:scheduler_driver => 'cinder.scheduler.filter_scheduler.FilterScheduler',
|
||||
:driver => 'cinder.scheduler.filter_scheduler.FilterScheduler',
|
||||
:driver_init_wait_time => 60,
|
||||
:host_manager => 'cinder.scheduler.host_manager.HostManager',
|
||||
:max_attempts => 3,
|
||||
:package_ensure => 'present'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value(
|
||||
'cinder.scheduler.filter_scheduler.FilterScheduler'
|
||||
) }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver_init_wait_time').with_value(60) }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_host_manager').with_value(
|
||||
'cinder.scheduler.host_manager.HostManager'
|
||||
) }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_max_attempts').with_value(3) }
|
||||
it { is_expected.to contain_package('cinder-scheduler').with_ensure('present') }
|
||||
end
|
||||
|
||||
@ -58,11 +71,32 @@ describe 'cinder::scheduler' do
|
||||
context 'with parameters' do
|
||||
let :params do
|
||||
{
|
||||
:scheduler_driver => 'cinder.scheduler.filter_scheduler.FilterScheduler'
|
||||
:driver => 'cinder.scheduler.filter_scheduler.FilterScheduler',
|
||||
:driver_init_wait_time => 60,
|
||||
:host_manager => 'cinder.scheduler.host_manager.HostManager',
|
||||
:max_attempts => 3,
|
||||
:package_ensure => 'present'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value(
|
||||
'cinder.scheduler.filter_scheduler.FilterScheduler'
|
||||
) }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver_init_wait_time').with_value(60) }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_host_manager').with_value(
|
||||
'cinder.scheduler.host_manager.HostManager'
|
||||
) }
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_max_attempts').with_value(3) }
|
||||
end
|
||||
|
||||
context 'with manage_service false' do
|
||||
let :params do
|
||||
{
|
||||
:manage_service => false
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to_not contain_service('cinder-scheduler') }
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user