From 361785f14d9965b0f81706dfbe3a01550a110b1a Mon Sep 17 00:00:00 2001 From: Saravanan KR Date: Fri, 1 Dec 2017 17:49:49 +0530 Subject: [PATCH] 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 --- manifests/profile/base/neutron/ovs.pp | 18 +++++++++++++---- .../tripleo_profile_base_neutron_ovs_spec.rb | 20 +++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/manifests/profile/base/neutron/ovs.pp b/manifests/profile/base/neutron/ovs.pp index 8794d744d..6b4a76fea 100644 --- a/manifests/profile/base/neutron/ovs.pp +++ b/manifests/profile/base/neutron/ovs.pp @@ -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', } } diff --git a/spec/classes/tripleo_profile_base_neutron_ovs_spec.rb b/spec/classes/tripleo_profile_base_neutron_ovs_spec.rb index 14de7e1d2..b7883b75d 100644 --- a/spec/classes/tripleo_profile_base_neutron_ovs_spec.rb +++ b/spec/classes/tripleo_profile_base_neutron_ovs_spec.rb @@ -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|