Add ability to set default baremetal filters
This change introduces a two new parameters for scheduler filter manifest. These parameters allows a user to set scheduler_use_baremetal_filters and baremetal_scheduler_default_filters config values. * scheduler_use_baremetal_filters enable default baremetal filters * baremetal_scheduler_default_filters is array of default baremetal filters Change-Id: Ic5821aee3dca0915ca8976730254452eb86622c7
This commit is contained in:
parent
bf7db41d20
commit
6e508ef56c
@ -56,39 +56,57 @@
|
||||
# (optional) Which weight class names to use for weighing hosts
|
||||
# Defaults to 'nova.scheduler.weights.all_weighers'
|
||||
#
|
||||
# [*baremetal_scheduler_default_filters*]
|
||||
# (optional) An array of filters to be used by default for baremetal hosts
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*scheduler_use_baremetal_filters*]
|
||||
# (optional) Use baremetal_scheduler_default_filters or not.
|
||||
# Defaults to false
|
||||
#
|
||||
class nova::scheduler::filter (
|
||||
$scheduler_host_manager = 'nova.scheduler.host_manager.HostManager',
|
||||
$scheduler_max_attempts = '3',
|
||||
$scheduler_host_subset_size = '1',
|
||||
$cpu_allocation_ratio = '16.0',
|
||||
$disk_allocation_ratio = '1.0',
|
||||
$max_io_ops_per_host = '8',
|
||||
$max_instances_per_host = '50',
|
||||
$ram_allocation_ratio = '1.5',
|
||||
$isolated_images = false,
|
||||
$isolated_hosts = false,
|
||||
$scheduler_available_filters = 'nova.scheduler.filters.all_filters',
|
||||
$scheduler_default_filters = false,
|
||||
$scheduler_weight_classes = 'nova.scheduler.weights.all_weighers',
|
||||
$scheduler_host_manager = 'nova.scheduler.host_manager.HostManager',
|
||||
$scheduler_max_attempts = '3',
|
||||
$scheduler_host_subset_size = '1',
|
||||
$cpu_allocation_ratio = '16.0',
|
||||
$disk_allocation_ratio = '1.0',
|
||||
$max_io_ops_per_host = '8',
|
||||
$max_instances_per_host = '50',
|
||||
$ram_allocation_ratio = '1.5',
|
||||
$isolated_images = false,
|
||||
$isolated_hosts = false,
|
||||
$scheduler_available_filters = 'nova.scheduler.filters.all_filters',
|
||||
$scheduler_default_filters = false,
|
||||
$scheduler_weight_classes = 'nova.scheduler.weights.all_weighers',
|
||||
$baremetal_scheduler_default_filters = undef,
|
||||
$scheduler_use_baremetal_filters = false,
|
||||
) {
|
||||
|
||||
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/cpu_allocation_ratio': value => $cpu_allocation_ratio;
|
||||
'DEFAULT/disk_allocation_ratio': value => $disk_allocation_ratio;
|
||||
'DEFAULT/max_io_ops_per_host': value => $max_io_ops_per_host;
|
||||
'DEFAULT/max_instances_per_host': value => $max_instances_per_host;
|
||||
'DEFAULT/ram_allocation_ratio': value => $ram_allocation_ratio;
|
||||
'DEFAULT/scheduler_available_filters': value => $scheduler_available_filters;
|
||||
'DEFAULT/scheduler_weight_classes': value => $scheduler_weight_classes
|
||||
'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/cpu_allocation_ratio': value => $cpu_allocation_ratio;
|
||||
'DEFAULT/disk_allocation_ratio': value => $disk_allocation_ratio;
|
||||
'DEFAULT/max_io_ops_per_host': value => $max_io_ops_per_host;
|
||||
'DEFAULT/max_instances_per_host': value => $max_instances_per_host;
|
||||
'DEFAULT/ram_allocation_ratio': value => $ram_allocation_ratio;
|
||||
'DEFAULT/scheduler_available_filters': value => $scheduler_available_filters;
|
||||
'DEFAULT/scheduler_weight_classes': value => $scheduler_weight_classes;
|
||||
'DEFAULT/scheduler_use_baremetal_filters': value => $scheduler_use_baremetal_filters;
|
||||
}
|
||||
if ($scheduler_default_filters) {
|
||||
nova_config { 'DEFAULT/scheduler_default_filters': value => join($scheduler_default_filters,',')
|
||||
nova_config { 'DEFAULT/scheduler_default_filters': value => join($scheduler_default_filters,',')
|
||||
}
|
||||
} else {
|
||||
nova_config { 'DEFAULT/scheduler_default_filters': ensure => absent
|
||||
nova_config { 'DEFAULT/scheduler_default_filters': ensure => absent
|
||||
}
|
||||
}
|
||||
if ($baremetal_scheduler_default_filters) {
|
||||
nova_config { 'DEFAULT/baremetal_scheduler_default_filters': value => join($baremetal_scheduler_default_filters,',')
|
||||
}
|
||||
} else {
|
||||
nova_config { 'DEFAULT/baremetal_scheduler_default_filters': ensure => absent
|
||||
}
|
||||
}
|
||||
if ($isolated_images) {
|
||||
|
@ -12,14 +12,17 @@ describe 'nova::scheduler::filter' do
|
||||
it { is_expected.to contain_nova_config('DEFAULT/ram_allocation_ratio').with_value('1.5') }
|
||||
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) }
|
||||
|
||||
describe 'when overriding params' do
|
||||
|
||||
let :params do
|
||||
{:scheduler_max_attempts => '4',
|
||||
:isolated_images => ['ubuntu1','centos2'],
|
||||
:isolated_hosts => ['192.168.1.2','192.168.1.3'],
|
||||
:scheduler_default_filters => ['RetryFilter','AvailabilityZoneFilter','RamFilter']
|
||||
{:scheduler_max_attempts => '4',
|
||||
:isolated_images => ['ubuntu1','centos2'],
|
||||
:isolated_hosts => ['192.168.1.2','192.168.1.3'],
|
||||
:scheduler_default_filters => ['RetryFilter','AvailabilityZoneFilter','RamFilter'],
|
||||
:scheduler_use_baremetal_filters => true,
|
||||
:baremetal_scheduler_default_filters => ['ExactRamFilter','ExactDiskFilter','ExactCoreFilter']
|
||||
}
|
||||
end
|
||||
|
||||
@ -27,6 +30,8 @@ describe 'nova::scheduler::filter' do
|
||||
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') }
|
||||
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user