Check for available networks for a role

For network isolation, we specifcy available networks for role.
Therefore, there is no point in creating noop network resources for
networks that are not available/connected. This results in redundant
host entries for not available networks on overcloud nodes.

If a network is not available for a role we don't need to create
those extra noop resources.

For Undercloud/Standalone role we keep all networks in roles data
as the default ServiceNetMap specifies non ctlplane networks though
they map to ctlplane.

Change-Id: I07822ec0cba7eed352c0010eb893b5e5a522e95c
Closes-Bug: #1800811
(cherry picked from commit 5d275fb922)
This commit is contained in:
Rabi Mishra 2018-10-31 14:27:16 +05:30 committed by Emilien Macchi
parent 2f8553474e
commit 2e620b9367
5 changed files with 52 additions and 4 deletions

View File

@ -523,7 +523,7 @@ resources:
depends_on: {{role.name}}AllNodesDeployment
properties:
name: {{role.name}}AllNodesValidationDeployment
config: {get_resource: AllNodesValidationConfig}
config: {get_resource: {{role.name}}AllNodesValidationConfig}
servers: {get_attr: [{{role.name}}Servers, value]}
{{role.name}}IpListMap:
@ -531,7 +531,7 @@ resources:
properties:
ControlPlaneIpList: {get_attr: [{{role.name}}, ip_address]}
{%- for network in networks %}
{%- if network.enabled|default(true) %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IpList: {get_attr: [{{role.name}}, {{network.name_lower}}_ip_address]}
{%- else %}
{{network.name}}IpList: {get_attr: [{{role.name}}, ip_address]}
@ -853,18 +853,22 @@ resources:
# ServiceNetMap's attribute values are available.
depends_on: ServiceNetMap
{%- for role in roles %}
# All Nodes Validations
AllNodesValidationConfig:
{{role.name}}AllNodesValidationConfig:
type: OS::TripleO::AllNodes::Validation
properties:
PingTestIps:
list_join:
- ' '
-
{%- for network in networks if network.enabled|default(true) %}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
- yaql:
expression: coalesce($.data, []).first(null)
data: {get_attr: [{{primary_role_name}}, {{network.name_lower}}_ip_address]}
{%- endif %}
{%- endfor %}
{%- endfor %}
# Optional ExtraConfig for all nodes - all roles are passed in here, but

View File

@ -268,6 +268,7 @@ parameters:
dns_nameservers attribute will be used.
type: comma_delimited_list
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}InterfaceRoutes:
default: []
description: >
@ -276,6 +277,7 @@ parameters:
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
{%- endif %}
{%- endfor %}
ServerDeletionPolicy:
@ -342,6 +344,7 @@ conditions:
{%- endif %}
- ""
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{role.name}}_{{network.name}}_fixed_ip_set:
not:
equals:
@ -352,6 +355,7 @@ conditions:
equals:
- {get_param: {{network.name}}InterfaceRoutes}
- []
{%- endif %}
{%- endfor %}
ctlplane_subnet_cidr_set:
not:
@ -460,6 +464,7 @@ resources:
type: OS::TripleO::{{role.name}}::NodeUserData
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}Port:
type: OS::TripleO::{{role.name}}::Ports::{{network.name}}Port
properties:
@ -491,6 +496,7 @@ resources:
{%- endif %}
- {get_param: {{role.name}}IPs}
NodeIndex: {get_param: NodeIndex}
{%- endif %}
{%- endfor %}
NetworkConfig:
@ -526,12 +532,14 @@ resources:
- {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, dns_nameservers]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
{{network.name}}InterfaceRoutes:
if:
- {{network.name_lower}}_interface_routes_set
- {get_param: {{network.name}}InterfaceRoutes}
- {get_attr: [{{network.name}}Port, host_routes]}
{%- endif %}
{%- endfor %}
NetIpMap:
@ -548,9 +556,11 @@ resources:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}Ip: {get_attr: [{{network.name}}Port, ip_address]}
{{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
{{network.name}}IpUri: {get_attr: [{{network.name}}Port, ip_address_uri]}
{%- endif %}
{%- endfor %}
NetHostMap:
@ -559,6 +569,7 @@ resources:
type: json
value:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name_lower}}:
fqdn:
list_join:
@ -571,6 +582,7 @@ resources:
- '.'
- - {get_attr: [{{server_resource_name}}, name]}
- {{network.name.lower()}}
{%- endif %}
{%- endfor %}
ctlplane:
fqdn:
@ -706,7 +718,9 @@ resources:
tripleo::profile::base::logging::fluentd::fluentd_groups: {get_param: LoggingGroups}
tripleo::clouddomain: {get_param: CloudDomain}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]}
{%- endif %}
{%- endfor %}
fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
@ -764,8 +778,10 @@ resources:
str_replace:
template: "[PRIMARYIP]*,[PRIMARYHOST.DOMAIN]*,[PRIMARYHOST]*,\
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
[{{network.name}}IP]*,[{{network.name}}HOST.DOMAIN]*,\
[{{network.name}}HOST]*,\
{%- endif %}
{%- endfor %}
[CTLPLANEIP]*,[CTLPLANEHOST.DOMAIN]*,[CTLPLANEHOST]*"
params:
@ -773,8 +789,10 @@ resources:
DOMAIN: {get_param: CloudDomain}
PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
{{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
{%- endif %}
{%- endfor %}
CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
@ -804,7 +822,9 @@ outputs:
description: Mapping of network names to hostnames
value:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name_lower|default(network.name.lower())}}: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower()) }}, fqdn]}
{%- endif %}
{%- endfor %}
ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
@ -814,7 +834,9 @@ outputs:
template: |
PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST
{%- endif %}
{%- endfor %}
CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
params:
@ -822,8 +844,10 @@ outputs:
DOMAIN: {get_param: CloudDomain}
PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
{{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
{%- endif %}
{%- endfor %}
CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
@ -891,9 +915,11 @@ outputs:
description: The os-collect-config configuration associated with this server resource
value: {get_attr: [{{server_resource_name}}, os_collect_config]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name_lower|default(network.name.lower())}}_ip_address:
description: IP address of the server in the {{network.name}} network
value: {get_attr: [{{network.name}}Port, ip_address]}
{%- endif %}
{%- endfor %}
role_group_vars:
value:

View File

@ -11,6 +11,12 @@
tags:
- primary
- controller
networks:
- External
- InternalApi
- Storage
- StorageMgmt
- Tenant
disable_constraints: True
ServicesDefault:
- OS::TripleO::Services::Aide

View File

@ -10,6 +10,12 @@
tags:
- primary
- controller
networks:
- External
- InternalApi
- Storage
- StorageMgmt
- Tenant
ServicesDefault:
- OS::TripleO::Services::Aide
- OS::TripleO::Services::AodhApi

View File

@ -13,6 +13,12 @@
tags:
- primary
- controller
networks:
- External
- InternalApi
- Storage
- StorageMgmt
- Tenant
ServicesDefault:
- OS::TripleO::Services::Aide
- OS::TripleO::Services::AodhApi