Merge "replace validate_legacy with proper data types"
This commit is contained in:
commit
3c73d5f942
@ -97,45 +97,28 @@
|
||||
# Defaults to false.
|
||||
#
|
||||
class vswitch::dpdk (
|
||||
$memory_channels = undef,
|
||||
$host_core_list = undef,
|
||||
$package_ensure = 'present',
|
||||
$pmd_core_list = undef,
|
||||
$socket_mem = undef,
|
||||
$socket_limit = undef,
|
||||
$enable_hw_offload = false,
|
||||
$disable_emc = false,
|
||||
$vlan_limit = undef,
|
||||
$revalidator_cores = undef,
|
||||
$handler_cores = undef,
|
||||
$enable_tso = false,
|
||||
$vhost_postcopy_support = false,
|
||||
$pmd_auto_lb = false,
|
||||
$pmd_auto_lb_rebal_interval = undef,
|
||||
$pmd_auto_lb_load_threshold = undef,
|
||||
$pmd_auto_lb_improvement_threshold = undef,
|
||||
$vs_config = {},
|
||||
$skip_restart = false,
|
||||
Optional[Variant[Integer[0], String]] $memory_channels = undef,
|
||||
Optional[String] $host_core_list = undef,
|
||||
String $package_ensure = 'present',
|
||||
Optional[String] $pmd_core_list = undef,
|
||||
Optional[Variant[String, Integer, Array[String], Array[Integer]]] $socket_mem = undef,
|
||||
Optional[Variant[String, Integer, Array[String], Array[Integer]]] $socket_limit = undef,
|
||||
Boolean $enable_hw_offload = false,
|
||||
Boolean $disable_emc = false,
|
||||
Optional[Integer[0]] $vlan_limit = undef,
|
||||
Optional[Integer[0]] $revalidator_cores = undef,
|
||||
Optional[Integer[0]] $handler_cores = undef,
|
||||
Boolean $enable_tso = false,
|
||||
Boolean $vhost_postcopy_support = false,
|
||||
Boolean $pmd_auto_lb = false,
|
||||
Optional[Integer[0]] $pmd_auto_lb_rebal_interval = undef,
|
||||
Optional[Integer[0]] $pmd_auto_lb_load_threshold = undef,
|
||||
Optional[Integer[0]] $pmd_auto_lb_improvement_threshold = undef,
|
||||
Hash $vs_config = {},
|
||||
Boolean $skip_restart = false,
|
||||
) {
|
||||
|
||||
include vswitch::params
|
||||
validate_legacy(Boolean, 'validate_bool', $enable_hw_offload)
|
||||
validate_legacy(Boolean, 'validate_bool', $disable_emc)
|
||||
validate_legacy(Boolean, 'validate_bool', $enable_tso)
|
||||
validate_legacy(Boolean, 'validate_bool', $vhost_postcopy_support)
|
||||
validate_legacy(Boolean, 'validate_bool', $pmd_auto_lb)
|
||||
validate_legacy(Hash, 'validate_hash', $vs_config)
|
||||
validate_legacy(Boolean, 'validate_bool', $skip_restart)
|
||||
|
||||
if $vlan_limit != undef {
|
||||
validate_legacy(Integer, 'validate_integer', $vlan_limit)
|
||||
}
|
||||
if $revalidator_cores != undef {
|
||||
validate_legacy(Integer, 'validate_integer', $revalidator_cores)
|
||||
}
|
||||
if $handler_cores != undef {
|
||||
validate_legacy(Integer, 'validate_integer', $handler_cores)
|
||||
}
|
||||
|
||||
$restart = !$skip_restart
|
||||
|
||||
@ -153,11 +136,17 @@ class vswitch::dpdk (
|
||||
|
||||
$pmd_core_mask = range_to_mask($pmd_core_list)
|
||||
$dpdk_lcore_mask = range_to_mask($host_core_list)
|
||||
if $memory_channels and !empty($memory_channels) {
|
||||
$memory_channels_conf = "-n ${memory_channels}"
|
||||
|
||||
if $memory_channels =~ String {
|
||||
warning('Support for string by memory_channels is deprecated. Use integer instead')
|
||||
}
|
||||
else {
|
||||
$memory_channels_conf = undef
|
||||
$memory_channels_conf = $memory_channels ? {
|
||||
String => empty($memory_channels) ? {
|
||||
true => undef,
|
||||
default => "-n ${memory_channels}",
|
||||
},
|
||||
Integer => "-n ${memory_channels}",
|
||||
default => undef,
|
||||
}
|
||||
|
||||
$dpdk_configs = {
|
||||
|
@ -25,7 +25,7 @@
|
||||
# Apache License 2.0 (see LICENSE file)
|
||||
#
|
||||
class vswitch (
|
||||
$provider = $vswitch::params::provider
|
||||
Enum['ovs', 'dpdk'] $provider = $vswitch::params::provider
|
||||
) {
|
||||
$cls = "::vswitch::${provider}"
|
||||
include $cls
|
||||
|
@ -37,23 +37,15 @@
|
||||
# Defaults to false.
|
||||
#
|
||||
class vswitch::ovs(
|
||||
$package_ensure = 'present',
|
||||
$enable_hw_offload = false,
|
||||
$disable_emc = false,
|
||||
$vlan_limit = undef,
|
||||
$vs_config = {},
|
||||
$skip_restart = false,
|
||||
String $package_ensure = 'present',
|
||||
Boolean $enable_hw_offload = false,
|
||||
Boolean $disable_emc = false,
|
||||
Optional[Integer[0]] $vlan_limit = undef,
|
||||
Hash $vs_config = {},
|
||||
Boolean $skip_restart = false,
|
||||
) {
|
||||
|
||||
include vswitch::params
|
||||
validate_legacy(Boolean, 'validate_bool', $enable_hw_offload)
|
||||
validate_legacy(Boolean, 'validate_bool', $disable_emc)
|
||||
validate_legacy(Hash, 'validate_hash', $vs_config)
|
||||
validate_legacy(Boolean, 'validate_bool', $skip_restart)
|
||||
|
||||
if $vlan_limit != undef {
|
||||
validate_legacy(Integer, 'validate_integer', $vlan_limit)
|
||||
}
|
||||
|
||||
$restart = !$skip_restart
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
# Defaults to '/etc/openvswitch'
|
||||
#
|
||||
define vswitch::pki::cert(
|
||||
$cert_dir = '/etc/openvswitch',
|
||||
Stdlib::Absolutepath $cert_dir = '/etc/openvswitch',
|
||||
) {
|
||||
include vswitch::params
|
||||
|
||||
|
10
releasenotes/notes/parameter-types-7755578432ebad07.yaml
Normal file
10
releasenotes/notes/parameter-types-7755578432ebad07.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Now this module implements strict data type validations.
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
The ``vswitch::dpdk::memory_channels`` parameter now supports string and
|
||||
integer but string support has been deprecated. Use an integer value
|
||||
instead.
|
Loading…
Reference in New Issue
Block a user