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
This commit is contained in:
Takashi Kajinami 2021-03-12 15:50:50 +09:00
parent 0d026451bd
commit 71d591a753
3 changed files with 31 additions and 1 deletions

View File

@ -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)
}

View File

@ -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,

View File

@ -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``