Add support to set ovs_nb_connection

When using ovn provider unless set, it would try to
connect to 127.0.0.1.

Change-Id: If8eb685dd21791b65845afd44fb483592b8bcc0c
Depends-On: https://review.openstack.org/653673
Closes-Bug: #1825146
This commit is contained in:
Rabi Mishra 2019-04-18 09:25:47 +05:30
parent 2a1167dd7b
commit d88db3ad71
3 changed files with 24 additions and 5 deletions

View File

@ -52,6 +52,14 @@
# (Optional) The neutron driver for ml2 currently default tripleo value is ovn. # (Optional) The neutron driver for ml2 currently default tripleo value is ovn.
# Defaults to hiera('neutron::plugins::ml2::mechanism_drivers') # Defaults to hiera('neutron::plugins::ml2::mechanism_drivers')
# #
# [*ovn_db_host*]
# (Optional) The IP-Address where OVN DBs are listening.
# Defaults to hiera('ovn_dbs_vip')
#
# [*ovn_nb_port*]
# (Optional) Port number on which northbound database is listening
# Defaults to hiera('ovn::northbound::port')
#
class tripleo::profile::base::octavia::api ( class tripleo::profile::base::octavia::api (
$bootstrap_node = hiera('octavia_api_short_bootstrap_node_name', undef), $bootstrap_node = hiera('octavia_api_short_bootstrap_node_name', undef),
$certificates_specs = hiera('apache_certificates_specs', {}), $certificates_specs = hiera('apache_certificates_specs', {}),
@ -59,6 +67,8 @@ class tripleo::profile::base::octavia::api (
$octavia_network = hiera('octavia_api_network', undef), $octavia_network = hiera('octavia_api_network', undef),
$step = Integer(hiera('step')), $step = Integer(hiera('step')),
$neutron_driver = hiera('neutron::plugins::ml2::mechanism_drivers', []), $neutron_driver = hiera('neutron::plugins::ml2::mechanism_drivers', []),
$ovn_db_host = hiera('ovn_dbs_vip', undef),
$ovn_nb_port = hiera('ovn::northbound::port', undef),
) { ) {
if $::hostname == downcase($bootstrap_node) { if $::hostname == downcase($bootstrap_node) {
$sync_db = true $sync_db = true
@ -90,6 +100,7 @@ class tripleo::profile::base::octavia::api (
class { '::octavia::api': class { '::octavia::api':
sync_db => $sync_db, sync_db => $sync_db,
provider_drivers => 'amphora: Octavia Amphora Driver, ovn: Octavia OVN driver', provider_drivers => 'amphora: Octavia Amphora Driver, ovn: Octavia OVN driver',
ovn_nb_connection => join(['tcp', normalize_ip_for_uri($ovn_db_host), "${ovn_nb_port}"], ':'),
} }
} else { } else {
class { '::octavia::api': class { '::octavia::api':

View File

@ -0,0 +1,5 @@
---
features:
- Adds ovn_db_host and ovn_nb_port to configure ovn nb connection string
for OVN Provider driver.

View File

@ -110,12 +110,15 @@ eos
params.merge!({ params.merge!({
:step => 4, :step => 4,
:bootstrap_node => 'node.example.com', :bootstrap_node => 'node.example.com',
:neutron_driver => ['ovn'] :neutron_driver => ['ovn'],
:ovn_db_host => '127.0.0.1',
:ovn_nb_port => '6641'
}) })
end end
it 'should should set provider drivers' do it 'should should set provider drivers and ovn nb connection' do
is_expected.to contain_class('octavia::api').with(:provider_drivers => 'amphora: Octavia Amphora Driver, ovn: Octavia OVN driver') is_expected.to contain_class('octavia::api').with(:provider_drivers => 'amphora: Octavia Amphora Driver, ovn: Octavia OVN driver')
is_expected.to contain_class('octavia::api').with(:ovn_nb_connection => 'tcp:127.0.0.1:6641')
end end
end end