From 7d73246fe7229c7dd9bc79e9443eba00cf277785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= Date: Fri, 17 Apr 2020 16:46:09 +0200 Subject: [PATCH] OVN IPv6 Fixes: - SB/NB DB address format (single host) for SB/NB DB daemon - SB/NB DB address format (all hosts) for Neutron / northd / ovn-ovs bootstrap - OVN tests Change-Id: I539773c48f89b731d068280c228ce11782bf5788 Closes-Bug: #1875222 --- ansible/group_vars/all.yml | 4 ++-- ansible/roles/ovn/templates/ovn-nb-db.json.j2 | 2 +- ansible/roles/ovn/templates/ovn-sb-db.json.j2 | 2 +- tests/test-ovn.sh | 9 +++++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index aad8449000..45db661bbc 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -384,8 +384,8 @@ octavia_health_manager_port: "5555" ovn_nb_db_port: "6641" ovn_sb_db_port: "6642" -ovn_nb_connection: "{% for host in groups['ovn-nb-db'] %}tcp:{{ 'api' | kolla_address(host) }}:{{ ovn_nb_db_port }}{% if not loop.last %},{% endif %}{% endfor %}" -ovn_sb_connection: "{% for host in groups['ovn-sb-db'] %}tcp:{{ 'api' | kolla_address(host) }}:{{ ovn_sb_db_port }}{% if not loop.last %},{% endif %}{% endfor %}" +ovn_nb_connection: "{% for host in groups['ovn-nb-db'] %}tcp:{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ ovn_nb_db_port }}{% if not loop.last %},{% endif %}{% endfor %}" +ovn_sb_connection: "{% for host in groups['ovn-sb-db'] %}tcp:{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ ovn_sb_db_port }}{% if not loop.last %},{% endif %}{% endfor %}" outward_rabbitmq_port: "5674" outward_rabbitmq_management_port: "15674" diff --git a/ansible/roles/ovn/templates/ovn-nb-db.json.j2 b/ansible/roles/ovn/templates/ovn-nb-db.json.j2 index f634874119..b1d3b910ee 100644 --- a/ansible/roles/ovn/templates/ovn-nb-db.json.j2 +++ b/ansible/roles/ovn/templates/ovn-nb-db.json.j2 @@ -1,5 +1,5 @@ { - "command": "/usr/share/ovn/scripts/ovn-ctl run_nb_ovsdb --db-nb-create-insecure-remote=yes --db-nb-addr={{ api_interface_address }} --db-nb-cluster-local-addr={{ api_interface_address }} {% if groups['ovn-nb-db'] | length > 1 and inventory_hostname != groups['ovn-nb-db'][0] %} --db-nb-cluster-remote-addr={{ 'api' | kolla_address(groups['ovn-nb-db'][0]) }} {% endif %} --db-sock=/run/ovn/ovnnb_db.sock --db-nb-pid=/run/ovn/ovnnb_db.pid --db-nb-file=/var/lib/openvswitch/ovn-nb/ovnnb.db --ovn-nb-logfile=/var/log/kolla/openvswitch/ovn-nb-db.log", + "command": "/usr/share/ovn/scripts/ovn-ctl run_nb_ovsdb --db-nb-create-insecure-remote=yes --db-nb-addr={{ api_interface_address | put_address_in_context('url') }} --db-nb-cluster-local-addr={{ api_interface_address | put_address_in_context('url') }} {% if groups['ovn-nb-db'] | length > 1 and inventory_hostname != groups['ovn-nb-db'][0] %} --db-nb-cluster-remote-addr={{ 'api' | kolla_address(groups['ovn-nb-db'][0]) | put_address_in_context('url') }} {% endif %} --db-sock=/run/ovn/ovnnb_db.sock --db-nb-pid=/run/ovn/ovnnb_db.pid --db-nb-file=/var/lib/openvswitch/ovn-nb/ovnnb.db --ovn-nb-logfile=/var/log/kolla/openvswitch/ovn-nb-db.log", "permissions": [ { "path": "/var/log/kolla/openvswitch", diff --git a/ansible/roles/ovn/templates/ovn-sb-db.json.j2 b/ansible/roles/ovn/templates/ovn-sb-db.json.j2 index 30f6596cd6..cee8b3061e 100644 --- a/ansible/roles/ovn/templates/ovn-sb-db.json.j2 +++ b/ansible/roles/ovn/templates/ovn-sb-db.json.j2 @@ -1,5 +1,5 @@ { - "command": "/usr/share/ovn/scripts/ovn-ctl run_sb_ovsdb --db-sb-create-insecure-remote=yes --db-sb-addr={{ api_interface_address }} --db-sb-cluster-local-addr={{ api_interface_address }} {% if groups['ovn-sb-db'] | length > 1 and inventory_hostname != groups['ovn-sb-db'][0] %} --db-sb-cluster-remote-addr={{ 'api' | kolla_address(groups['ovn-sb-db'][0]) }} {% endif %} --db-sock=/run/ovn/ovnsb_db.sock --db-sb-pid=/run/ovn/ovnsb_db.pid --db-sb-file=/var/lib/openvswitch/ovn-sb/ovnsb.db --ovn-sb-logfile=/var/log/kolla/openvswitch/ovn-sb-db.log", + "command": "/usr/share/ovn/scripts/ovn-ctl run_sb_ovsdb --db-sb-create-insecure-remote=yes --db-sb-addr={{ api_interface_address | put_address_in_context('url') }} --db-sb-cluster-local-addr={{ api_interface_address | put_address_in_context('url') }} {% if groups['ovn-sb-db'] | length > 1 and inventory_hostname != groups['ovn-sb-db'][0] %} --db-sb-cluster-remote-addr={{ 'api' | kolla_address(groups['ovn-sb-db'][0]) | put_address_in_context('url') }} {% endif %} --db-sock=/run/ovn/ovnsb_db.sock --db-sb-pid=/run/ovn/ovnsb_db.pid --db-sb-file=/var/lib/openvswitch/ovn-sb/ovnsb.db --ovn-sb-logfile=/var/log/kolla/openvswitch/ovn-sb-db.log", "permissions": [ { "path": "/var/log/kolla/openvswitch", diff --git a/tests/test-ovn.sh b/tests/test-ovn.sh index fb13682daa..bf47f3de50 100755 --- a/tests/test-ovn.sh +++ b/tests/test-ovn.sh @@ -8,12 +8,17 @@ set -o pipefail export PYTHONUNBUFFERED=1 function test_ovn_logged { + # NOTE(yoctozepto): could use real ini parsing but this is fine for now + local neutron_ml2_conf_path=/etc/kolla/neutron-server/ml2_conf.ini + ovn_nb_connection=$(sudo grep -P -o -e "(?<=^ovn_nb_connection = ).*" "$neutron_ml2_conf_path") + ovn_sb_connection=$(sudo grep -P -o -e "(?<=^ovn_sb_connection = ).*" "$neutron_ml2_conf_path") + # List OVN NB/SB entries echo "OVN NB DB entries:" - sudo docker exec ovn_northd ovn-nbctl --db "tcp:192.0.2.1:6641,tcp:192.0.2.2:6641,tcp:192.0.2.3:6641" show + sudo docker exec ovn_northd ovn-nbctl --db "$ovn_nb_connection" show echo "OVN SB DB entries:" - sudo docker exec ovn_northd ovn-sbctl --db "tcp:192.0.2.1:6642,tcp:192.0.2.2:6642,tcp:192.0.2.3:6642" show + sudo docker exec ovn_northd ovn-sbctl --db "$ovn_sb_connection" show # Test OVSDB cluster state if [[ $BASE_DISTRO =~ ^(debian|ubuntu)$ ]]; then