Add support for clustered DB
For a cluster db, nb_db and sb_db should be set to the cluster addresses[1] instead of default local unix socket. [1] e.g. ssl:192.0.2.1:6645,ssl:192.0.2.2:6645,ssl:192.0.2.3:6645 Change-Id: I8f3a8ae0b7c3803726568cf4a1a132a874d00aa9
This commit is contained in:
parent
bd2256daea
commit
889de8b44d
@ -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':
|
||||
|
6
releasenotes/notes/ovn-clusterd-db-244b8d44eb2638d1.yaml
Normal file
6
releasenotes/notes/ovn-clusterd-db-244b8d44eb2638d1.yaml
Normal 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.
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user