Browse Source

Get the CIDR of the neutron port for NetworkConfig

Since GroupVars moved to overcloud.j2.yaml in
https://review.opendev.org/677218 the CIDR set in
'{{network.name_lower}}_cidr' in groupvars is limited
to one of the subnets on the network.

When a network have multiple subnets with different
subnet prefixes, this becomes a problem as nodes are
configured with the from subnet mask.

This change moves them to AnsibleHostVars.

Closes-Bug: #1895899
Change-Id: I4e4e5b1195d17f59c825a3f7df73920921e1f86e
changes/30/750130/4
Harald Jensås 1 year ago
committed by Rabi Mishra
parent
commit
cd53ae79c7
  1. 25
      overcloud.j2.yaml
  2. 14
      puppet/role.role.j2.yaml
  3. 12
      releasenotes/notes/bug-1895899-8d675670a0d05c15.yaml

25
overcloud.j2.yaml

@ -918,37 +918,12 @@ resources:
type: OS::Heat::Value
properties:
value:
ctlplane_subnet_cidr:
yaql:
expression: coalesce($.data, []).where(not isEmpty($)).first().split('/')[-1]
data:
if:
- ctlplane_subnet_cidr_set
- [{get_param: ControlPlaneSubnetCidr}]
- {get_attr: [ControlVirtualIP, network, tags]}
network_cidrs:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}_cidr:
yaql:
expression: coalesce($.data, []).where(not isEmpty($)).first().split('/')[-1]
data: {get_attr: [Networks, net_cidr_map, {{network.name_lower}}]}
{%- endif %}
{%- endfor %}
role_networks:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
- {{network.name}}
{% endif %}
{% endfor %}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name_lower}}_cidr:
yaql:
expression: coalesce($.data, []).where(not isEmpty($)).first().split('/')[-1]
data: {get_attr: [Networks, net_cidr_map, {{network.name_lower}}]}
{% endif %}
{% endfor %}
service_metadata_settings: {get_attr: [{{role.name}}ServiceChainRoleData, value, service_metadata_settings]}
{% endfor %}

14
puppet/role.role.j2.yaml

@ -574,10 +574,24 @@ resources:
properties:
type: json
value:
ctlplane_subnet_cidr:
if:
- ctlplane_subnet_cidr_set
- {get_param: ControlPlaneSubnetCidr}
- yaql:
expression: str("{0}".format($.data).split("/")[-1])
data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name_lower}}_cidr: {get_attr: [{{network.name}}Port, cidr]}
fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]}
{%- endif %}
{%- endfor %}
network_cidrs:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}_cidr: {get_attr: [{{network.name}}Port, cidr]}
{%- endif %}
{%- endfor %}
fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}

12
releasenotes/notes/bug-1895899-8d675670a0d05c15.yaml

@ -0,0 +1,12 @@
---
fixes:
- |
Ansible GroupVars incorrectly keept a single subnet prefix per-network.
This caused a problem when multiple subnets using different subnet
prefixes where defined. Resulting in the wrong subnet prefix being
referenced in the NetworkConfig for roles.
AnsibleHostVars stores networks subnet prefixes instead.
See bug: `1895899
<https://bugs.launchpad.net/tripleo/+bug/1895899>`_.
Loading…
Cancel
Save