Merge "[controller] Add the ability to configure transport zones"

This commit is contained in:
Zuul 2020-05-13 16:40:26 +00:00 committed by Gerrit Code Review
commit e092c183f9
2 changed files with 28 additions and 1 deletions

View File

@ -62,6 +62,10 @@
# If the value is nonzero, then it will be forced to a value of at least 5s.
# Defaults to 60
#
# [*ovn_transport_zones*]
# (optional) List of the transport zones to which the chassis belongs to.
# Defaults to empty list
#
class ovn::controller(
$ovn_remote,
$ovn_encap_ip,
@ -76,6 +80,7 @@ class ovn::controller(
$enable_dpdk = false,
$ovn_remote_probe_interval = 60000,
$ovn_openflow_probe_interval = 60,
$ovn_transport_zones = [],
) {
include ovn::params
@ -137,6 +142,14 @@ class ovn::controller(
$bridge_items = {}
}
if !empty($ovn_transport_zones) {
$tz_items = {
'external_ids:ovn-transport-zones' => { 'value' => join(any2array($ovn_transport_zones), ',') }
}
} else {
$tz_items = {}
}
if $enable_hw_offload {
$hw_offload = { 'other_config:hw-offload' => { 'value' => bool2str($enable_hw_offload) } }
}else {
@ -149,7 +162,7 @@ class ovn::controller(
$datapath_config = {}
}
create_resources('vs_config', merge($config_items, $bridge_items, $hw_offload, $datapath_config))
create_resources('vs_config', merge($config_items, $bridge_items, $tz_items, $hw_offload, $datapath_config))
Service['openvswitch'] -> Vs_config<||> -> Service['controller']
if !empty($ovn_bridge_mappings) {
@ -177,4 +190,12 @@ class ovn::controller(
require => Service['openvswitch']
}
}
if empty($ovn_transport_zones) {
# ovn-transport-zones is not defined. Clear the existing value if configured.
vs_config { 'external_ids:ovn-transport-zones':
ensure => absent,
require => Service['openvswitch']
}
}
}

View File

@ -14,6 +14,7 @@ describe 'ovn::controller' do
:mac_table_size => 20000,
:ovn_remote_probe_interval => 30000,
:ovn_openflow_probe_interval => 8,
:ovn_transport_zones => ['tz1'],
}
end
@ -72,6 +73,11 @@ describe 'ovn::controller' do
is_expected.to contain_vs_config('external_ids:ovn-openflow-probe-interval').with(
:value => params[:ovn_openflow_probe_interval],
)
is_expected.to contain_vs_config('external_ids:ovn-transport-zones').with(
:value => params[:ovn_transport_zones],
)
end
it 'configures bridge mappings' do