Merge "Allow user to define a custom tuned profile"
This commit is contained in:
commit
9255b7d1c5
|
@ -8,11 +8,31 @@
|
||||||
# (optional) tuned active profile.
|
# (optional) tuned active profile.
|
||||||
# Defaults to 'throughput-performance'
|
# Defaults to 'throughput-performance'
|
||||||
#
|
#
|
||||||
|
# [*custom_profile*]
|
||||||
|
# (optional) string in INI format defining a custom profile
|
||||||
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
class tripleo::profile::base::tuned (
|
class tripleo::profile::base::tuned (
|
||||||
$profile = 'throughput-performance'
|
$profile = 'throughput-performance',
|
||||||
|
$custom_profile = undef
|
||||||
) {
|
) {
|
||||||
ensure_resource('package', 'tuned', { ensure => 'present' })
|
ensure_resource('package', 'tuned', { ensure => 'present' })
|
||||||
|
if !empty($custom_profile) {
|
||||||
|
file { "/etc/tuned/${profile}":
|
||||||
|
ensure => 'directory',
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
} ->
|
||||||
|
file { "/etc/tuned/${profile}/tuned.conf":
|
||||||
|
before => Exec['tuned-adm'],
|
||||||
|
ensure => present,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0644',
|
||||||
|
content => $custom_profile,
|
||||||
|
}
|
||||||
|
}
|
||||||
exec { 'tuned-adm':
|
exec { 'tuned-adm':
|
||||||
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
|
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
|
||||||
command => "tuned-adm profile ${profile}",
|
command => "tuned-adm profile ${profile}",
|
||||||
|
|
|
@ -30,8 +30,29 @@ describe 'tripleo::profile::base::tuned' do
|
||||||
is_expected.to contain_exec('tuned-adm')
|
is_expected.to contain_exec('tuned-adm')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
context 'with custom profile' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:profile => 'custom',
|
||||||
|
:custom_profile => 'foo'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should create a custom tuned profile' do
|
||||||
|
is_expected.to contain_file('/etc/tuned/custom/tuned.conf').with({
|
||||||
|
'content' => 'foo',
|
||||||
|
'owner' => 'root',
|
||||||
|
'group' => 'root',
|
||||||
|
'mode' => '0644',
|
||||||
|
})
|
||||||
|
end
|
||||||
|
it 'should run a tuned-adm exec to set the custom profile' do
|
||||||
|
is_expected.to contain_exec('tuned-adm').with_command(
|
||||||
|
'tuned-adm profile custom'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
on_supported_os.each do |os, facts|
|
on_supported_os.each do |os, facts|
|
||||||
context "on #{os}" do
|
context "on #{os}" do
|
||||||
let(:facts) {
|
let(:facts) {
|
||||||
|
|
Loading…
Reference in New Issue