commit ff4d1fbb66dba0698d890c20985af69dbea170a5 Author: Harald Jensås Date: Mon Oct 12 12:56:24 2020 +0200 Use tags instead of role names Role names can be customized, yet in THT jinja2 we have several places where conditions are based on the role name. By using tag's such as 'storage', 'ceph' and 'ovsdpdk' we the role names become truly customizable. The depends-on change in TripleO common will dynamically add tag's to role's based on role.name for backward compatibility during deprecation period. Depends-On: https://review.opendev.org/758124 Change-Id: I5ab4e4a220294245f95d328391bfffec87781a09 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 0208359..472b23c 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 ed73379..a9456cf 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 05bbb5d..06ce288 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 a0b9a81..3e4b1d4 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 1c13140..9a87e18 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 4e99bba..43e5bc5 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 0107cce..f516583 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 0000000..8faa759 --- /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 6ea9ec3..7ed760e 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 bf7b0bf..73bc6d5 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 11df050..e52885d 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 bdf2119..8c1721a 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 22abc4e..f32647c 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 a0758ff..30d5664 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 435dadd..0953287 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 8026caa..5b23f90 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 5051ca6..842d28a 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 58edb31..2361016 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 164ed69..c49a57d 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 8dceb8c..0eebeed 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 356a21b..5607c7f 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 75d9b4e..9da5bb5 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 9ac3203..0cb4428 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 2e23bec..e39edbe 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 3bb9477..9d10535 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 b2367a2..d16c22f 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 3d20c68..b426c03 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 b835680..25fce62 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 3973956..075d0b0 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 af2b86f..b5fa6fc 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 fcb9414..4b16e1e 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 989a285..1d4095a 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 c4e40f2..6e5335a 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 cffb079..38101e6 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 51ecce6..806de74 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 8b8842d..62c7f5f 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 0e389a8..b0b9468 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 8bddab4..5f3d776 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 a0f16f6..b38f4eb 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 e20b47c..a7d6578 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 ff1fe20..cb7d79b 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 92c1bea..eefed58 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 0bb8780..7eafcc4 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)