summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRabi Mishra <ramishra@redhat.com>2018-10-31 14:27:16 +0530
committerRabi Mishra <ramishra@redhat.com>2018-11-19 10:14:34 +0530
commit5d275fb9223c722d7436431c58f22a559a190773 (patch)
treea8a7be962e4f1d56b106d010cb6cc8e438401af9
parent5413ca926d9d591964f2d9455c52327c278be441 (diff)
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
Notes
Notes (review): Code-Review+2: Steven Hardy <shardy@redhat.com> Code-Review+2: Juan Antonio Osorio Robles <jaosorior@redhat.com> Workflow+1: Steven Hardy <shardy@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 05 Dec 2018 19:01:14 +0000 Reviewed-on: https://review.openstack.org/614457 Project: openstack/tripleo-heat-templates Branch: refs/heads/master
-rw-r--r--overcloud.j2.yaml12
-rw-r--r--puppet/role.role.j2.yaml26
-rw-r--r--roles/Standalone.yaml6
-rw-r--r--roles/Undercloud.yaml6
-rw-r--r--roles_data_undercloud.yaml6
5 files changed, 52 insertions, 4 deletions
diff --git a/overcloud.j2.yaml b/overcloud.j2.yaml
index 5aa135f..c02ebaf 100644
--- a/overcloud.j2.yaml
+++ b/overcloud.j2.yaml
@@ -523,7 +523,7 @@ resources:
523 depends_on: {{role.name}}AllNodesDeployment 523 depends_on: {{role.name}}AllNodesDeployment
524 properties: 524 properties:
525 name: {{role.name}}AllNodesValidationDeployment 525 name: {{role.name}}AllNodesValidationDeployment
526 config: {get_resource: AllNodesValidationConfig} 526 config: {get_resource: {{role.name}}AllNodesValidationConfig}
527 servers: {get_attr: [{{role.name}}Servers, value]} 527 servers: {get_attr: [{{role.name}}Servers, value]}
528 528
529 {{role.name}}IpListMap: 529 {{role.name}}IpListMap:
@@ -531,7 +531,7 @@ resources:
531 properties: 531 properties:
532 ControlPlaneIpList: {get_attr: [{{role.name}}, ip_address]} 532 ControlPlaneIpList: {get_attr: [{{role.name}}, ip_address]}
533{%- for network in networks %} 533{%- for network in networks %}
534 {%- if network.enabled|default(true) %} 534 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
535 {{network.name}}IpList: {get_attr: [{{role.name}}, {{network.name_lower}}_ip_address]} 535 {{network.name}}IpList: {get_attr: [{{role.name}}, {{network.name_lower}}_ip_address]}
536 {%- else %} 536 {%- else %}
537 {{network.name}}IpList: {get_attr: [{{role.name}}, ip_address]} 537 {{network.name}}IpList: {get_attr: [{{role.name}}, ip_address]}
@@ -851,18 +851,22 @@ resources:
851 # ServiceNetMap's attribute values are available. 851 # ServiceNetMap's attribute values are available.
852 depends_on: ServiceNetMap 852 depends_on: ServiceNetMap
853 853
854{%- for role in roles %}
854 # All Nodes Validations 855 # All Nodes Validations
855 AllNodesValidationConfig: 856 {{role.name}}AllNodesValidationConfig:
856 type: OS::TripleO::AllNodes::Validation 857 type: OS::TripleO::AllNodes::Validation
857 properties: 858 properties:
858 PingTestIps: 859 PingTestIps:
859 list_join: 860 list_join:
860 - ' ' 861 - ' '
861 - 862 -
862{%- for network in networks if network.enabled|default(true) %} 863{%- for network in networks %}
864 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
863 - yaql: 865 - yaql:
864 expression: coalesce($.data, []).first(null) 866 expression: coalesce($.data, []).first(null)
865 data: {get_attr: [{{primary_role_name}}, {{network.name_lower}}_ip_address]} 867 data: {get_attr: [{{primary_role_name}}, {{network.name_lower}}_ip_address]}
868 {%- endif %}
869{%- endfor %}
866{%- endfor %} 870{%- endfor %}
867 871
868 # Optional ExtraConfig for all nodes - all roles are passed in here, but 872 # Optional ExtraConfig for all nodes - all roles are passed in here, but
diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml
index e59f1dd..2bebfed 100644
--- a/puppet/role.role.j2.yaml
+++ b/puppet/role.role.j2.yaml
@@ -262,6 +262,7 @@ parameters:
262 dns_nameservers attribute will be used. 262 dns_nameservers attribute will be used.
263 type: comma_delimited_list 263 type: comma_delimited_list
264{%- for network in networks %} 264{%- for network in networks %}
265{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
265 {{network.name}}InterfaceRoutes: 266 {{network.name}}InterfaceRoutes:
266 default: [] 267 default: []
267 description: > 268 description: >
@@ -270,6 +271,7 @@ parameters:
270 Unless the default is changed, the parameter is automatically resolved 271 Unless the default is changed, the parameter is automatically resolved
271 from the subnet host_routes attribute. 272 from the subnet host_routes attribute.
272 type: json 273 type: json
274{%- endif %}
273{%- endfor %} 275{%- endfor %}
274 276
275 ServerDeletionPolicy: 277 ServerDeletionPolicy:
@@ -336,6 +338,7 @@ conditions:
336{%- endif %} 338{%- endif %}
337 - "" 339 - ""
338{%- for network in networks %} 340{%- for network in networks %}
341{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
339 {{role.name}}_{{network.name}}_fixed_ip_set: 342 {{role.name}}_{{network.name}}_fixed_ip_set:
340 not: 343 not:
341 equals: 344 equals:
@@ -346,6 +349,7 @@ conditions:
346 equals: 349 equals:
347 - {get_param: {{network.name}}InterfaceRoutes} 350 - {get_param: {{network.name}}InterfaceRoutes}
348 - [] 351 - []
352{%- endif %}
349{%- endfor %} 353{%- endfor %}
350 ctlplane_subnet_cidr_set: 354 ctlplane_subnet_cidr_set:
351 not: 355 not:
@@ -454,6 +458,7 @@ resources:
454 type: OS::TripleO::{{role.name}}::NodeUserData 458 type: OS::TripleO::{{role.name}}::NodeUserData
455 459
456 {%- for network in networks %} 460 {%- for network in networks %}
461 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
457 {{network.name}}Port: 462 {{network.name}}Port:
458 type: OS::TripleO::{{role.name}}::Ports::{{network.name}}Port 463 type: OS::TripleO::{{role.name}}::Ports::{{network.name}}Port
459 properties: 464 properties:
@@ -485,6 +490,7 @@ resources:
485{%- endif %} 490{%- endif %}
486 - {get_param: {{role.name}}IPs} 491 - {get_param: {{role.name}}IPs}
487 NodeIndex: {get_param: NodeIndex} 492 NodeIndex: {get_param: NodeIndex}
493 {%- endif %}
488 {%- endfor %} 494 {%- endfor %}
489 495
490 NetworkConfig: 496 NetworkConfig:
@@ -520,12 +526,14 @@ resources:
520 - {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, dns_nameservers]} 526 - {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, dns_nameservers]}
521 527
522 {%- for network in networks %} 528 {%- for network in networks %}
529 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
523 {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]} 530 {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
524 {{network.name}}InterfaceRoutes: 531 {{network.name}}InterfaceRoutes:
525 if: 532 if:
526 - {{network.name_lower}}_interface_routes_set 533 - {{network.name_lower}}_interface_routes_set
527 - {get_param: {{network.name}}InterfaceRoutes} 534 - {get_param: {{network.name}}InterfaceRoutes}
528 - {get_attr: [{{network.name}}Port, host_routes]} 535 - {get_attr: [{{network.name}}Port, host_routes]}
536 {%- endif %}
529 {%- endfor %} 537 {%- endfor %}
530 538
531 NetIpMap: 539 NetIpMap:
@@ -542,9 +550,11 @@ resources:
542 550
543 551
544 {%- for network in networks %} 552 {%- for network in networks %}
553 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
545 {{network.name}}Ip: {get_attr: [{{network.name}}Port, ip_address]} 554 {{network.name}}Ip: {get_attr: [{{network.name}}Port, ip_address]}
546 {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]} 555 {{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
547 {{network.name}}IpUri: {get_attr: [{{network.name}}Port, ip_address_uri]} 556 {{network.name}}IpUri: {get_attr: [{{network.name}}Port, ip_address_uri]}
557 {%- endif %}
548 {%- endfor %} 558 {%- endfor %}
549 559
550 NetHostMap: 560 NetHostMap:
@@ -553,6 +563,7 @@ resources:
553 type: json 563 type: json
554 value: 564 value:
555 {%- for network in networks %} 565 {%- for network in networks %}
566 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
556 {{network.name_lower}}: 567 {{network.name_lower}}:
557 fqdn: 568 fqdn:
558 list_join: 569 list_join:
@@ -565,6 +576,7 @@ resources:
565 - '.' 576 - '.'
566 - - {get_attr: [{{server_resource_name}}, name]} 577 - - {get_attr: [{{server_resource_name}}, name]}
567 - {{network.name.lower()}} 578 - {{network.name.lower()}}
579 {%- endif %}
568 {%- endfor %} 580 {%- endfor %}
569 ctlplane: 581 ctlplane:
570 fqdn: 582 fqdn:
@@ -698,7 +710,9 @@ resources:
698 {{role.name.lower()}}: 710 {{role.name.lower()}}:
699 tripleo::clouddomain: {get_param: CloudDomain} 711 tripleo::clouddomain: {get_param: CloudDomain}
700 {%- for network in networks %} 712 {%- for network in networks %}
713 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
701 fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]} 714 fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]}
715 {%- endif %}
702 {%- endfor %} 716 {%- endfor %}
703 fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]} 717 fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
704 fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]} 718 fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
@@ -756,8 +770,10 @@ resources:
756 str_replace: 770 str_replace:
757 template: "[PRIMARYIP]*,[PRIMARYHOST.DOMAIN]*,[PRIMARYHOST]*,\ 771 template: "[PRIMARYIP]*,[PRIMARYHOST.DOMAIN]*,[PRIMARYHOST]*,\
758 {%- for network in networks %} 772 {%- for network in networks %}
773 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
759 [{{network.name}}IP]*,[{{network.name}}HOST.DOMAIN]*,\ 774 [{{network.name}}IP]*,[{{network.name}}HOST.DOMAIN]*,\
760 [{{network.name}}HOST]*,\ 775 [{{network.name}}HOST]*,\
776 {%- endif %}
761 {%- endfor %} 777 {%- endfor %}
762 [CTLPLANEIP]*,[CTLPLANEHOST.DOMAIN]*,[CTLPLANEHOST]*" 778 [CTLPLANEIP]*,[CTLPLANEHOST.DOMAIN]*,[CTLPLANEHOST]*"
763 params: 779 params:
@@ -765,8 +781,10 @@ resources:
765 DOMAIN: {get_param: CloudDomain} 781 DOMAIN: {get_param: CloudDomain}
766 PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]} 782 PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
767 {%- for network in networks %} 783 {%- for network in networks %}
784 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
768 {{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]} 785 {{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
769 {{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]} 786 {{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
787 {%- endif %}
770 {%- endfor %} 788 {%- endfor %}
771 CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]} 789 CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
772 CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]} 790 CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
@@ -796,7 +814,9 @@ outputs:
796 description: Mapping of network names to hostnames 814 description: Mapping of network names to hostnames
797 value: 815 value:
798 {%- for network in networks %} 816 {%- for network in networks %}
817 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
799 {{network.name_lower|default(network.name.lower())}}: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower()) }}, fqdn]} 818 {{network.name_lower|default(network.name.lower())}}: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower()) }}, fqdn]}
819 {%- endif %}
800 {%- endfor %} 820 {%- endfor %}
801 ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]} 821 ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
802 canonical: {get_attr: [NetHostMap, value, canonical, fqdn]} 822 canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
@@ -806,7 +826,9 @@ outputs:
806 template: | 826 template: |
807 PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST 827 PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
808 {%- for network in networks %} 828 {%- for network in networks %}
829 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
809 {{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST 830 {{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST
831 {%- endif %}
810 {%- endfor %} 832 {%- endfor %}
811 CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST 833 CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
812 params: 834 params:
@@ -814,8 +836,10 @@ outputs:
814 DOMAIN: {get_param: CloudDomain} 836 DOMAIN: {get_param: CloudDomain}
815 PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]} 837 PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
816 {%- for network in networks %} 838 {%- for network in networks %}
839 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
817 {{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]} 840 {{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
818 {{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]} 841 {{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
842 {%- endif %}
819 {%- endfor %} 843 {%- endfor %}
820 CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]} 844 CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
821 CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]} 845 CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
@@ -883,9 +907,11 @@ outputs:
883 description: The os-collect-config configuration associated with this server resource 907 description: The os-collect-config configuration associated with this server resource
884 value: {get_attr: [{{server_resource_name}}, os_collect_config]} 908 value: {get_attr: [{{server_resource_name}}, os_collect_config]}
885 {%- for network in networks %} 909 {%- for network in networks %}
910 {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
886 {{network.name_lower|default(network.name.lower())}}_ip_address: 911 {{network.name_lower|default(network.name.lower())}}_ip_address:
887 description: IP address of the server in the {{network.name}} network 912 description: IP address of the server in the {{network.name}} network
888 value: {get_attr: [{{network.name}}Port, ip_address]} 913 value: {get_attr: [{{network.name}}Port, ip_address]}
914 {%- endif %}
889 {%- endfor %} 915 {%- endfor %}
890 role_group_vars: 916 role_group_vars:
891 value: 917 value:
diff --git a/roles/Standalone.yaml b/roles/Standalone.yaml
index 840c980..8f825e9 100644
--- a/roles/Standalone.yaml
+++ b/roles/Standalone.yaml
@@ -11,6 +11,12 @@
11 tags: 11 tags:
12 - primary 12 - primary
13 - controller 13 - controller
14 networks:
15 - External
16 - InternalApi
17 - Storage
18 - StorageMgmt
19 - Tenant
14 disable_constraints: True 20 disable_constraints: True
15 ServicesDefault: 21 ServicesDefault:
16 - OS::TripleO::Services::Aide 22 - OS::TripleO::Services::Aide
diff --git a/roles/Undercloud.yaml b/roles/Undercloud.yaml
index 4cb2725..f0015dd 100644
--- a/roles/Undercloud.yaml
+++ b/roles/Undercloud.yaml
@@ -10,6 +10,12 @@
10 tags: 10 tags:
11 - primary 11 - primary
12 - controller 12 - controller
13 networks:
14 - External
15 - InternalApi
16 - Storage
17 - StorageMgmt
18 - Tenant
13 ServicesDefault: 19 ServicesDefault:
14 - OS::TripleO::Services::Aide 20 - OS::TripleO::Services::Aide
15 - OS::TripleO::Services::AodhApi 21 - OS::TripleO::Services::AodhApi
diff --git a/roles_data_undercloud.yaml b/roles_data_undercloud.yaml
index 67c0910..f514e2b 100644
--- a/roles_data_undercloud.yaml
+++ b/roles_data_undercloud.yaml
@@ -13,6 +13,12 @@
13 tags: 13 tags:
14 - primary 14 - primary
15 - controller 15 - controller
16 networks:
17 - External
18 - InternalApi
19 - Storage
20 - StorageMgmt
21 - Tenant
16 ServicesDefault: 22 ServicesDefault:
17 - OS::TripleO::Services::Aide 23 - OS::TripleO::Services::Aide
18 - OS::TripleO::Services::AodhApi 24 - OS::TripleO::Services::AodhApi