Expose reserved_huge_pages param

Adds the ability to set reserved_huge_pages on nova-computes via a string or
a list of strings.

Change-Id: I50cc58f8039377362e3ec24a1eef16af6ff2f0f6
This commit is contained in:
Oliver Walsh 2018-03-21 21:59:51 +00:00
parent 919fc8160a
commit d7a6b42309
3 changed files with 50 additions and 0 deletions

View File

@ -146,6 +146,12 @@
# (optional) Whether to verify image signatures. (boolean value)
# Defaults to $::os_service_default
#
# [*reserved_huge_pages*]
# (optional) Number of huge memory pages to reserved per NUMA host cell.
# Defaults to $::os_service_default
# 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"]
#
# DEPRECATED PARAMETERS
#
# [*keymgr_api_class*]
@ -185,6 +191,7 @@ class nova::compute (
$consecutive_build_service_disable_threshold = $::os_service_default,
$keymgr_backend = 'nova.keymgr.conf_key_mgr.ConfKeyManager',
$verify_glance_signatures = $::os_service_default,
$reserved_huge_pages = $::os_service_default,
# DEPRECATED PARAMETERS
$keymgr_api_class = undef,
) {
@ -211,10 +218,21 @@ class nova::compute (
})
}
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
} else {
fail("Invalid reserved_huge_pages parameter value: ${reserved_huge_pages}")
}
} else {
$reserved_huge_pages_real = $::os_service_default
}
include ::nova::availability_zone
nova_config {
'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory;
'DEFAULT/reserved_huge_pages': value => $reserved_huge_pages_real;
'DEFAULT/heal_instance_info_cache_interval': value => $heal_instance_info_cache_interval;
'DEFAULT/resize_confirm_window': value => $resize_confirm_window;
'DEFAULT/vcpu_pin_set': value => $vcpu_pin_set_real;

View File

@ -0,0 +1,5 @@
---
features:
- |
Add the ability to set reserved_huge_pages on nova-computes via a string or
a list of strings.

View File

@ -36,6 +36,7 @@ describe 'nova::compute' do
it { is_expected.to contain_nova_config('glance/verify_glance_signatures').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/max_concurrent_live_migrations').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('compute/consecutive_build_service_disable_threshold').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/reserved_huge_pages').with_value('<SERVICE DEFAULT>') }
it { is_expected.to_not contain_package('cryptsetup').with( :ensure => 'present' )}
@ -144,6 +145,32 @@ describe 'nova::compute' do
end
end
context 'with reserved_huge_pages string' do
let :params do
{
:reserved_huge_pages => "foo"
}
end
it 'configures nova reserved_huge_pages entries' do
is_expected.to contain_nova_config('DEFAULT/reserved_huge_pages').with(
'value' => 'foo'
)
end
end
context 'with reserved_huge_pages array' do
let :params do
{
:reserved_huge_pages => ["foo", "bar"]
}
end
it 'configures nova reserved_huge_pages entries' do
is_expected.to contain_nova_config('DEFAULT/reserved_huge_pages').with(
'value' => ['foo','bar']
)
end
end
context 'with barbican deprecated parameters' do
let :params do
{