From 0592cb32bfa87f5b12120d26361a4a77a4763c75 Mon Sep 17 00:00:00 2001 From: Oliver Walsh Date: Mon, 24 May 2021 22:58:40 +0100 Subject: [PATCH] Fix network_cidrs when ManageNetworks: false The legacy parameters (e.g InternalApiNetCidr) default to the new network_data.yaml values. When ManageNetworks: true the value of these parameters is then used to create the network resources. The cidr attribute of the resources are then used to build the network_cidrs output value resulting in the correct list of cidrs. However when Managenetworks: false the resources are not created so an alternative approach is required. Currently only the values from network_data.yaml are used. If the legacy parameters are being used in a deployment this will result in the cidrs from the default t-h-t/network_data.yaml instead of the values from the heat parameters. This can result in live migration failure as the firewall subnet is incorrect on compute nodes. To resolve this we can just use the value from the legacy params to build the cidr list when ManageNetworks: false. There is also an unnecessary list_concat which can be removed. Closes-bug: 1929470 Change-Id: Ibe5f9ec4dc32a6e8277e95032e608209a035cad5 (cherry picked from commit 181505145ee9a112d2d8ae23a19a50e63c832d0b) --- network/network.j2 | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/network/network.j2 b/network/network.j2 index 41c042d6de..8f19bf7a12 100644 --- a/network/network.j2 +++ b/network/network.j2 @@ -277,27 +277,15 @@ outputs: network_cidrs: description: List of {{network.name}} network's subnets in CIDR notation. value: - list_concat: - if: - - manage_networks - - - - {get_attr: [{{network.name}}Subnet, cidr]} - - + if: + - manage_networks + - - {get_attr: [{{network.name}}Subnet, cidr]} {%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %} - - {get_attr: [{{network.name}}Subnet_{{subnet}}, cidr]} + - {get_attr: [{{network.name}}Subnet_{{subnet}}, cidr]} {%- endfor %} - - - -{%- if network.ipv6 or ipv6_override %} - - {{network.ipv6_subnet|default(network.ip_subnet|default(""))}} -{%- else %} - - "{{network.ip_subnet|default("")}}" -{%- endif %} - - + - - {get_param: {{network.name}}NetCidr} {%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %} -{%- if network.ipv6 or ipv6_override %} - - "{{network.subnets[subnet]['ipv6_subnet']|default(network.subnets[subnet]['ip_subnet']|default(""))}}" -{%- else %} - - "{{network.subnets[subnet]['ip_subnet']|default("")}}" -{%- endif %} + - {get_param: {{network.name}}SubnetCidr_{{subnet}}} {%- endfor %} network_attrs: