Implements filters and schedules in nova.cfg

Adding filters and scheduling parameters to nova.cfg for better to reach
more smooth VM distribution across non-homogeneous compute nodes.

Backport to stable/4.1 includes follow-up fix from:
Idb3dbb6fddb18c06759e483731b971a1be953583.

Change-Id: I59a49c613da29eda04eec7dfe911d8fc31380a33
Implements: blueprint scheduler-config-improvements
Closes-Bug: 1300027
This commit is contained in:
Sergii Golovatiuk 2014-04-24 14:41:31 +00:00 committed by Dmitry Borodaenko
parent f28f6a9284
commit 6d566c59e7
3 changed files with 157 additions and 0 deletions

View File

@ -0,0 +1,114 @@
# == Class: nova:scheduler::filter
#
# This class is aim to configure nova.scheduler filter
#
# === Parameters:
#
# [*scheduler_host_manager*]
# (optional) The scheduler host manager class to use
# Defaults to 'nova.scheduler.host_manager.HostManager'
#
# [*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'
#
# [*cpu_allocation_ratio*]
# (optional) Virtual CPU to Physical CPU allocation ratio
# Defaults to '16.0'
#
# [*disk_allocation_ratio*]
# (optional) Virtual disk to physical disk allocation ratio
# Defaults to '1.0'
#
# [*max_io_ops_per_host*]
# (optional) Ignore hosts that have too many builds/resizes/snaps/migrations
# Defaults to '8'
#
# [*isolated_images*]
# (optional) Images to run on isolated host
# Defaults to false
#
# [*isolated_hosts*]
# (optional) Host reserved for specific images
# Defaults to false
#
# [*max_instances_per_host*]
# (optional) Ignore hosts that have too many instances
# Defaults to '50'
#
# [*ram_allocation_ratio:*]
# (optional) Virtual ram to physical ram allocation ratio
# Defaults to '1.5'
#
# [*scheduler_available_filters*]
# (optional) Filter classes available to the scheduler
# Defaults to 'nova.scheduler.filters.all_filters'
#
# [*scheduler_default_filters*]
# (optional) A comma separated list of filters to be used by default
# Defaults to false
#
# [*scheduler_weight_classes*]
# (optional) Which weight class names to use for weighing hosts
# Defaults to 'nova.scheduler.weights.all_weighers'
#
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',
$ram_weight_multiplier = '1.0',
) {
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/ram_weight_multiplier': value => $ram_weight_multiplier
}
if ($scheduler_default_filters) {
nova_config { 'DEFAULT/scheduler_default_filters': value => join($scheduler_default_filters,',')
}
} else {
nova_config { 'DEFAULT/scheduler_default_filters': ensure => absent
}
}
if ($isolated_images) {
nova_config {
'DEFAULT/isolated_images': value => join($isolated_images,',')
}
} else {
nova_config {
'DEFAULT/isolated_images': ensure => absent
}
}
if ($isolated_hosts) {
nova_config {
'DEFAULT/isolated_hosts': value => join($isolated_hosts,',')
}
} else {
nova_config {
'DEFAULT/isolated_hosts': ensure => absent
}
}
}

View File

@ -0,0 +1,34 @@
require 'spec_helper'
describe 'nova::scheduler::filter' do
it { should contain_nova_config('DEFAULT/scheduler_host_manager').with_value('nova.scheduler.host_manager.HostManager') }
it { should contain_nova_config('DEFAULT/scheduler_max_attempts').with_value('3') }
it { should contain_nova_config('DEFAULT/scheduler_host_subset_size').with_value('1') }
it { should contain_nova_config('DEFAULT/cpu_allocation_ratio').with_value('16.0') }
it { should contain_nova_config('DEFAULT/disk_allocation_ratio').with_value('1.0') }
it { should contain_nova_config('DEFAULT/max_io_ops_per_host').with_value('8') }
it { should contain_nova_config('DEFAULT/max_instances_per_host').with_value('50') }
it { should contain_nova_config('DEFAULT/ram_allocation_ratio').with_value('1.5') }
it { should contain_nova_config('DEFAULT/scheduler_available_filters').with_value('nova.scheduler.filters.all_filters') }
it { should contain_nova_config('DEFAULT/scheduler_weight_classes').with_value('nova.scheduler.weights.all_weighers') }
it { should contain_nova_config('DEFAULT/ram_weight_multiplier').with_value('1.0') }
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']
}
end
it { should contain_nova_config('DEFAULT/scheduler_max_attempts').with_value('4') }
it { should contain_nova_config('DEFAULT/isolated_images').with_value('ubuntu1,centos2') }
it { should contain_nova_config('DEFAULT/isolated_hosts').with_value('192.168.1.2,192.168.1.3') }
it { should contain_nova_config('DEFAULT/scheduler_default_filters').with_value('RetryFilter,AvailabilityZoneFilter,RamFilter') }
end
end

View File

@ -276,6 +276,15 @@ class openstack::nova::controller (
ensure_package => $ensure_package
}
class { '::nova::scheduler::filter':
cpu_allocation_ratio => '8.0',
disk_allocation_ratio => '1.0',
ram_allocation_ratio => '1.0',
scheduler_host_subset_size => '30',
ram_weight_multiplier => '1.0',
scheduler_default_filters => [ RetryFilter, AvailabilityZoneFilter, RamFilter, CoreFilter, DiskFilter, ComputeFilter, ComputeCapabilitiesFilter, ImagePropertiesFilter ]
}
class { '::nova::consoleauth':
enabled => $enabled,
ensure_package => $ensure_package,