2013-10-25 13:54:09 +02:00
|
|
|
# vswitch: open-vswitch
|
2015-01-30 14:13:36 +01:00
|
|
|
# == Class: vswitch::ovs
|
|
|
|
#
|
|
|
|
# installs openvswitch
|
|
|
|
#
|
|
|
|
# === Parameters:
|
2013-10-25 13:54:09 +02:00
|
|
|
#
|
2015-04-17 12:18:44 +02:00
|
|
|
# [*package_ensure*]
|
|
|
|
# (Optional) State of the openvswitch package
|
|
|
|
# Defaults to 'present'.
|
|
|
|
#
|
2017-09-11 12:56:21 +03:00
|
|
|
# [*enable_hw_offload*]
|
|
|
|
# (optional) Configure OVS to use
|
|
|
|
# Hardware Offload. This feature is
|
|
|
|
# supported from ovs 2.8.0.
|
2021-03-10 23:37:31 +09:00
|
|
|
# Defaults to false.
|
2019-03-27 05:45:35 +05:30
|
|
|
#
|
|
|
|
# [*disable_emc*]
|
|
|
|
# (optional) Configure OVS to disable EMC.
|
2021-03-10 23:37:31 +09:00
|
|
|
# Defaults to false.
|
|
|
|
#
|
|
|
|
# [*vlan_limit*]
|
|
|
|
# (optional) Number of vlan layers allowed.
|
2021-12-28 13:25:48 +09:00
|
|
|
# Default to undef
|
2021-03-10 23:37:31 +09:00
|
|
|
#
|
2021-03-12 15:50:50 +09:00
|
|
|
# [*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.
|
|
|
|
#
|
2022-02-27 22:43:47 +09:00
|
|
|
# DEPRECATED PARAMETERS
|
|
|
|
#
|
|
|
|
# [*dkms_ensure*]
|
|
|
|
# (optional) on debian/wheezy, ubuntu/precise, ubuntu/trusty and
|
|
|
|
# ubuntu/utopic dkms (Dynamic Kernel Module Support) is used to
|
|
|
|
# have a kernel module which matches the running kernel.
|
|
|
|
# In newer distributions (which ship with a newer kernel) dkms
|
|
|
|
# is not available anymore for openvswitch.
|
|
|
|
# For RedHat this parameter is ignored.
|
|
|
|
# If you like turn off dkms on Debian/Ubuntu set to false.
|
|
|
|
# defaults to undef.
|
|
|
|
#
|
2012-10-12 10:24:23 -07:00
|
|
|
class vswitch::ovs(
|
2017-09-11 12:56:21 +03:00
|
|
|
$package_ensure = 'present',
|
|
|
|
$enable_hw_offload = false,
|
2019-03-27 05:45:35 +05:30
|
|
|
$disable_emc = false,
|
2021-12-28 13:25:48 +09:00
|
|
|
$vlan_limit = undef,
|
2021-03-12 15:50:50 +09:00
|
|
|
$vs_config = {},
|
2022-02-27 22:43:47 +09:00
|
|
|
$dkms_ensure = undef,
|
2012-10-12 10:24:23 -07:00
|
|
|
) {
|
2013-04-19 15:05:38 -07:00
|
|
|
|
2019-12-08 23:25:14 +01:00
|
|
|
include vswitch::params
|
2021-03-12 15:50:50 +09:00
|
|
|
validate_legacy(Hash, 'validate_hash', $vs_config)
|
2013-04-19 15:05:38 -07:00
|
|
|
|
2022-02-27 22:43:47 +09:00
|
|
|
if $dkms_ensure {
|
|
|
|
warning('The dkms_ensure parameter is deprecated and has no effect')
|
2012-10-06 22:12:33 +02:00
|
|
|
}
|
2012-10-06 21:54:24 +00:00
|
|
|
|
2017-09-11 12:56:21 +03:00
|
|
|
if $enable_hw_offload {
|
|
|
|
vs_config { 'other_config:hw-offload':
|
2022-01-03 12:22:39 +09:00
|
|
|
value => true,
|
2021-10-14 17:28:41 +09:00
|
|
|
restart => true,
|
|
|
|
wait => true,
|
2017-09-11 12:56:21 +03:00
|
|
|
}
|
2021-12-28 13:31:43 +09:00
|
|
|
} else {
|
|
|
|
vs_config { 'other_config:hw-offload':
|
|
|
|
ensure => absent,
|
|
|
|
restart => true,
|
|
|
|
wait => true,
|
|
|
|
}
|
2017-09-11 12:56:21 +03:00
|
|
|
}
|
2019-01-09 16:32:09 +00:00
|
|
|
# lint:endignore
|
2017-09-11 12:56:21 +03:00
|
|
|
|
2019-03-27 05:45:35 +05:30
|
|
|
if $disable_emc {
|
|
|
|
vs_config { 'other_config:emc-insert-inv-prob':
|
2022-01-03 12:22:39 +09:00
|
|
|
value => 0,
|
2021-03-12 15:59:37 +09:00
|
|
|
wait => false,
|
2019-03-27 05:45:35 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-28 13:25:48 +09:00
|
|
|
if is_service_default($vlan_limit) {
|
|
|
|
warning('Usage of $::os_service_default for vlan_limit is deprecated. Use undef instead')
|
|
|
|
vs_config { 'other_config:vlan-limit':
|
|
|
|
ensure => absent,
|
|
|
|
wait => true,
|
|
|
|
}
|
|
|
|
} else {
|
2021-03-10 23:37:31 +09:00
|
|
|
vs_config { 'other_config:vlan-limit':
|
2022-01-03 12:22:39 +09:00
|
|
|
value => $vlan_limit,
|
2021-03-10 23:37:31 +09:00
|
|
|
wait => true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-12 15:50:50 +09:00
|
|
|
create_resources('vs_config', $vs_config)
|
|
|
|
|
2016-05-29 13:52:49 +02:00
|
|
|
service { 'openvswitch':
|
|
|
|
ensure => true,
|
|
|
|
enable => true,
|
|
|
|
name => $::vswitch::params::ovs_service_name,
|
|
|
|
status => $::vswitch::params::ovs_status,
|
|
|
|
hasstatus => $::vswitch::params::ovs_service_hasstatus
|
|
|
|
}
|
|
|
|
|
|
|
|
if $::vswitch::params::ovsdb_service_name {
|
|
|
|
service { 'ovsdb-server':
|
|
|
|
ensure => true,
|
|
|
|
enable => true,
|
|
|
|
name => $::vswitch::params::ovsdb_service_name,
|
|
|
|
status => $::vswitch::params::ovsdb_status,
|
|
|
|
}
|
|
|
|
|
|
|
|
Service['ovsdb-server'] ~> Service['openvswitch']
|
|
|
|
}
|
|
|
|
|
2021-10-14 17:28:41 +09:00
|
|
|
# NOTE(tkajinam): This resource is defined to restart the openvswitch service
|
|
|
|
# when any vs_config resource with restart => true is enabled.
|
|
|
|
exec { 'restart openvswitch':
|
|
|
|
path => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
|
|
|
|
command => "systemctl -q restart ${::vswitch::params::ovs_service_name}.service",
|
|
|
|
refreshonly => true,
|
|
|
|
}
|
|
|
|
|
2013-04-19 15:19:31 -07:00
|
|
|
package { $::vswitch::params::ovs_package_name:
|
2015-04-17 11:54:35 +02:00
|
|
|
ensure => $package_ensure,
|
|
|
|
before => Service['openvswitch'],
|
2016-07-11 18:29:30 +05:30
|
|
|
tag => 'openvswitch',
|
2012-10-06 21:54:24 +00:00
|
|
|
}
|
2013-01-15 01:41:01 -08:00
|
|
|
|
2013-04-19 14:32:56 -07:00
|
|
|
Service['openvswitch'] -> Vs_port<||>
|
|
|
|
Service['openvswitch'] -> Vs_bridge<||>
|
2021-08-23 13:43:01 +09:00
|
|
|
Service['openvswitch'] -> Vs_config<||>
|
2012-10-06 22:12:33 +02:00
|
|
|
}
|