Add group configuration to qemu.conf file
Vhost user sockets are shared between qemu and ovs. Currently, we are patching ovs service file to make ovs run as qemu user. In order to avoid it, a new group 'hugetlbfs' has been introduced, which will be used by ovs and qemu. This patch allows the users to configure the group setting for qemu.conf file. Change-Id: I0fa3934b345d51de85fd9d8a5a211b8e1bc50d86
This commit is contained in:
parent
8c6ce7af30
commit
87e9b30004
@ -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
Block a user