Support more scheduler options
Increase coverage of scheduler options (especially scheduler filter options) configurable via native class parameters. Change-Id: Ie539b83e90766a577f1da83a30b9b67f15b0c534
This commit is contained in:
parent
c96860fb90
commit
fe9454054e
@ -4,10 +4,18 @@
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*scheduler_driver*]
|
||||
# [*driver*]
|
||||
# (Optional) Default scheduler driver to use
|
||||
# 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 share
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (Optional) The state of the scheduler package
|
||||
# Defaults to 'present'.
|
||||
@ -20,18 +28,38 @@
|
||||
# (Optional) Whether to start/stop the service
|
||||
# Defaults to true.
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*scheduler_driver*]
|
||||
# (Optional) Default scheduler driver to use
|
||||
# Defaults to undef
|
||||
#
|
||||
class manila::scheduler (
|
||||
$scheduler_driver = $facts['os_service_default'],
|
||||
$driver = $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 manila::deps
|
||||
include manila::params
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
manila_config {
|
||||
'DEFAULT/scheduler_driver': value => $scheduler_driver
|
||||
'DEFAULT/scheduler_driver': value => $driver_real;
|
||||
'DEFAULT/scheduler_host_manager': value => $host_manager;
|
||||
'DEFAULT/scheduler_max_attempts': value => $max_attempts;
|
||||
}
|
||||
|
||||
if $::manila::params::scheduler_package {
|
||||
|
58
manifests/scheduler/filter.pp
Normal file
58
manifests/scheduler/filter.pp
Normal file
@ -0,0 +1,58 @@
|
||||
# == Class: manila:scheduler::filter
|
||||
#
|
||||
# This class is aim to configure manila.scheduler filter
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*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']
|
||||
#
|
||||
# [*default_share_group_filters*]
|
||||
# (Optional) List of filter class names to use for filtering hosts creating
|
||||
# share group.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*default_extend_filters*]
|
||||
# (Optional) List of filter class names to use for filtering hosts
|
||||
# extending share.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*pool_weight_multiplier*]
|
||||
# (Optional) Multiplier used for weighing existing share servers in a pool
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*capacity_weight_multiplier*]
|
||||
# (Optional) Multiplier used for weighing share capacity.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
class manila::scheduler::filter (
|
||||
$default_filters = $facts['os_service_default'],
|
||||
$default_weighers = $facts['os_service_default'],
|
||||
$default_share_group_filters = $facts['os_service_default'],
|
||||
$default_extend_filters = $facts['os_service_default'],
|
||||
$pool_weight_multiplier = $facts['os_service_default'],
|
||||
$capacity_weight_multiplier = $facts['os_service_default'],
|
||||
) {
|
||||
|
||||
include manila::deps
|
||||
|
||||
manila_config {
|
||||
'DEFAULT/scheduler_default_filters':
|
||||
value => join(any2array($default_filters),',');
|
||||
'DEFAULT/scheduler_default_weighers':
|
||||
value => join(any2array($default_weighers),',');
|
||||
'DEFAULT/scheduler_default_share_group_filters':
|
||||
value => join(any2array($default_share_group_filters),',');
|
||||
'DEFAULT/scheduler_default_extend_filters':
|
||||
value => join(any2array($default_extend_filters),',');
|
||||
'DEFAULT/pool_weight_multiplier':
|
||||
value => $pool_weight_multiplier;
|
||||
'DEFAULT/capacity_weight_multiplier':
|
||||
value => $capacity_weight_multiplier;
|
||||
}
|
||||
}
|
16
releasenotes/notes/more-scheduler-opts-49f6a5b477414e49.yaml
Normal file
16
releasenotes/notes/more-scheduler-opts-49f6a5b477414e49.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The following parameters have been added to the ``manila::scheduler``
|
||||
class.
|
||||
|
||||
- ``max_attempts``
|
||||
- ``host_manager``
|
||||
|
||||
- |
|
||||
The new ``manila::scheduler::filter`` class has been added.
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
The ``manila::scheduler::scheduler_driver`` parameter has been deprecated,
|
||||
in favor of the new ``driver`` parameter.
|
86
spec/classes/manila_scheduler_filter_spec.rb
Normal file
86
spec/classes/manila_scheduler_filter_spec.rb
Normal file
@ -0,0 +1,86 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'manila::scheduler::filter' do
|
||||
shared_examples 'manila::scheduler::filter' do
|
||||
|
||||
|
||||
context 'with defaults' do
|
||||
it 'contains default values' do
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_filters').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_weighers').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_share_group_filters').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_extend_filters').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/pool_weight_multiplier').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/capacity_weight_multiplier').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parmeters' do
|
||||
let :params do
|
||||
{
|
||||
:default_filters => 'AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter',
|
||||
:default_weighers => 'CapacityWeigher,GoodnessWeigher',
|
||||
:default_share_group_filters => 'AvailabilityZoneFilter,ConsistentSnapshotFilter',
|
||||
:default_extend_filters => 'CapacityFilter,DriverFilter',
|
||||
:pool_weight_multiplier => 1.0,
|
||||
:capacity_weight_multiplier => 1.1,
|
||||
}
|
||||
end
|
||||
|
||||
it 'contains overridden values' do
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_filters').with_value(
|
||||
'AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter'
|
||||
)
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_weighers').with_value(
|
||||
'CapacityWeigher,GoodnessWeigher'
|
||||
)
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_share_group_filters').with_value(
|
||||
'AvailabilityZoneFilter,ConsistentSnapshotFilter'
|
||||
)
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_extend_filters').with_value(
|
||||
'CapacityFilter,DriverFilter'
|
||||
)
|
||||
is_expected.to contain_manila_config('DEFAULT/pool_weight_multiplier').with_value(1.0)
|
||||
is_expected.to contain_manila_config('DEFAULT/capacity_weight_multiplier').with_value(1.1)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters (array values)' do
|
||||
let :params do
|
||||
{
|
||||
:default_filters => ['AvailabilityZoneFilter', 'CapacityFilter', 'CapabilitiesFilter'],
|
||||
:default_weighers => ['CapacityWeigher', 'GoodnessWeigher'],
|
||||
:default_share_group_filters => ['AvailabilityZoneFilter', 'ConsistentSnapshotFilter'],
|
||||
:default_extend_filters => ['CapacityFilter', 'DriverFilter'],
|
||||
}
|
||||
end
|
||||
|
||||
it 'contains overridden values' do
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_filters').with_value(
|
||||
'AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter'
|
||||
)
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_weighers').with_value(
|
||||
'CapacityWeigher,GoodnessWeigher'
|
||||
)
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_share_group_filters').with_value(
|
||||
'AvailabilityZoneFilter,ConsistentSnapshotFilter'
|
||||
)
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_default_extend_filters').with_value(
|
||||
'CapacityFilter,DriverFilter'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'manila::scheduler::filter'
|
||||
end
|
||||
end
|
||||
end
|
@ -8,7 +8,11 @@ describe 'manila::scheduler' do
|
||||
|
||||
it { is_expected.to contain_class('manila::params') }
|
||||
|
||||
it { is_expected.to contain_manila_config('DEFAULT/scheduler_driver').with_value('<SERVICE DEFAULT>') }
|
||||
it 'configures the default values' do
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_driver').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_host_manager').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_max_attempts').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
it { is_expected.to contain_service('manila-scheduler').with(
|
||||
:name => platform_params[:scheduler_service],
|
||||
@ -23,11 +27,21 @@ describe 'manila::scheduler' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:scheduler_driver => 'manila.scheduler.filter_scheduler.FilterScheduler',
|
||||
:driver => 'manila.scheduler.filter_scheduler.FilterScheduler',
|
||||
:host_manager => 'manila.scheduler.host_manager.HostManager',
|
||||
:max_attempts => 3,
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_manila_config('DEFAULT/scheduler_driver').with_value('manila.scheduler.filter_scheduler.FilterScheduler') }
|
||||
it 'configures the overridden values' do
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_driver').with_value(
|
||||
'manila.scheduler.filter_scheduler.FilterScheduler'
|
||||
)
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_host_manager').with_value(
|
||||
'manila.scheduler.host_manager.HostManager'
|
||||
)
|
||||
is_expected.to contain_manila_config('DEFAULT/scheduler_max_attempts').with_value(3)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with manage_service false' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user