Merge "Add support for clustered DB"

This commit is contained in:
Zuul 2022-12-01 17:31:56 +00:00 committed by Gerrit Code Review
commit 6b668e57de
3 changed files with 64 additions and 7 deletions

View File

@ -15,10 +15,20 @@
# The IP-Address where OVN Clustered DBs sync from
# Defaults to undef
#
# [*ovn_northd_nb_db*]
# NB DB address(es)
# Defaults to undef
#
# [*ovn_northd_sb_db*]
# SB DB address(es)
# Defaults to undef
#
class ovn::northd(
$dbs_listen_ip = '0.0.0.0',
$dbs_cluster_local_addr = undef,
$dbs_cluster_remote_addr = undef,
$ovn_northd_nb_db = undef,
$ovn_northd_sb_db = undef,
) {
include ovn::params
include vswitch::ovs
@ -48,9 +58,25 @@ class ovn::northd(
$ovn_northd_opts_cluster_remote_addr = []
}
$ovn_northd_nb_db_opts = $ovn_northd_nb_db ? {
String => ["--ovn-northd-nb-db=${ovn_northd_nb_db}"],
Array[String] => ["--ovn-northd-nb-db=${join($ovn_northd_nb_db, ',')}"],
undef => [],
default => fail('ovn_northd_nb_db_opts must be of type String or Array[String]'),
}
$ovn_northd_sb_db_opts = $ovn_northd_sb_db ? {
String => ["--ovn-northd-sb-db=${ovn_northd_sb_db}"],
Array[String] => ["--ovn-northd-sb-db=${join($ovn_northd_sb_db, ',')}"],
undef => [],
default => fail('ovn_northd_sb_db_opts must be of type String or Array[String]'),
}
$ovn_northd_opts = join($ovn_northd_opts_addr +
$ovn_northd_opts_cluster_local_addr +
$ovn_northd_opts_cluster_remote_addr,
$ovn_northd_opts_cluster_remote_addr +
$ovn_northd_nb_db_opts +
$ovn_northd_sb_db_opts,
' ')
augeas { 'config-ovn-northd':

View File

@ -0,0 +1,6 @@
---
features:
- |
The ``ovn::northd`` class now supports the clustered OVN DB. Set
the ``ovn_northd_nb_db`` parameter and the ``ovn_southd_nb_db``
parameter.

View File

@ -3,13 +3,38 @@ require 'spec_helper'
describe 'ovn::northd' do
shared_examples_for 'systemd env' do
it 'creates systemd conf' do
is_expected.to contain_augeas('config-ovn-northd').with({
:context => platform_params[:ovn_northd_context],
:changes => "set " + platform_params[:ovn_northd_option_name] +
" '\"--db-nb-addr=0.0.0.0 --db-sb-addr=0.0.0.0 --db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=yes\"'",
})
context 'with default parameters' do
let :params do
{}
end
it 'creates systemd conf' do
is_expected.to contain_augeas('config-ovn-northd').with({
:context => platform_params[:ovn_northd_context],
:changes => "set " + platform_params[:ovn_northd_option_name] +
" '\"--db-nb-addr=0.0.0.0 --db-sb-addr=0.0.0.0 --db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=yes\"'",
})
end
end
context 'with parameters' do
let :params do
{
:ovn_northd_nb_db => 'tcp:192.0.2.1:6645,tcp:192.0.2.2:6645,tcp:192.0.2.3:6645',
:ovn_northd_sb_db => ['tcp:192.0.2.1:6646', 'tcp:192.0.2.2:6646', 'tcp:192.0.2.3:6646'],
}
end
it 'creates systemd conf' do
is_expected.to contain_augeas('config-ovn-northd').with({
:context => platform_params[:ovn_northd_context],
:changes => "set " + platform_params[:ovn_northd_option_name] + " '\"" +
"--db-nb-addr=0.0.0.0 --db-sb-addr=0.0.0.0 --db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=yes" +
" --ovn-northd-nb-db=tcp:192.0.2.1:6645,tcp:192.0.2.2:6645,tcp:192.0.2.3:6645 --ovn-northd-sb-db=tcp:192.0.2.1:6646,tcp:192.0.2.2:6646,tcp:192.0.2.3:6646" +
"\"'",
})
end
end
end
shared_examples_for 'ovn northd' do