northd: Escape IPv6 address

Current ovn-ctl uses raw address to build --remote option, and fails to
start ovn db if address is a non-escapted IPv6 address.

This ensures IPv6 address is escaped before being passed to the address
options.

Change-Id: Iab3f68cbb3793dc7b51d6a3ab870130032112d87
This commit is contained in:
Takashi Kajinami 2023-02-27 17:49:56 +09:00
parent a7e4636109
commit 9f91e4b106
2 changed files with 19 additions and 2 deletions

View File

@ -53,9 +53,11 @@ class ovn::northd(
include ovn::params
include vswitch::ovs
$dbs_listen_ip_real = normalize_ip_for_uri($dbs_listen_ip)
$ovn_northd_opts_addr = [
"--db-nb-addr=${dbs_listen_ip}",
"--db-sb-addr=${dbs_listen_ip}",
"--db-nb-addr=${dbs_listen_ip_real}",
"--db-sb-addr=${dbs_listen_ip_real}",
'--db-nb-create-insecure-remote=yes',
'--db-sb-create-insecure-remote=yes'
]

View File

@ -16,6 +16,21 @@ describe 'ovn::northd' do
end
end
context 'with ipv6' do
let :params do
{
:dbs_listen_ip => '::1'
}
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=[::1] --db-sb-addr=[::1] --db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=yes\"'",
})
end
end
context 'with parameters' do
let :params do
{