From c8245edf91885ad42ed515e7fe56b335957ab87a Mon Sep 17 00:00:00 2001
From: Jianghua Wang <jianghua.wang@citrix.com>
Date: Thu, 25 Jan 2018 11:10:04 +0000
Subject: [PATCH] XenAPI: fix two neutron configures

This commit contains two fixes:
1. ``of_listen_address``: We use the xenapi's facts directly, so
that we can avoid depending on facts gathered by setup for hosts;
This is useful when deploy on the role of neutron only (--tag neutron);
2. ``local_ip``: Get the proper IP for tunnel. It should be chosen
from dom0's IP which is in the same network where tunnel interface
is connected.

blueprint: xenserver-support

Change-Id: I61bbd6499323e3fddd6293a0df6baec34dbddf23
---
 ansible/roles/neutron/templates/ml2_conf_xenapi.ini.j2 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ansible/roles/neutron/templates/ml2_conf_xenapi.ini.j2 b/ansible/roles/neutron/templates/ml2_conf_xenapi.ini.j2
index 6d7558aa97..51ebabc60a 100644
--- a/ansible/roles/neutron/templates/ml2_conf_xenapi.ini.j2
+++ b/ansible/roles/neutron/templates/ml2_conf_xenapi.ini.j2
@@ -10,7 +10,7 @@ root_helper_daemon = xenapi_root_helper
 root_helper =
 
 [ovs]
-of_listen_address = {{ hostvars[inventory_hostname]['ansible_' + os_xenapi_variables.domu_himn_eth]["ipv4"]["address"] }}
+of_listen_address = {{ os_xenapi_variables.domu_himn_ip }}
 ovsdb_connection = tcp:{{ xenserver_himn_ip }}:{{ ovsdb_port }}
 {% if computes_need_external_bridge %}
 bridge_mappings = {% for interface in neutron_external_interface.split(',') %}physnet{{ loop.index0 + 1 }}:{{ os_xenapi_variables.domu_vifs[interface]["bridge"] }}{% if not loop.last %},{% endif %}{% endfor %}
@@ -18,6 +18,8 @@ bridge_mappings = {% for interface in neutron_external_interface.split(',') %}ph
 bridge_mappings =
 {% endif %}
 
+local_ip = {% for ip in os_xenapi_variables.dom0_ipv4s %}{% if ip.bridge == os_xenapi_variables.domu_vifs[tunnel_interface]['bridge'] %}{{ip.address}}{% endif %} {% endfor %}
+
 [xenapi]
 connection_password = {{ xenserver_password }}
 connection_username = {{ xenserver_username }}
-- 
GitLab