Merge "NUMA aware vswitches"

This commit is contained in:
Zuul 2018-07-30 15:09:26 +00:00 committed by Gerrit Code Review
commit dc503260b0
3 changed files with 67 additions and 0 deletions

View File

@ -163,6 +163,15 @@
# Accepts a string e.g "node:0,size:1GB,count:4" or a list of strings e.g:
# ["node:0,size:1GB,count:4", "node:1,size:1GB,count:4"]
#
# [*neutron_physnets_numa_nodes_mapping*]
# (optional) Map of physnet name as key and list of NUMA nodes as value.
# Defaults to {}
#
# [*neutron_tunnel_numa_nodes*]
# (optional) List of NUMA nodes to configure NUMA affinity for all
# tunneled networks.
# Defaults to []
#
# DEPRECATED PARAMETERS
#
# [*keymgr_api_class*]
@ -205,6 +214,8 @@ class nova::compute (
$keymgr_backend = 'nova.keymgr.conf_key_mgr.ConfKeyManager',
$verify_glance_signatures = $::os_service_default,
$reserved_huge_pages = $::os_service_default,
$neutron_physnets_numa_nodes_mapping = {},
$neutron_tunnel_numa_nodes = [],
# DEPRECATED PARAMETERS
$keymgr_api_class = undef,
) {
@ -237,6 +248,34 @@ class nova::compute (
})
}
if !empty($neutron_physnets_numa_nodes_mapping) {
validate_hash($neutron_physnets_numa_nodes_mapping)
$neutron_physnets_real = keys($neutron_physnets_numa_nodes_mapping)
nova_config {
'neutron/physnets': value => join(any2array($neutron_physnets_real), ',');
}
$neutron_physnets_numa_nodes_mapping.each |$physnet, $numa_nodes| {
nova_config {
"neutron_physnet_${physnet}/numa_nodes": value => join(any2array($numa_nodes), ',');
}
}
} else {
nova_config {
'neutron/physnets': ensure => absent;
}
}
if !empty($neutron_tunnel_numa_nodes) {
nova_config {
'neutron_tunnel/numa_nodes': value => join(any2array($neutron_tunnel_numa_nodes), ',');
}
} else {
nova_config {
'neutron_tunnel/numa_nodes': ensure => absent;
}
}
if !is_service_default($reserved_huge_pages) and !empty($reserved_huge_pages) {
if is_array($reserved_huge_pages) or is_string($reserved_huge_pages) {
$reserved_huge_pages_real = $reserved_huge_pages

View File

@ -0,0 +1,6 @@
---
features:
- |
Add parameters `neutron_physnets_numa_nodes_mapping` and
`neutron_tunnel_numa_nodes` to provide numa affinity for
physnets attached to vswitches.

View File

@ -226,6 +226,28 @@ describe 'nova::compute' do
end
context 'when neutron_physnets_numa_nodes_mapping and neutron_tunnel_numa_nodes are empty' do
let :params do
{ :neutron_physnets_numa_nodes_mapping => {},
:neutron_tunnel_numa_nodes => [], }
end
it { is_expected.to contain_nova_config('neutron/physnets').with(:ensure => 'absent') }
it { is_expected.to contain_nova_config('neutron_tunnel/numa_nodes').with(:ensure => 'absent') }
end
context 'when neutron_physnets_numa_nodes_mapping and neutron_tunnel_numa_nodes are set to valid values' do
let :params do
{ :neutron_physnets_numa_nodes_mapping => { 'foo' => [0, 1], 'bar' => [0] },
:neutron_tunnel_numa_nodes => 1, }
end
it { is_expected.to contain_nova_config('neutron/physnets').with(:value => 'foo,bar') }
it { is_expected.to contain_nova_config('neutron_physnet_foo/numa_nodes').with(:value => '0,1') }
it { is_expected.to contain_nova_config('neutron_physnet_bar/numa_nodes').with(:value => '0') }
it { is_expected.to contain_nova_config('neutron_tunnel/numa_nodes').with(:value => '1') }
end
context 'with install_bridge_utils set to false' do
let :params do
{ :install_bridge_utils => false }