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.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*group*]
|
||||
# (optional) Group under which the qemu should run.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*max_files*]
|
||||
# (optional) Maximum number of opened files, per process.
|
||||
# Defaults to 1024.
|
||||
|
@ -18,6 +22,7 @@
|
|||
#
|
||||
class nova::compute::libvirt::qemu(
|
||||
$configure_qemu = false,
|
||||
$group = undef,
|
||||
$max_files = 1024,
|
||||
$max_processes = 4096,
|
||||
){
|
||||
|
@ -34,12 +39,20 @@ class nova::compute::libvirt::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':
|
||||
context => '/files/etc/libvirt/qemu.conf',
|
||||
changes => [
|
||||
"set max_files ${max_files}",
|
||||
"set max_processes ${max_processes}",
|
||||
],
|
||||
changes => $augues_changes,
|
||||
tag => 'qemu-conf-augeas',
|
||||
}
|
||||
} else {
|
||||
|
@ -48,6 +61,7 @@ class nova::compute::libvirt::qemu(
|
|||
changes => [
|
||||
'rm max_files',
|
||||
'rm max_processes',
|
||||
'rm group',
|
||||
],
|
||||
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
|
||||
it { is_expected.to contain_augeas('qemu-conf-limits').with({
|
||||
: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]') }
|
||||
end
|
||||
|
||||
|
@ -49,6 +49,26 @@ describe 'nova::compute::libvirt::qemu' do
|
|||
:tag => 'qemu-conf-augeas',
|
||||
}).that_notifies('Service[libvirt]') }
|
||||
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
|
||||
|
||||
on_supported_os({
|
||||
|
|
Loading…
Reference in New Issue