Fix the way hugepages/cpu_pinning options settings are checked
According to recent changes in Nailgun, HugePages and CPU pinning feature flags are available only on compute nodes. Adding function to get this information from compute nodes hash for controller-specific tasks Partially-Implements: blueprint support-hugepages Partially-Implements: blueprint support-numa-cpu-pinning Change-Id: I39442e728f1489d7ea7752e48f23f350114b0c22
This commit is contained in:
parent
097d7a3152
commit
87e99678b7
|
@ -0,0 +1,34 @@
|
|||
module Puppet::Parser::Functions
|
||||
newfunction(:filter_nodes_with_enabled_option, :type => :rvalue, :doc => <<-EOS
|
||||
Return a list of hosts (fqdn) where selected option is enabled
|
||||
Argument1: nodes hash (network_metadata)
|
||||
Argument2: string: option to look for
|
||||
Returns: a list of nodes
|
||||
EOS
|
||||
) do |args|
|
||||
|
||||
if args.size != 2
|
||||
raise Puppet::ParseError, 'This function takes exactly 2 arguments.'
|
||||
end
|
||||
|
||||
nodes = args[0]
|
||||
option = args[1]
|
||||
|
||||
unless nodes.is_a?(Hash)
|
||||
raise Puppet::ParseError, 'The first argument must be a hash'
|
||||
end
|
||||
|
||||
unless option.is_a?(String)
|
||||
raise Puppet::ParseError, 'The second argument must be a string'
|
||||
end
|
||||
|
||||
filtered_nodes = []
|
||||
nodes.each do |node, node_hash|
|
||||
if node_hash.fetch(option, false) == true
|
||||
filtered_nodes.push node_hash['fqdn']
|
||||
end
|
||||
end
|
||||
filtered_nodes
|
||||
|
||||
end
|
||||
end
|
|
@ -59,8 +59,9 @@ $region = hiera('region', 'RegionOne')
|
|||
$workers_max = hiera('workers_max', 16)
|
||||
$service_workers = pick($nova_hash['workers'],
|
||||
min(max($::processorcount, 2), $workers_max))
|
||||
$use_huge_pages = pick($node_hash['nova_hugepages_enabled'], false)
|
||||
$enable_cpu_pinning = pick($node_hash['nova_cpu_pinning_enabled'], false)
|
||||
$compute_nodes = get_nodes_hash_by_roles($network_metadata, ['compute'])
|
||||
$huge_pages_nodes = filter_nodes_with_enabled_option($compute_nodes, 'nova_hugepages_enabled')
|
||||
$cpu_pinning_nodes = filter_nodes_with_enabled_option($compute_nodes, 'nova_cpu_pinning_enabled')
|
||||
|
||||
$ironic_hash = hiera_hash('ironic', {})
|
||||
|
||||
|
@ -82,6 +83,18 @@ if $pci_vendor_devs {
|
|||
$sriov_enabled = false
|
||||
}
|
||||
|
||||
if size($huge_pages_nodes) > 0 {
|
||||
$use_huge_pages = true
|
||||
} else {
|
||||
$use_huge_pages = false
|
||||
}
|
||||
|
||||
if size($cpu_pinning_nodes) > 0 {
|
||||
$enable_cpu_pinning = true
|
||||
} else {
|
||||
$enable_cpu_pinning = false
|
||||
}
|
||||
|
||||
$db_type = 'mysql'
|
||||
$db_host = pick($nova_hash['db_host'], hiera('database_vip'))
|
||||
$db_user = pick($nova_hash['db_user'], 'nova')
|
||||
|
|
|
@ -30,11 +30,10 @@ describe manifest do
|
|||
end
|
||||
|
||||
workers_max = Noop.hiera 'workers_max'
|
||||
network_metadata = Noop.hiera 'network_metadata'
|
||||
network_metadata = Noop.hiera_hash('network_metadata')
|
||||
memcache_roles = Noop.hiera 'memcache_roles'
|
||||
memcache_addresses = Noop.hiera 'memcached_addresses', false
|
||||
memcache_server_port = Noop.hiera 'memcache_server_port', '11211'
|
||||
|
||||
let(:memcache_nodes) do
|
||||
Noop.puppet_function 'get_nodes_hash_by_roles', network_metadata, memcache_roles
|
||||
end
|
||||
|
@ -414,9 +413,11 @@ describe manifest do
|
|||
end
|
||||
end
|
||||
|
||||
let(:node_hash) { Noop.hiera_hash 'node' }
|
||||
let(:enable_hugepages) { node_hash.fetch('nova_hugepages_enabled', false) }
|
||||
let(:enable_cpu_pinning) { node_hash.fetch('nova_cpu_pinning_enabled', false) }
|
||||
let(:compute_nodes) { Noop.puppet_function 'get_nodes_hash_by_roles', network_metadata, ['compute'] }
|
||||
let(:huge_pages_nodes) { Noop.puppet_function 'filter_nodes_with_enabled_option', compute_nodes, 'nova_hugepages_enabled' }
|
||||
let(:cpu_pinning_nodes) { Noop.puppet_function 'filter_nodes_with_enabled_option', compute_nodes, 'nova_cpu_pinning_enabled' }
|
||||
let(:enable_hugepages) { huge_pages_nodes.size() > 0 ? true : false }
|
||||
let(:enable_cpu_pinning) { cpu_pinning_nodes.size() > 0 ? true : false }
|
||||
|
||||
it 'should declare nova::scheduler::filter with an appropriate filters' do
|
||||
nova_scheduler_filters = []
|
||||
|
|
Loading…
Reference in New Issue