From d88db3ad716561e5526afc1a0cdb4de08e599741 Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Thu, 18 Apr 2019 09:25:47 +0530 Subject: [PATCH] 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 --- manifests/profile/base/octavia/api.pp | 15 +++++++++++++-- ...ctavia-ovn-nb-connection-9d5bc428c4ff35af.yaml | 5 +++++ .../tripleo_profile_base_octavia_api_spec.rb | 9 ++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/add-octavia-ovn-nb-connection-9d5bc428c4ff35af.yaml diff --git a/manifests/profile/base/octavia/api.pp b/manifests/profile/base/octavia/api.pp index 04f00e4dd..8f24ae5dd 100644 --- a/manifests/profile/base/octavia/api.pp +++ b/manifests/profile/base/octavia/api.pp @@ -52,6 +52,14 @@ # (Optional) The neutron driver for ml2 currently default tripleo value is ovn. # 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 ( $bootstrap_node = hiera('octavia_api_short_bootstrap_node_name', undef), $certificates_specs = hiera('apache_certificates_specs', {}), @@ -59,6 +67,8 @@ class tripleo::profile::base::octavia::api ( $octavia_network = hiera('octavia_api_network', undef), $step = Integer(hiera('step')), $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) { $sync_db = true @@ -88,8 +98,9 @@ class tripleo::profile::base::octavia::api ( include ::octavia::controller if 'ovn' in $neutron_driver { class { '::octavia::api': - sync_db => $sync_db, - provider_drivers => 'amphora: Octavia Amphora Driver, ovn: Octavia OVN driver', + sync_db => $sync_db, + 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 { class { '::octavia::api': diff --git a/releasenotes/notes/add-octavia-ovn-nb-connection-9d5bc428c4ff35af.yaml b/releasenotes/notes/add-octavia-ovn-nb-connection-9d5bc428c4ff35af.yaml new file mode 100644 index 000000000..e9e185f49 --- /dev/null +++ b/releasenotes/notes/add-octavia-ovn-nb-connection-9d5bc428c4ff35af.yaml @@ -0,0 +1,5 @@ +--- +features: + - Adds ovn_db_host and ovn_nb_port to configure ovn nb connection string + for OVN Provider driver. + diff --git a/spec/classes/tripleo_profile_base_octavia_api_spec.rb b/spec/classes/tripleo_profile_base_octavia_api_spec.rb index ec469bf04..fd82089bf 100644 --- a/spec/classes/tripleo_profile_base_octavia_api_spec.rb +++ b/spec/classes/tripleo_profile_base_octavia_api_spec.rb @@ -21,7 +21,7 @@ describe 'tripleo::profile::base::octavia::api' do let :params do { :step => 5, :bootstrap_node => 'notbootstrap.example.com' - } + } end shared_examples_for 'tripleo::profile::base::octavia::api' do @@ -110,12 +110,15 @@ eos params.merge!({ :step => 4, :bootstrap_node => 'node.example.com', - :neutron_driver => ['ovn'] + :neutron_driver => ['ovn'], + :ovn_db_host => '127.0.0.1', + :ovn_nb_port => '6641' }) 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(:ovn_nb_connection => 'tcp:127.0.0.1:6641') end end