From 71d591a753403152c480f8460db3f44271884410 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 12 Mar 2021 15:50:50 +0900 Subject: [PATCH] Support arbitary vsiwtch configurations This change introduces support for arbitary configurations as is done in the other modules by nova::config, cinder::config and etc. This allows users to set any parameter which is not yet supported directly by puppet-vswitch. Change-Id: Ica77dc2061bc34aaaadeac9b763bebacc1d32f88 --- manifests/dpdk.pp | 13 ++++++++++++- manifests/ovs.pp | 11 +++++++++++ ...ary-vsiwtch-configurations-d80f49955009552f.yaml | 8 ++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/arbitary-vsiwtch-configurations-d80f49955009552f.yaml diff --git a/manifests/dpdk.pp b/manifests/dpdk.pp index 55818a12..13a195c6 100644 --- a/manifests/dpdk.pp +++ b/manifests/dpdk.pp @@ -49,6 +49,13 @@ # [*handler_cores*] # (Optional) Number of cores to be used for OVS handler threads. # +# [*vs_config*] +# (optional) allow configuration of arbitary vsiwtch configurations. +# The value is an hash of vs_config resources. Example: +# { 'other_config:foo' => { value => 'baa' } } +# NOTE: that the configuration MUST NOT be already handled by this module +# or Puppet catalog compilation will fail with duplicate resources. +# # DEPRECATED PARAMETERS # # [*driver_type*] @@ -67,11 +74,13 @@ class vswitch::dpdk ( $vlan_limit = $::os_service_default, $revalidator_cores = undef, $handler_cores = undef, + $vs_config = {}, # DEPRECATED PARAMETERS $driver_type = 'vfio-pci', ) { include vswitch::params + validate_legacy(Hash, 'validate_hash', $vs_config) kmod::load { 'vfio-pci': } if $::osfamily != 'Redhat' { @@ -147,5 +156,7 @@ class vswitch::dpdk ( name => $::vswitch::params::ovs_service_name, } - create_resources ('vs_config', $dpdk_configs, $dpdk_dependencies) + create_resources('vs_config', $dpdk_configs, $dpdk_dependencies) + create_resources('vs_config', $vs_config) + } diff --git a/manifests/ovs.pp b/manifests/ovs.pp index c5f89936..738ec9fa 100644 --- a/manifests/ovs.pp +++ b/manifests/ovs.pp @@ -33,15 +33,24 @@ # (optional) Number of vlan layers allowed. # Default to $::os_service_default # +# [*vs_config*] +# (optional) allow configuration of arbitary vsiwtch configurations. +# The value is an hash of vs_config resources. Example: +# { 'other_config:foo' => { value => 'baa' } } +# NOTE: that the configuration MUST NOT be already handled by this module +# or Puppet catalog compilation will fail with duplicate resources. +# class vswitch::ovs( $package_ensure = 'present', $dkms_ensure = false, $enable_hw_offload = false, $disable_emc = false, $vlan_limit = $::os_service_default, + $vs_config = {}, ) { include vswitch::params + validate_legacy(Hash, 'validate_hash', $vs_config) case $::osfamily { 'Debian': { @@ -109,6 +118,8 @@ class vswitch::ovs( } } + create_resources('vs_config', $vs_config) + service { 'openvswitch': ensure => true, enable => true, diff --git a/releasenotes/notes/arbitary-vsiwtch-configurations-d80f49955009552f.yaml b/releasenotes/notes/arbitary-vsiwtch-configurations-d80f49955009552f.yaml new file mode 100644 index 00000000..b2a8f561 --- /dev/null +++ b/releasenotes/notes/arbitary-vsiwtch-configurations-d80f49955009552f.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + The following two parameters have been added. These two parameters support + arbitary vswitch configurations using hashes. + + - ``vswitch::ovs::vs_config`` + - ``vswitch::dpdk::vs_config``