Skip hugepages allocation if no HP info is present

Nailgun doesn't include into deployment info hugepages
allocation if 1GB hugepages are present. So, we should
skip its configuration in this case.

Change-Id: Ieaeeee3a0fe4ef23f662bec72571b855d3381c3e
Closes-bug: #1560532
This commit is contained in:
slava 2016-03-31 22:04:14 +03:00
parent fccfbb6d51
commit 9d27279b37
2 changed files with 32 additions and 30 deletions

View File

@ -4,20 +4,22 @@ class openstack_tasks::roles::allocate_hugepages {
$hugepages = hiera('hugepages', [])
include ::sysfs
# TODO: (vvalyavskiy) currently, it was decided to not include 'hugepages' mapping data into
# deployment info if 1GB hugepages is enabled. So, it means that no hugepages count should
# be configured in runtime in this case.
unless empty($hugepages) {
include ::sysfs
sysfs_config_value { 'hugepages':
ensure => 'present',
name => '/etc/sysfs.d/hugepages.conf',
value => map_sysfs_hugepages($hugepages),
sysfs => '/sys/devices/system/node/node*/hugepages/hugepages-*kB/nr_hugepages',
# TODO: (vvalyavskiy) should be wiped out as soon as kernel will be upgraded to 3.16 version
exclude => '/sys/devices/system/node/node*/hugepages/hugepages-1048576kB/nr_hugepages',
sysfs_config_value { 'hugepages':
ensure => 'present',
name => '/etc/sysfs.d/hugepages.conf',
value => map_sysfs_hugepages($hugepages),
sysfs => '/sys/devices/system/node/node*/hugepages/hugepages-*kB/nr_hugepages',
}
# LP 1507921
sysctl::value { 'vm.max_map_count':
value => max_map_count_hugepages($hugepages),
}
}
# LP 1507921
sysctl::value { 'vm.max_map_count':
value => max_map_count_hugepages($hugepages),
}
}

View File

@ -26,23 +26,23 @@ manifest = 'roles/allocate_hugepages.pp'
describe manifest do
shared_examples 'catalog' do
hugepages = Noop.hiera 'hugepages', []
mapped_sysfs_hugepages = hugepages.empty? ? { 'default' => 0 } : {
'node0/hugepages/hugepages-2048kB' => 512,
'node1/hugepages/hugepages-1048576kB' => 8,
'default' => 0
}
max_map_count = hugepages.empty? ? '65530' : '66570'
unless hugepages.empty?
mapped_sysfs_hugepages = {
'node0/hugepages/hugepages-2048kB' => 512,
'node1/hugepages/hugepages-1048576kB' => 8,
'default' => 0
}
it "should allocate defined hugepages" do
should contain_class('sysfs')
should contain_sysfs_config_value('hugepages').with(
'ensure' => 'present',
'name' => '/etc/sysfs.d/hugepages.conf',
'value' => mapped_sysfs_hugepages,
'sysfs' => '/sys/devices/system/node/node*/hugepages/hugepages-*kB/nr_hugepages',
'exclude' => '/sys/devices/system/node/node*/hugepages/hugepages-1048576kB/nr_hugepages',
)
should contain_sysctl__value('vm.max_map_count').with_value(max_map_count)
it "should allocate defined hugepages" do
should contain_class('sysfs')
should contain_sysfs_config_value('hugepages').with(
'ensure' => 'present',
'name' => '/etc/sysfs.d/hugepages.conf',
'value' => mapped_sysfs_hugepages,
'sysfs' => '/sys/devices/system/node/node*/hugepages/hugepages-*kB/nr_hugepages',
)
should contain_sysctl__value('vm.max_map_count').with_value('66570')
end
end
end
test_ubuntu_and_centos manifest