Allow skipping restarting ovs daemons

When ovs daemon is restarted, network traffic through ovs interfaces
are interrupted until the daemon is started and the required flows are
re-installed. This is not desirable in some live-systems carrying
heavy network traffic.

This introduces the flag to avoid restarting the service by puppet, so
that operators can restart the ovs daemon manually during the proper
maintenance window.

Change-Id: I64a71ce3a0107cf4c38164660c6abc70895be0f4
This commit is contained in:
Takashi Kajinami 2023-01-18 14:28:16 +09:00
parent e0d86a8f57
commit da7df46bdf
3 changed files with 39 additions and 12 deletions

View File

@ -90,6 +90,12 @@
# NOTE: that the configuration MUST NOT be already handled by this module
# or Puppet catalog compilation will fail with duplicate resources.
#
# [*skip_restart*]
# (optional) Skip restarting the service even when updating some options
# which require service restart. Setting this parameter to true avoids
# immedicate network distuption caused by restarting the ovs daemon.
# Defaults to false.
#
class vswitch::dpdk (
$memory_channels = undef,
$host_core_list = undef,
@ -109,6 +115,7 @@ class vswitch::dpdk (
$pmd_auto_lb_load_threshold = undef,
$pmd_auto_lb_improvement_threshold = undef,
$vs_config = {},
$skip_restart = false,
) {
include vswitch::params
@ -118,6 +125,9 @@ class vswitch::dpdk (
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)
$restart = !$skip_restart
kmod::load { 'vfio-pci': }
@ -141,11 +151,11 @@ class vswitch::dpdk (
}
$dpdk_configs = {
'other_config:dpdk-extra' => { value => $memory_channels_conf, restart => true },
'other_config:dpdk-socket-mem' => { value => join(any2array($socket_mem), ','), restart => true},
'other_config:dpdk-socket-limit' => { value => join(any2array($socket_limit), ','), restart => true},
'other_config:dpdk-lcore-mask' => { value => $dpdk_lcore_mask, restart => true},
'other_config:pmd-cpu-mask' => { value => $pmd_core_mask, restart => true},
'other_config:dpdk-extra' => { value => $memory_channels_conf, restart => $restart },
'other_config:dpdk-socket-mem' => { value => join(any2array($socket_mem), ','), restart => $restart},
'other_config:dpdk-socket-limit' => { value => join(any2array($socket_limit), ','), restart => $restart},
'other_config:dpdk-lcore-mask' => { value => $dpdk_lcore_mask, restart => $restart},
'other_config:pmd-cpu-mask' => { value => $pmd_core_mask, restart => $restart},
'other_config:n-revalidator-threads' => { value => $revalidator_cores},
'other_config:n-handler-threads' => { value => $handler_cores},
}
@ -158,13 +168,13 @@ class vswitch::dpdk (
if $enable_hw_offload {
vs_config { 'other_config:hw-offload':
value => true,
restart => true,
restart => $restart,
wait => true,
}
} else {
vs_config { 'other_config:hw-offload':
ensure => absent,
restart => true,
restart => $restart,
wait => true,
}
}
@ -201,13 +211,13 @@ class vswitch::dpdk (
if $vhost_postcopy_support {
vs_config { 'other_config:vhost-postcopy-support':
value => true,
restart => true,
restart => $restart,
wait => false
}
} else {
vs_config { 'other_config:vhost-postcopy-support':
ensure => absent,
restart => true,
restart => $restart,
wait => false
}
}
@ -265,7 +275,7 @@ class vswitch::dpdk (
vs_config { 'other_config:dpdk-init':
value => true,
restart => true,
restart => $restart,
wait => true,
}

View File

@ -30,29 +30,39 @@
# NOTE: that the configuration MUST NOT be already handled by this module
# or Puppet catalog compilation will fail with duplicate resources.
#
# [*skip_restart*]
# (optional) Skip restarting the service even when updating some options
# which require service restart. Setting this parameter to true avoids
# immedicate network distuption caused by restarting the ovs daemon.
# Defaults to false.
#
class vswitch::ovs(
$package_ensure = 'present',
$enable_hw_offload = false,
$disable_emc = false,
$vlan_limit = undef,
$vs_config = {},
$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)
$restart = !$skip_restart
if $enable_hw_offload {
vs_config { 'other_config:hw-offload':
value => true,
restart => true,
restart => $restart,
wait => true,
}
} else {
vs_config { 'other_config:hw-offload':
ensure => absent,
restart => true,
restart => $restart,
wait => true,
}
}

View File

@ -0,0 +1,7 @@
---
features:
- |
The new ``skip_restart`` parameter has been added. When this parmeter is
set to ``false``, the ovs daemon is not restarted when some options which
requires service restart are updated. This avoids immediate network
disruption caused by restarting the ovs daemon.