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
(cherry picked from commit d7a6b42309)
(cherry picked from commit 33bb6cca39)
This commit is contained in:
Oliver Walsh 2018-03-21 21:59:51 +00:00
parent 9914cd53be
commit 40eb56cbb7
3 changed files with 50 additions and 0 deletions

View File

@ -142,6 +142,12 @@
# will disable itself.
# 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
#
# [*pci_passthrough*]
@ -183,6 +189,7 @@ class nova::compute (
$barbican_api_version = $::os_service_default,
$max_concurrent_live_migrations = $::os_service_default,
$consecutive_build_service_disable_threshold = $::os_service_default,
$reserved_huge_pages = $::os_service_default,
# DEPRECATED PARAMETERS
$pci_passthrough = undef,
) {
@ -207,10 +214,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

@ -35,6 +35,7 @@ describe 'nova::compute' do
it { is_expected.to contain_nova_config('barbican/auth_endpoint').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' )}
@ -146,6 +147,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 pci params array' do
let :params do
{