Merge "Use tags instead of role names"

This commit is contained in:
Zuul 2020-10-16 00:50:59 +00:00 committed by Gerrit Code Review
commit 05231ddd98
43 changed files with 161 additions and 14 deletions

View File

@ -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:

View File

@ -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}

View File

@ -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

View File

@ -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

View File

@ -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}

View File

@ -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}

View File

@ -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') }}

View File

@ -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.

View File

@ -4,6 +4,8 @@
- name: BlockStorage
description: |
Cinder Block Storage node role
tags:
- storage
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -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

View File

@ -4,6 +4,9 @@
- name: CephFile
description: |
Standalone Scale-out File Role (OSD + MDS)
tags:
- ceph
- storage
networks:
Storage:
subnet: storage_subnet

View File

@ -4,6 +4,9 @@
- name: CephObject
description: |
Standalone Scale-out Object Role (OSD + RGW)
tags:
- ceph
- storage
networks:
Storage:
subnet: storage_subnet

View File

@ -4,6 +4,9 @@
- name: CephStorage
description: |
Ceph OSD Storage node role
tags:
- ceph
- storage
networks:
Storage:
subnet: storage_subnet

View File

@ -7,6 +7,7 @@
CountDefault: 1
# Create external Neutron bridge (unset if using ML2/OVS without DVR)
tags:
- compute
- external_bridge
networks:
InternalApi:

View File

@ -5,6 +5,8 @@
description: |
Alternate Compute Node role
CountDefault: 0
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -6,6 +6,7 @@
DVR enabled Compute Node role
CountDefault: 1
tags:
- compute
- external_bridge
networks:
InternalApi:

View File

@ -4,6 +4,8 @@
- name: ComputeHCI
description: |
Compute Node role hosting Ceph OSD too
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -4,6 +4,9 @@
- name: ComputeHCIOvsDpdk
description: |
ComputeOvsDpdk Node role hosting Ceph OSD too
tags:
- compute
- dpdk
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -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

View File

@ -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

View File

@ -5,6 +5,8 @@
description: |
Compute Node with Cavium Liquidio smart NIC
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -7,6 +7,7 @@
CountDefault: 0
# Create external Neutron bridge (unset if using ML2/OVS without DVR)
tags:
- compute
- external_bridge
networks:
InternalApi:

View File

@ -5,6 +5,9 @@
description: |
Compute OvS DPDK Role
CountDefault: 1
tags:
- compute
- dpdk
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -5,6 +5,9 @@
description: |
Compute OvS DPDK RealTime Role
CountDefault: 1
tags:
- compute
- dpdk
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -5,6 +5,9 @@
description: |
Compute role with OvS-DPDK and SR-IOV services
CountDefault: 1
tags:
- compute
- dpdk
networks:
- InternalApi
- Tenant

View File

@ -5,6 +5,9 @@
description: |
Compute Realtime role with OvS-DPDK and SR-IOV services
CountDefault: 1
tags:
- compute
- dpdk
networks:
- InternalApi
- Tenant

View File

@ -5,6 +5,8 @@
description: |
Basic Compute Node role for ppc64le servers
CountDefault: 0
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -7,6 +7,7 @@
CountDefault: 0
# Create external Neutron bridge (unset if using ML2/OVS without DVR)
tags:
- compute
- external_bridge
networks:
InternalApi:

View File

@ -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

View File

@ -5,6 +5,8 @@
description: |
Compute SR-IOV Role
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -5,6 +5,8 @@
description: |
Compute SR-IOV Infiniband Role
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -5,6 +5,8 @@
description: |
Compute SR-IOV RealTime Role
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -5,6 +5,8 @@
description: |
Distributed Compute Node role with Glance.
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -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

View File

@ -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

View File

@ -5,6 +5,8 @@
description: |
Distributed Compute Node role with HAproxy for Glance.
CountDefault: 1
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -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

View File

@ -4,6 +4,8 @@
- name: HciCephFile
description: |
HCI Scale-out File Role (OSD + Nova + MDS)
tags:
- compute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -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

View File

@ -4,6 +4,8 @@
- name: HciCephObject
description: |
HCI Scale-out Object Role (OSD + Nova + RGW)
tags:
- computecompute
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -4,6 +4,8 @@
- name: ObjectStorage
description: |
Swift Object Storage node role
tags:
- storage
networks:
InternalApi:
subnet: internal_api_subnet

View File

@ -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

View File

@ -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)