diff --git a/network/config/2-linux-bonds-vlans/role.role.j2.yaml b/network/config/2-linux-bonds-vlans/role.role.j2.yaml index 0208359764..472b23c910 100644 --- a/network/config/2-linux-bonds-vlans/role.role.j2.yaml +++ b/network/config/2-linux-bonds-vlans/role.role.j2.yaml @@ -92,7 +92,7 @@ parameters: interface. Set things like lacp=active and/or bond_mode=balance-slb for OVS bonds or like mode=4 for Linux bonds using this option.' type: string -{%- if role.name == 'ComputeOvsDpdk' %} +{%- if 'ovsdpdk' in role.tags %} NumDpdkInterfaceRxQueues: description: Number of Rx Queues required for DPDK bond or DPDK ports default: 1 @@ -191,7 +191,7 @@ resources: routes: get_param: {{network.name}}InterfaceRoutes {%- endfor %} -{%- if not role.name.startswith('ComputeOvsDpdk') %} +{%- if not 'ovsdpdk' in role.tags %} - type: ovs_bridge name: {get_param: NeutronPhysicalBridge} dns_servers: diff --git a/network/config/bond-with-vlans/role.role.j2.yaml b/network/config/bond-with-vlans/role.role.j2.yaml index ed73379c62..a9456cf63a 100644 --- a/network/config/bond-with-vlans/role.role.j2.yaml +++ b/network/config/bond-with-vlans/role.role.j2.yaml @@ -89,7 +89,7 @@ parameters: interface. Set things like lacp=active and/or bond_mode=balance-slb for OVS bonds or like mode=4 for Linux bonds using this option.' type: string -{%- if role.name == 'ComputeOvsDpdk' %} +{%- if 'ovsdpdk' in role.tags %} NumDpdkInterfaceRxQueues: description: Number of Rx Queues required for DPDK bond or DPDK ports default: 1 @@ -137,9 +137,9 @@ resources: - get_param: ControlPlaneSubnetCidr routes: get_param: ControlPlaneStaticRoutes -{%- if not role.name.startswith('ComputeOvsDpdk') %} +{%- if not 'ovsdpdk' in role.tags %} - type: ovs_bridge -{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %} +{%- if 'ceph' in role.tags or 'storage' in role.tags %} name: br-bond {%- else %} name: {get_param: NeutronPhysicalBridge} diff --git a/network/config/multiple-nics-vlans/role.role.j2.yaml b/network/config/multiple-nics-vlans/role.role.j2.yaml index 05bbb5d036..06ce28868d 100644 --- a/network/config/multiple-nics-vlans/role.role.j2.yaml +++ b/network/config/multiple-nics-vlans/role.role.j2.yaml @@ -93,7 +93,7 @@ parameters: default: [] description: A list of DNS search domains to be added (in order) to resolv.conf. type: comma_delimited_list -{%- if role.name == 'ComputeOvsDpdk' %} +{%- if 'ovsdpdk' in role.tags %} NumDpdkInterfaceRxQueues: description: Number of Rx Queues required for DPDK bond or DPDK ports default: 1 @@ -184,7 +184,7 @@ resources: {#- This hack gets around Jinja scope limitations to update nics_used within loop. #} {%- set _ = nics_used.append(loop.index) %} {%- endfor %} -{%- if role.name == 'ComputeOvsDpdk' %} +{%- if 'ovsdpdk' in role.tags %} # Used as a provider network with external DHCP - type: ovs_user_bridge name: br-dpdk0 diff --git a/network/config/multiple-nics/role.role.j2.yaml b/network/config/multiple-nics/role.role.j2.yaml index a0b9a81351..3e4b1d4d2f 100644 --- a/network/config/multiple-nics/role.role.j2.yaml +++ b/network/config/multiple-nics/role.role.j2.yaml @@ -93,7 +93,7 @@ parameters: default: [] description: A list of DNS search domains to be added (in order) to resolv.conf. type: comma_delimited_list -{%- if role.name == 'ComputeOvsDpdk' %} +{%- if 'ovsdpdk' in role.tags %} NumDpdkInterfaceRxQueues: description: Number of Rx Queues required for DPDK bond or DPDK ports default: 1 @@ -173,7 +173,7 @@ resources: {#- This hack gets around Jinja scope limitations to update nics_used within loop. #} {%- set _ = nics_used.append(loop.index) %} {%- endfor %} -{%- if role.name == 'ComputeOvsDpdk' %} +{%- if 'ovsdpdk' in role.tags %} # Used as a provider network with external DHCP - type: ovs_user_bridge name: br-dpdk0 diff --git a/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml b/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml index 1c131402fd..9a87e182c0 100644 --- a/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml +++ b/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml @@ -117,7 +117,7 @@ resources: value: network_config: - type: linux_bridge -{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %} +{%- if 'ceph' in role.tags or 'storage' in role.tags %} name: br-storage {%- else %} name: {get_param: NeutronPhysicalBridge} @@ -150,7 +150,7 @@ and network.name not in role.networks_skip_config|default([]) %} get_param: {{network.name}}Mtu vlan_id: get_param: {{network.name}}NetworkVlanID -{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %} +{%- if 'ceph' in role.tags or 'storage' in role.tags %} device: br-storage {%- else %} device: {get_param: NeutronPhysicalBridge} diff --git a/network/config/single-nic-vlans/role.role.j2.yaml b/network/config/single-nic-vlans/role.role.j2.yaml index 4e99bba3bb..43e5bc51fd 100644 --- a/network/config/single-nic-vlans/role.role.j2.yaml +++ b/network/config/single-nic-vlans/role.role.j2.yaml @@ -113,7 +113,7 @@ resources: value: network_config: - type: ovs_bridge -{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %} +{%- if 'ceph' in role.tags or 'storage' in role.tags %} name: br-storage {%- else %} name: {get_param: NeutronPhysicalBridge} diff --git a/network/service_net_map.j2.yaml b/network/service_net_map.j2.yaml index 0107cce409..f516583e5f 100644 --- a/network/service_net_map.j2.yaml +++ b/network/service_net_map.j2.yaml @@ -93,7 +93,7 @@ parameters: # We special-case the default ResolveNetwork and MetricsQdrNetwork for the Ceph roles # for backwards compatibility, all other roles default to internal_api {%- for role in roles %} - {%- if role.name.startswith('Ceph') %} + {%- if 'ceph' in role.tags|default([]) %} {%- if 'Storage' in role.networks %} {{role.name}}HostnameResolveNetwork: {{ _service_nets.get('storage', 'ctlplane') }} {{role.name}}MetricsQdrNetwork: {{ _service_nets.get('storage', 'ctlplane') }} diff --git a/releasenotes/notes/use-tags-for-condition-instead-of-role-name-3c15f9faaa59362e.yaml b/releasenotes/notes/use-tags-for-condition-instead-of-role-name-3c15f9faaa59362e.yaml new file mode 100644 index 0000000000..8faa75901a --- /dev/null +++ b/releasenotes/notes/use-tags-for-condition-instead-of-role-name-3c15f9faaa59362e.yaml @@ -0,0 +1,22 @@ +--- +upgrade: + - | + Use of the role name in jinja2 tripleo heat templates has been replaced with + the use of role tags. Users of custom role data should update the tags for + their custom roles data file adding the relevant tags. The following tag + should be added, depending on the role: + + * **Compute** roles: add the ``compute`` tag. + * **HciCeph** roles: add the ``compute`` tag. + * **DistributedCompute** roles: add the ``compute`` tag. + * **Ceph** roles: add the ``ceph`` and ``storage`` tag. + * **ObjectStorage** roles: add the ``storage`` tag. + * **BlockStorage** roles: add the ``storage`` tag. + * **ComputeOvsDpdk** roles: add the ``ovsdpdk`` tag. +deprecations: + - | + Use of the role name in jinja2 tripleo heat templates has been replaced + with the use of role tags. By using tags the role name become truly + customizable. To keep backward compatiblity tags will be added + automatically to roles based on the role name until the next release. + diff --git a/roles/BlockStorage.yaml b/roles/BlockStorage.yaml index 6ea9ec3107..7ed760ef6b 100644 --- a/roles/BlockStorage.yaml +++ b/roles/BlockStorage.yaml @@ -4,6 +4,8 @@ - name: BlockStorage description: | Cinder Block Storage node role + tags: + - storage networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/CephAll.yaml b/roles/CephAll.yaml index bf7b0bf923..73bc6d5926 100644 --- a/roles/CephAll.yaml +++ b/roles/CephAll.yaml @@ -4,6 +4,9 @@ - name: CephAll description: | Standalone Storage Full Role (OSD + MON + RGW + MDS + MGR + RBD Mirroring) + tags: + - ceph + - storage networks: Storage: subnet: storage_subnet diff --git a/roles/CephFile.yaml b/roles/CephFile.yaml index 11df0509d4..e52885d340 100644 --- a/roles/CephFile.yaml +++ b/roles/CephFile.yaml @@ -4,6 +4,9 @@ - name: CephFile description: | Standalone Scale-out File Role (OSD + MDS) + tags: + - ceph + - storage networks: Storage: subnet: storage_subnet diff --git a/roles/CephObject.yaml b/roles/CephObject.yaml index bdf2119e17..8c1721aae8 100644 --- a/roles/CephObject.yaml +++ b/roles/CephObject.yaml @@ -4,6 +4,9 @@ - name: CephObject description: | Standalone Scale-out Object Role (OSD + RGW) + tags: + - ceph + - storage networks: Storage: subnet: storage_subnet diff --git a/roles/CephStorage.yaml b/roles/CephStorage.yaml index 22abc4e7f8..f32647c2b6 100644 --- a/roles/CephStorage.yaml +++ b/roles/CephStorage.yaml @@ -4,6 +4,9 @@ - name: CephStorage description: | Ceph OSD Storage node role + tags: + - ceph + - storage networks: Storage: subnet: storage_subnet diff --git a/roles/Compute.yaml b/roles/Compute.yaml index a0758ffd3f..30d566404c 100644 --- a/roles/Compute.yaml +++ b/roles/Compute.yaml @@ -7,6 +7,7 @@ CountDefault: 1 # Create external Neutron bridge (unset if using ML2/OVS without DVR) tags: + - compute - external_bridge networks: InternalApi: diff --git a/roles/ComputeAlt.yaml b/roles/ComputeAlt.yaml index 435dadda17..0953287ab2 100644 --- a/roles/ComputeAlt.yaml +++ b/roles/ComputeAlt.yaml @@ -5,6 +5,8 @@ description: | Alternate Compute Node role CountDefault: 0 + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeDVR.yaml b/roles/ComputeDVR.yaml index 8026caac26..5b23f9010e 100644 --- a/roles/ComputeDVR.yaml +++ b/roles/ComputeDVR.yaml @@ -6,6 +6,7 @@ DVR enabled Compute Node role CountDefault: 1 tags: + - compute - external_bridge networks: InternalApi: diff --git a/roles/ComputeHCI.yaml b/roles/ComputeHCI.yaml index 5051ca6add..842d28a9b7 100644 --- a/roles/ComputeHCI.yaml +++ b/roles/ComputeHCI.yaml @@ -4,6 +4,8 @@ - name: ComputeHCI description: | Compute Node role hosting Ceph OSD too + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeHCIOvsDpdk.yaml b/roles/ComputeHCIOvsDpdk.yaml index 58edb3162b..2361016d5f 100644 --- a/roles/ComputeHCIOvsDpdk.yaml +++ b/roles/ComputeHCIOvsDpdk.yaml @@ -4,6 +4,9 @@ - name: ComputeHCIOvsDpdk description: | ComputeOvsDpdk Node role hosting Ceph OSD too + tags: + - compute + - dpdk networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeHCISriov.yaml b/roles/ComputeHCISriov.yaml index 164ed69658..c49a57d48e 100644 --- a/roles/ComputeHCISriov.yaml +++ b/roles/ComputeHCISriov.yaml @@ -4,6 +4,8 @@ - name: ComputeHCISriov description: | Compute Node with SR-IOV role hosting Ceph OSD too + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeInstanceHA.yaml b/roles/ComputeInstanceHA.yaml index 8dceb8ce7d..0eebeedf79 100644 --- a/roles/ComputeInstanceHA.yaml +++ b/roles/ComputeInstanceHA.yaml @@ -5,6 +5,8 @@ description: | Compute Instance HA Node role to be used with -e environments/compute-instanceha.yaml CountDefault: 1 + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeLiquidio.yaml b/roles/ComputeLiquidio.yaml index 356a21b511..5607c7f463 100644 --- a/roles/ComputeLiquidio.yaml +++ b/roles/ComputeLiquidio.yaml @@ -5,6 +5,8 @@ description: | Compute Node with Cavium Liquidio smart NIC CountDefault: 1 + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeLocalEphemeral.yaml b/roles/ComputeLocalEphemeral.yaml index 75d9b4e1d0..9da5bb57bb 100644 --- a/roles/ComputeLocalEphemeral.yaml +++ b/roles/ComputeLocalEphemeral.yaml @@ -7,6 +7,7 @@ CountDefault: 0 # Create external Neutron bridge (unset if using ML2/OVS without DVR) tags: + - compute - external_bridge networks: InternalApi: diff --git a/roles/ComputeOvsDpdk.yaml b/roles/ComputeOvsDpdk.yaml index 9ac3203019..0cb4428781 100644 --- a/roles/ComputeOvsDpdk.yaml +++ b/roles/ComputeOvsDpdk.yaml @@ -5,6 +5,9 @@ description: | Compute OvS DPDK Role CountDefault: 1 + tags: + - compute + - dpdk networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeOvsDpdkRT.yaml b/roles/ComputeOvsDpdkRT.yaml index 2e23becfbf..e39edbef90 100644 --- a/roles/ComputeOvsDpdkRT.yaml +++ b/roles/ComputeOvsDpdkRT.yaml @@ -5,6 +5,9 @@ description: | Compute OvS DPDK RealTime Role CountDefault: 1 + tags: + - compute + - dpdk networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeOvsDpdkSriov.yaml b/roles/ComputeOvsDpdkSriov.yaml index 3bb9477882..9d10535ef8 100644 --- a/roles/ComputeOvsDpdkSriov.yaml +++ b/roles/ComputeOvsDpdkSriov.yaml @@ -5,6 +5,9 @@ description: | Compute role with OvS-DPDK and SR-IOV services CountDefault: 1 + tags: + - compute + - dpdk networks: - InternalApi - Tenant diff --git a/roles/ComputeOvsDpdkSriovRT.yaml b/roles/ComputeOvsDpdkSriovRT.yaml index b2367a2a7d..d16c22f730 100644 --- a/roles/ComputeOvsDpdkSriovRT.yaml +++ b/roles/ComputeOvsDpdkSriovRT.yaml @@ -5,6 +5,9 @@ description: | Compute Realtime role with OvS-DPDK and SR-IOV services CountDefault: 1 + tags: + - compute + - dpdk networks: - InternalApi - Tenant diff --git a/roles/ComputePPC64LE.yaml b/roles/ComputePPC64LE.yaml index 3d20c68f1f..b426c03c28 100644 --- a/roles/ComputePPC64LE.yaml +++ b/roles/ComputePPC64LE.yaml @@ -5,6 +5,8 @@ description: | Basic Compute Node role for ppc64le servers CountDefault: 0 + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeRBDEphemeral.yaml b/roles/ComputeRBDEphemeral.yaml index b835680378..25fce62ac5 100644 --- a/roles/ComputeRBDEphemeral.yaml +++ b/roles/ComputeRBDEphemeral.yaml @@ -7,6 +7,7 @@ CountDefault: 0 # Create external Neutron bridge (unset if using ML2/OVS without DVR) tags: + - compute - external_bridge networks: InternalApi: diff --git a/roles/ComputeRealTime.yaml b/roles/ComputeRealTime.yaml index 39739561f3..075d0b0006 100644 --- a/roles/ComputeRealTime.yaml +++ b/roles/ComputeRealTime.yaml @@ -9,6 +9,8 @@ and NovaComputeCpuSharedSet are set according to the hardware of the real-time compute nodes. CountDefault: 1 + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeSriov.yaml b/roles/ComputeSriov.yaml index af2b86f317..b5fa6fc761 100644 --- a/roles/ComputeSriov.yaml +++ b/roles/ComputeSriov.yaml @@ -5,6 +5,8 @@ description: | Compute SR-IOV Role CountDefault: 1 + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeSriovIB.yaml b/roles/ComputeSriovIB.yaml index fcb9414464..4b16e1e40b 100644 --- a/roles/ComputeSriovIB.yaml +++ b/roles/ComputeSriovIB.yaml @@ -5,6 +5,8 @@ description: | Compute SR-IOV Infiniband Role CountDefault: 1 + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ComputeSriovRT.yaml b/roles/ComputeSriovRT.yaml index 989a285c65..1d4095acf5 100644 --- a/roles/ComputeSriovRT.yaml +++ b/roles/ComputeSriovRT.yaml @@ -5,6 +5,8 @@ description: | Compute SR-IOV RealTime Role CountDefault: 1 + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/DistributedCompute.yaml b/roles/DistributedCompute.yaml index c4e40f29b9..6e5335ae6e 100644 --- a/roles/DistributedCompute.yaml +++ b/roles/DistributedCompute.yaml @@ -5,6 +5,8 @@ description: | Distributed Compute Node role with Glance. CountDefault: 1 + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/DistributedComputeHCI.yaml b/roles/DistributedComputeHCI.yaml index cffb079d1a..38101e6844 100644 --- a/roles/DistributedComputeHCI.yaml +++ b/roles/DistributedComputeHCI.yaml @@ -4,6 +4,8 @@ - name: DistributedComputeHCI description: | Distributed Compute Node role with Ceph, Cinder volume, and Glance. + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/DistributedComputeHCIScaleOut.yaml b/roles/DistributedComputeHCIScaleOut.yaml index 51ecce6a5f..806de74963 100644 --- a/roles/DistributedComputeHCIScaleOut.yaml +++ b/roles/DistributedComputeHCIScaleOut.yaml @@ -4,6 +4,8 @@ - name: DistributedComputeHCIScaleOut description: | Distributed Compute Node role with CephOSD and HAproxy for Glance. + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/DistributedComputeScaleOut.yaml b/roles/DistributedComputeScaleOut.yaml index 8b8842d487..62c7f5f6d3 100644 --- a/roles/DistributedComputeScaleOut.yaml +++ b/roles/DistributedComputeScaleOut.yaml @@ -5,6 +5,8 @@ description: | Distributed Compute Node role with HAproxy for Glance. CountDefault: 1 + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/HciCephAll.yaml b/roles/HciCephAll.yaml index 0e389a8eba..b0b946825d 100644 --- a/roles/HciCephAll.yaml +++ b/roles/HciCephAll.yaml @@ -4,6 +4,8 @@ - name: HciCephAll description: | HCI Full Stack Role (OSD + MON + Nova + RGW + MDS + MGR + RBD Mirroring + Dashboard) + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/HciCephFile.yaml b/roles/HciCephFile.yaml index 8bddab4c8b..5f3d7767e1 100644 --- a/roles/HciCephFile.yaml +++ b/roles/HciCephFile.yaml @@ -4,6 +4,8 @@ - name: HciCephFile description: | HCI Scale-out File Role (OSD + Nova + MDS) + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/HciCephMon.yaml b/roles/HciCephMon.yaml index a0f16f60bc..b38f4eb6df 100644 --- a/roles/HciCephMon.yaml +++ b/roles/HciCephMon.yaml @@ -4,6 +4,8 @@ - name: HciCephMon description: | HCI Scale-out Block Full Role (OSD + MON + MGR + Nova) + tags: + - compute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/HciCephObject.yaml b/roles/HciCephObject.yaml index e20b47c8ab..a7d6578431 100644 --- a/roles/HciCephObject.yaml +++ b/roles/HciCephObject.yaml @@ -4,6 +4,8 @@ - name: HciCephObject description: | HCI Scale-out Object Role (OSD + Nova + RGW) + tags: + - computecompute networks: InternalApi: subnet: internal_api_subnet diff --git a/roles/ObjectStorage.yaml b/roles/ObjectStorage.yaml index ff1fe204ea..cb7d79bd15 100644 --- a/roles/ObjectStorage.yaml +++ b/roles/ObjectStorage.yaml @@ -4,6 +4,8 @@ - name: ObjectStorage description: | Swift Object Storage node role + tags: + - storage networks: InternalApi: subnet: internal_api_subnet diff --git a/roles_data.yaml b/roles_data.yaml index 92c1bea4da..eefed58051 100644 --- a/roles_data.yaml +++ b/roles_data.yaml @@ -196,6 +196,7 @@ CountDefault: 1 # Create external Neutron bridge (unset if using ML2/OVS without DVR) tags: + - compute - external_bridge networks: InternalApi: @@ -273,6 +274,8 @@ - name: BlockStorage description: | Cinder Block Storage node role + tags: + - storage networks: InternalApi: subnet: internal_api_subnet @@ -320,6 +323,8 @@ - name: ObjectStorage description: | Swift Object Storage node role + tags: + - storage networks: InternalApi: subnet: internal_api_subnet @@ -374,6 +379,9 @@ - name: CephStorage description: | Ceph OSD Storage node role + tags: + - ceph + - storage networks: Storage: subnet: storage_subnet diff --git a/tools/process-templates.py b/tools/process-templates.py index 0bb8780259..7eafcc4774 100755 --- a/tools/process-templates.py +++ b/tools/process-templates.py @@ -106,6 +106,47 @@ def _j2_render_to_file(j2_template, j2_data, outfile_name=None, out_f.write(r_template) +def _set_tags_based_on_role_name(role_data): + for role in role_data: + role['tags'] = role.get('tags', []) + role_name = role.get('name', str()) + + if ((role_name.startswith('Compute') or role_name.startswith('HciCeph') + or role_name.startswith('DistributedCompute')) + and 'compute' not in role['tags']): + role['tags'].append('compute') + print("DEPRECATED: Role '%s' without the 'compute' tag " + "detected, the tag was added automatically. Please " + "add the 'compute' tag in roles data. The function to " + "automatically add tags based on role name will be " + "removed in the next release." % role_name) + if role_name.startswith('Ceph') and 'ceph' not in role['tags']: + role['tags'].append('ceph') + print("DEPRECATED: Role '%s' without the 'ceph' tag " + "detected, the tag was added automatically. Please " + "add the 'ceph' tag in roles data. The function to " + "automatically add tags based on role name will be " + "removed in the next release." % role_name) + if (role_name.startswith('ComputeOvsDpdk') + and 'ovsdpdk' not in role['tags']): + role['tags'].append('ovsdpdk') + print("DEPRECATED: Role '%s' without the 'ovsdpdk' tag " + "detected, the tag was added automatically. Please " + "add the 'ovsdpdk' tag in roles data. The function to " + "automatically add tags based on role name will be " + "removed in the next release." % role_name) + if ((role_name.startswith('ObjectStorage') + or role_name.startswith('BlockStorage') + or role_name.startswith('Ceph')) + and 'storage' not in role['tags']): + role['tags'].append('storage') + print("DEPRECATED: Role '%s' without the 'storage' tag " + "detected, the tag was added automatically. Please " + "add the 'storage' tag in roles data. The function to " + "automatically add tags based on role name will be " + "removed in the next release." % role_name) + + def process_templates(template_path, role_data_path, output_dir, network_data_path, overwrite, dry_run): @@ -128,6 +169,10 @@ def process_templates(template_path, role_data_path, output_dir, raise RuntimeError('Output dir %s is not a directory' % output_dir) os.mkdir(output_dir) + # TODO(hjensas): In next release remove the function to automatically add + # tags based on role name. + _set_tags_based_on_role_name(role_data) + role_names = [r.get('name') for r in role_data] r_map = {} for r in role_data: @@ -204,7 +249,8 @@ def process_templates(template_path, role_data_path, output_dir, '.yaml')]) out_f_path = os.path.join(out_dir, out_f) if ('network/config' in file_path and - r_map[role].get('deprecated_nic_config_name')): + r_map[role].get( + 'deprecated_nic_config_name')): d_name = r_map[role].get( 'deprecated_nic_config_name') out_f_path = os.path.join(out_dir, d_name)