Allow ovn_db_host to be of type array

On an OVN clustered database environment, there is no OVN VIP as all
OVN databases are active. Neutron has to be configured to point to all
OVN database servers in the cluster.

Co-Authored-By: Michele Baldessari <michele@acksyn.org>
Change-Id: Ib8624f0c2e87de18a990060c3cb939c13ec3a6f2
This commit is contained in:
Carlos Goncalves 2021-03-01 21:43:47 +01:00
parent 758f2e49b0
commit 0b51d8258c
3 changed files with 31 additions and 7 deletions

View File

@ -17,7 +17,9 @@
# OVN Neutron agent profile for tripleo
#
# [*ovn_db_host*]
# (Optional) The IP-Address where OVN DBs are listening.
# (Optional) The IP-Address where OVN DBs are listening. If passed a list it
# will construct a comma separated string like
# protocol:ip1:port,protocol:ip2:port.
# Defaults to hiera('ovn_dbs_vip')
#
# [*ovn_sbdb_port*]
@ -51,8 +53,14 @@ class tripleo::profile::base::neutron::agents::ovn (
$ovn_chassis_mac_map = hiera('ovn_chassis_mac_map', undef),
) {
if $step >= 4 {
if is_string($ovn_db_host) {
$ovn_remote_real = join(["${protocol}", normalize_ip_for_uri($ovn_db_host), "${ovn_sbdb_port}"], ':')
} elsif is_array($ovn_db_host) {
$ovn_remote_real = join($ovn_db_host.map |$i| { "${protocol}:${normalize_ip_for_uri($i)}:${ovn_sbdb_port}" }, ',')
}
class { 'ovn::controller':
ovn_remote => join([$protocol, normalize_ip_for_uri($ovn_db_host), "${ovn_sbdb_port}"], ':'),
ovn_remote => $ovn_remote_real,
enable_ovn_match_northd => true,
ovn_chassis_mac_map => $ovn_chassis_mac_map,
}

View File

@ -19,7 +19,8 @@
# === Parameters
#
# [*ovn_db_host*]
# The IP-Address where OVN DBs are listening.
# The IP-Address where OVN DBs are listening. If passed a list it will construct
# a comma separated string like protocol:ip1:port,protocol:ip2:port.
# Defaults to hiera('ovn_dbs_vip')
#
# [*ovn_sb_port*]
@ -65,8 +66,15 @@ class tripleo::profile::base::neutron::ovn_metadata (
) {
if $step >= 4 {
include tripleo::profile::base::neutron
if is_string($ovn_db_host) {
$ovn_sb_connection_real = join(["${protocol}", normalize_ip_for_uri($ovn_db_host), "${ovn_sb_port}"], ':')
} elsif is_array($ovn_db_host) {
$ovn_sb_connection_real = join($ovn_db_host.map |$i| { "${protocol}:${normalize_ip_for_uri($i)}:${ovn_sb_port}" }, ',')
}
class { 'neutron::agents::ovn_metadata':
ovn_sb_connection => join(["${protocol}", normalize_ip_for_uri($ovn_db_host), "${ovn_sb_port}"], ':'),
ovn_sb_connection => $ovn_sb_connection_real,
ovn_sb_private_key => $ovn_sb_private_key,
ovn_sb_certificate => $ovn_sb_certificate,
ovn_sb_ca_cert => $ovn_sb_ca_cert,

View File

@ -17,7 +17,8 @@
# OVN Neutron ML2 profile for tripleo
#
# [*ovn_db_host*]
# The IP-Address where OVN DBs are listening.
# The IP-Address where OVN DBs are listening. If passed a list it will construct
# a comma separated string like protocol:ip1:port,protocol:ip2:port.
# Defaults to hiera('ovn_dbs_vip')
#
# [*ovn_nb_port*]
@ -79,9 +80,16 @@ class tripleo::profile::base::neutron::plugins::ml2::ovn (
$step = Integer(hiera('step'))
) {
if $step >= 4 {
if is_string($ovn_db_host) {
$ovn_nb_connection_real = join(["${protocol}", normalize_ip_for_uri($ovn_db_host), "${ovn_nb_port}"], ':')
$ovn_sb_connection_real = join(["${protocol}", normalize_ip_for_uri($ovn_db_host), "${ovn_sb_port}"], ':')
} elsif is_array($ovn_db_host) {
$ovn_nb_connection_real = join($ovn_db_host.map |$i| { "${protocol}:${normalize_ip_for_uri($i)}:${ovn_nb_port}" }, ',')
$ovn_sb_connection_real = join($ovn_db_host.map |$i| { "${protocol}:${normalize_ip_for_uri($i)}:${ovn_sb_port}" }, ',')
}
class { 'neutron::plugins::ml2::ovn':
ovn_nb_connection => join(["${protocol}", normalize_ip_for_uri($ovn_db_host), "${ovn_nb_port}"], ':'),
ovn_sb_connection => join(["${protocol}", normalize_ip_for_uri($ovn_db_host), "${ovn_sb_port}"], ':'),
ovn_nb_connection => $ovn_nb_connection_real,
ovn_sb_connection => $ovn_sb_connection_real,
ovn_nb_private_key => $ovn_nb_private_key,
ovn_nb_certificate => $ovn_nb_certificate,
ovn_nb_ca_cert => $ovn_nb_ca_cert,