Merge "Add group configuration to qemu.conf file"
This commit is contained in:
commit
9606525df2
|
@ -8,6 +8,10 @@
|
||||||
# (optional) Whether or not configure qemu bits.
|
# (optional) Whether or not configure qemu bits.
|
||||||
# Defaults to false.
|
# Defaults to false.
|
||||||
#
|
#
|
||||||
|
# [*group*]
|
||||||
|
# (optional) Group under which the qemu should run.
|
||||||
|
# Defaults to undef.
|
||||||
|
#
|
||||||
# [*max_files*]
|
# [*max_files*]
|
||||||
# (optional) Maximum number of opened files, per process.
|
# (optional) Maximum number of opened files, per process.
|
||||||
# Defaults to 1024.
|
# Defaults to 1024.
|
||||||
|
@ -18,6 +22,7 @@
|
||||||
#
|
#
|
||||||
class nova::compute::libvirt::qemu(
|
class nova::compute::libvirt::qemu(
|
||||||
$configure_qemu = false,
|
$configure_qemu = false,
|
||||||
|
$group = undef,
|
||||||
$max_files = 1024,
|
$max_files = 1024,
|
||||||
$max_processes = 4096,
|
$max_processes = 4096,
|
||||||
){
|
){
|
||||||
|
@ -34,12 +39,20 @@ class nova::compute::libvirt::qemu(
|
||||||
|
|
||||||
if $configure_qemu {
|
if $configure_qemu {
|
||||||
|
|
||||||
|
$augues_changes_default = [
|
||||||
|
"set max_files ${max_files}",
|
||||||
|
"set max_processes ${max_processes}",
|
||||||
|
]
|
||||||
|
if $group and !empty($group) {
|
||||||
|
$augues_group_changes = ["set group ${group}"]
|
||||||
|
} else {
|
||||||
|
$augues_group_changes = []
|
||||||
|
}
|
||||||
|
$augues_changes = concat($augues_changes_default, $augues_group_changes)
|
||||||
|
|
||||||
augeas { 'qemu-conf-limits':
|
augeas { 'qemu-conf-limits':
|
||||||
context => '/files/etc/libvirt/qemu.conf',
|
context => '/files/etc/libvirt/qemu.conf',
|
||||||
changes => [
|
changes => $augues_changes,
|
||||||
"set max_files ${max_files}",
|
|
||||||
"set max_processes ${max_processes}",
|
|
||||||
],
|
|
||||||
tag => 'qemu-conf-augeas',
|
tag => 'qemu-conf-augeas',
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,6 +61,7 @@ class nova::compute::libvirt::qemu(
|
||||||
changes => [
|
changes => [
|
||||||
'rm max_files',
|
'rm max_files',
|
||||||
'rm max_processes',
|
'rm max_processes',
|
||||||
|
'rm group',
|
||||||
],
|
],
|
||||||
tag => 'qemu-conf-augeas',
|
tag => 'qemu-conf-augeas',
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- Added group parameter to configure qemu.conf
|
|
@ -18,7 +18,7 @@ describe 'nova::compute::libvirt::qemu' do
|
||||||
end
|
end
|
||||||
it { is_expected.to contain_augeas('qemu-conf-limits').with({
|
it { is_expected.to contain_augeas('qemu-conf-limits').with({
|
||||||
:context => '/files/etc/libvirt/qemu.conf',
|
:context => '/files/etc/libvirt/qemu.conf',
|
||||||
:changes => [ "rm max_files", "rm max_processes" ],
|
:changes => [ "rm max_files", "rm max_processes", "rm group" ],
|
||||||
}).that_notifies('Service[libvirt]') }
|
}).that_notifies('Service[libvirt]') }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,6 +49,26 @@ describe 'nova::compute::libvirt::qemu' do
|
||||||
:tag => 'qemu-conf-augeas',
|
:tag => 'qemu-conf-augeas',
|
||||||
}).that_notifies('Service[libvirt]') }
|
}).that_notifies('Service[libvirt]') }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when configuring qemu with group parameter' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:configure_qemu => true,
|
||||||
|
:group => 'openvswitch',
|
||||||
|
:max_files => 32768,
|
||||||
|
:max_processes => 131072,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_augeas('qemu-conf-limits').with({
|
||||||
|
:context => '/files/etc/libvirt/qemu.conf',
|
||||||
|
:changes => [
|
||||||
|
"set max_files 32768",
|
||||||
|
"set max_processes 131072",
|
||||||
|
"set group openvswitch"
|
||||||
|
],
|
||||||
|
:tag => 'qemu-conf-augeas',
|
||||||
|
}).that_notifies('Service[libvirt]') }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
|
|
Loading…
Reference in New Issue