Allow vhost socket directory user/group as configurable from template

For ovs2.8 version, it is required to modify the vhost socket directory
permissions as openvswitch:hugetlbfs instead of the earlier hardcoded
values qemu:qemu. Making these values as input which could be configured
from templates.

Change-Id: Ia2d0a49567f51b8e6ecdf1967c515ef0dfe81567
This commit is contained in:
Saravanan KR 2017-12-01 17:49:49 +05:30
parent d8a488baf2
commit 361785f14d
2 changed files with 34 additions and 4 deletions

View File

@ -27,10 +27,20 @@
# (Optional) vhostuser socket dir, The directory where $vhostuser_socket_dir
# will be created with correct permissions, inorder to support vhostuser
# client mode.
#
# [*vhostuser_socket_group*]
# (Optional) Group name for vhostuser socket dir.
# Defaults to qemu
#
# [*vhostuser_socket_user*]
# (Optional) User name for vhostuser socket dir.
# Defaults to qemu
class tripleo::profile::base::neutron::ovs(
$step = Integer(hiera('step')),
$vhostuser_socket_dir = hiera('neutron::agents::ml2::ovs::vhostuser_socket_dir', undef)
$step = Integer(hiera('step')),
$vhostuser_socket_dir = hiera('neutron::agents::ml2::ovs::vhostuser_socket_dir', undef),
$vhostuser_socket_group = hiera('vhostuser_socket_group', 'qemu'),
$vhostuser_socket_user = hiera('vhostuser_socket_user', 'qemu'),
) {
include ::tripleo::profile::base::neutron
@ -38,8 +48,8 @@ class tripleo::profile::base::neutron::ovs(
if $vhostuser_socket_dir {
file { $vhostuser_socket_dir:
ensure => directory,
owner => 'qemu',
group => 'qemu',
owner => $vhostuser_socket_user,
group => $vhostuser_socket_group,
mode => '0775',
}
}

View File

@ -58,6 +58,26 @@ describe 'tripleo::profile::base::neutron::ovs' do
:mode => '0775',
) }
end
context 'with vhostuser_socketdir and its permissions configured' do
let :params do
{
:step => 5,
:vhostuser_socket_dir => '/var/lib/vhostuser_sockets',
:vhostuser_socket_group => 'hugetlbfs',
:vhostuser_socket_user => 'openvswitch'
}
end
it { is_expected.to contain_class('tripleo::profile::base::neutron') }
it { is_expected.to contain_class('neutron::agents::ml2::ovs') }
it { is_expected.to contain_file('/var/lib/vhostuser_sockets').with(
:ensure => 'directory',
:owner => 'openvswitch',
:group => 'hugetlbfs',
:mode => '0775',
) }
end
end
on_supported_os.each do |os, facts|