From 46a22cccaca4de58c41d286ba4dcd55623ca59f3 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Wed, 26 Jul 2017 14:35:17 +0100 Subject: [PATCH] Allow only vxlan networks to be created in Neutron. If network_mappings is defined but empty, we should treat it as though it is undefined. Otherwise the template tasks will fail due to there being no "network_mappings[0]". We should add a test case for this once the fix is backported to the stable/ocata branch, to avoid a regression in future. Currently this would fail the upgrade gate due to this bug coming up in stable/ocata branch. Change-Id: Ifd0d2c23bb65225d27c74360ff521b84676b7a81 Closes-Bug: #1528307 --- templates/neutron.conf.j2 | 2 +- templates/plugins/ml2/linuxbridge_agent.ini.j2 | 2 +- templates/plugins/ml2/openvswitch_agent.ini.j2 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/neutron.conf.j2 b/templates/neutron.conf.j2 index 24d5f55e..561c1a71 100644 --- a/templates/neutron.conf.j2 +++ b/templates/neutron.conf.j2 @@ -71,7 +71,7 @@ agent_down_time = {{ neutron_agent_down_time }} l3_ha = True l3_ha_net_cidr = {{ neutron_l3_ha_net_cidr }} max_l3_agents_per_router = {{ max_l3_router }} -{% if neutron_provider_networks.network_mappings_list is defined %} +{% if neutron_provider_networks.network_mappings_list is defined and ((neutron_provider_networks.network_mappings_list | length) > 0) %} ha_network_type = {{ neutron_provider_networks.network_mappings_list[0].split(':')[0] }} ha_network_physical_name = {{ neutron_provider_networks.network_mappings_list[0].split(':')[-1] }} {% endif %} diff --git a/templates/plugins/ml2/linuxbridge_agent.ini.j2 b/templates/plugins/ml2/linuxbridge_agent.ini.j2 index ddbd0225..822d5d38 100644 --- a/templates/plugins/ml2/linuxbridge_agent.ini.j2 +++ b/templates/plugins/ml2/linuxbridge_agent.ini.j2 @@ -3,7 +3,7 @@ # Linux bridge agent physical interface mappings [linux_bridge] -{% if neutron_provider_networks.network_mappings is defined %} +{% if neutron_provider_networks.network_mappings is defined and ((neutron_provider_networks.network_mappings | length) > 0) %} physical_interface_mappings = {{ neutron_provider_networks.network_mappings }} {% endif %} diff --git a/templates/plugins/ml2/openvswitch_agent.ini.j2 b/templates/plugins/ml2/openvswitch_agent.ini.j2 index d65a8557..058c8970 100644 --- a/templates/plugins/ml2/openvswitch_agent.ini.j2 +++ b/templates/plugins/ml2/openvswitch_agent.ini.j2 @@ -4,7 +4,7 @@ {% if neutron_tunnel_types | length > 0 %} local_ip = {{ neutron_local_ip }} {% endif %} -{% if neutron_provider_networks.network_mappings is defined %} +{% if neutron_provider_networks.network_mappings is defined and ((neutron_provider_networks.network_mappings | length) > 0) %} bridge_mappings = {{ neutron_provider_networks.network_mappings }} {% endif %}