159 lines
6.0 KiB
YAML
159 lines
6.0 KiB
YAML
---
|
|
# Copyright 2020 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
- name: extract number of physical cores per numa node
|
|
set_fact:
|
|
num_phy_cores_per_numa_node_for_pmd: "{{ num_phy_cores_per_numa_node_for_pmd | default(2) }}"
|
|
|
|
- name: Get dpdk nics numa info
|
|
tripleo_get_dpdk_nics_numa_info:
|
|
container: "{{ tripleo_plan_name }}"
|
|
role_name: "{{ tripleo_role_name }}"
|
|
inspect_data: "{{ hw_data }}"
|
|
mtu_default: 1500
|
|
register: dpdk_nics_numa_info
|
|
|
|
- name: Fail if unable to determine DPDK NICs NUMA information
|
|
when: "{{ not dpdk_nics_numa_info.dpdk_nics_numa_info }}"
|
|
fail:
|
|
msg: "Unable to determine DPDK NIC's NUMA information for role: {{ tripleo_role_name }}"
|
|
|
|
- name: Get dpdk nics numa nodes
|
|
set_fact:
|
|
dpdk_nics_numa_nodes: >-
|
|
{{ dpdk_nics_numa_nodes | default([]) }} + {{ [item[0]] }}
|
|
loop: "{{ dpdk_nics_numa_info.dpdk_nics_numa_info | groupby('numa_node') | sort }}"
|
|
|
|
- name: Get numa nodes
|
|
set_fact:
|
|
numa_nodes: >-
|
|
{{ numa_nodes | default([]) }} + {{ [item.numa_node] }}
|
|
loop: "{{ hw_data.numa_topology.ram }}"
|
|
|
|
- name: Get sorted numa nodes
|
|
set_fact:
|
|
sorted_numa_nodes: "{{ numa_nodes | sort }}"
|
|
|
|
- name: Get number of cores per numa nodes
|
|
set_fact:
|
|
num_cores_per_numa_nodes: "{{
|
|
num_cores_per_numa_nodes |
|
|
default([]) }} + [{% if item in dpdk_nics_numa_nodes %} {{ num_phy_cores_per_numa_node_for_pmd }} {% else %} {{ 1 }} {% endif %}]"
|
|
loop: "{{ sorted_numa_nodes }}"
|
|
|
|
- name: Get pmd cpus in string format
|
|
tripleo_get_dpdk_core_list.py:
|
|
inspect_data: "{{ hw_data }}"
|
|
numa_nodes_cores_count: "{{ num_cores_per_numa_nodes }}"
|
|
register: dpdk_core_list
|
|
|
|
- name: Fail if unable to determine PMD CPU's
|
|
when: "{{ not dpdk_core_list.dpdk_core_list }}"
|
|
fail:
|
|
msg: "Unable to determine OvsPmdCoreList parameter for role: {{ tripleo_role_name }}"
|
|
|
|
- name: Convert pmd cpus in range list
|
|
set_fact:
|
|
pmd_cpus: "{{ dpdk_core_list.dpdk_core_list | range_list }}"
|
|
|
|
- name: Get host cpus list
|
|
tripleo_get_host_cpus:
|
|
inspect_data: "{{ hw_data }}"
|
|
register: host_cpus_list
|
|
|
|
- name: Fail if unable to determine Host CPU's
|
|
when: "{{ not host_cpus_list.host_cpus_list }}"
|
|
fail:
|
|
msg: "Unable to determine OvsDpdkCoreList parameter for role: {{ tripleo_role_name }}"
|
|
|
|
- name: Convert host cpus in range list
|
|
set_fact:
|
|
host_cpus: "{{ host_cpus_list.host_cpus_list | range_list}}"
|
|
|
|
- name: Get dpdk socket memory
|
|
tripleo_get_dpdk_socket_memory:
|
|
dpdk_nics_numa_info: "{{ dpdk_nics_numa_info.dpdk_nics_numa_info }}"
|
|
numa_nodes: "{{ sorted_numa_nodes }}"
|
|
overhead: "{{ overhead | default(800) }}"
|
|
packet_size_in_buffer: "{{ 4096 * 64 }}"
|
|
minimum_socket_memory: 1024
|
|
register: socket_memory
|
|
|
|
- name: Fail if unable to determine DPDK socket memory
|
|
when: "{{ not socket_memory.socket_memory }}"
|
|
fail:
|
|
msg: "Unable to determine OvsDpdkSocketMemory parameter for role: {{ tripleo_role_name }}"
|
|
|
|
- name: Get neutron bridge mappings
|
|
set_fact:
|
|
neutron_bridge_mappings: |-
|
|
{% set params = tripleo_heat_resource_tree.parameters.get('NeutronBridgeMappings', {}) %}
|
|
{{ params.get('default', {}) }}
|
|
|
|
- name: Get the physical network and ovs bridge mappings
|
|
set_fact:
|
|
phy_nw_bridge_mappings: "{{ (phy_nw_bridge_mappings | default({})) | combine({item.split(':')[0]: item.split(':')[1]}) }}"
|
|
loop: "{{ neutron_bridge_mappings.split(',') }}"
|
|
|
|
- name: Get the ovs bridge and NUMA nodes mappings
|
|
set_fact:
|
|
bridge_numa_nodes_mappings: "{{ (bridge_numa_nodes_mappings | default({})) | combine({item[0]: item[1] | map(attribute='numa_node') | list }) }}"
|
|
loop: "{{ dpdk_nics_numa_info.dpdk_nics_numa_info | groupby('bridge_name') }}"
|
|
|
|
- name: Get the physical network and NUMA nodes mappings
|
|
set_fact:
|
|
phy_nw_numa_nodes_mappings: "{{
|
|
(phy_nw_numa_nodes_mappings |
|
|
default([])) + [{(phy_nw_bridge_mappings | dict2items | selectattr('value', 'equalto', item.key) | list)[0].key: item.value}]
|
|
}}"
|
|
with_dict: "{{ bridge_numa_nodes_mappings }}"
|
|
|
|
- name: Get neutron network type
|
|
set_fact:
|
|
neutron_network_type: |-
|
|
{% set params = tripleo_heat_resource_tree.parameters.get('NeutronNetworkType', {}) %}
|
|
{{ params.get('default', '') }}
|
|
|
|
- name: Get tunnel numa nodes mappings
|
|
set_fact:
|
|
tunnel_numa_nodes_mappings: |-
|
|
{{ tunnel_numa_nodes_mappings | default([]) }} + [{{ item.numa_node }}]
|
|
loop: "{{ dpdk_nics_numa_info.dpdk_nics_numa_info }}"
|
|
when: "{{' vxlan' in neutron_network_type and item.addresses.ip_netmask is defined and item.addresses.ip_netmask }}"
|
|
|
|
- name: Get dpdk parameters in dictionary format
|
|
set_fact:
|
|
dpdk_parameters: "{{ (dpdk_parameters | default({})) | combine({item.key: item.value}) }}"
|
|
with_dict: {
|
|
'OvsPmdCoreList': '{{ pmd_cpus }}',
|
|
'OvsDpdkCoreList': '{{ host_cpus }}',
|
|
'OvsDpdkSocketMemory': '{{ socket_memory.socket_memory }}'
|
|
}
|
|
|
|
- name: Add physical network and NUMA nodes mappings in dpdk parameters
|
|
set_fact:
|
|
dpdk_parameters: "{{ dpdk_parameters | combine({'NeutronPhysnetNUMANodesMapping': phy_nw_numa_nodes_mappings}) }}"
|
|
when: "{{ phy_nw_numa_nodes_mappings is defined }}"
|
|
|
|
- name: Add tunnel numa nodes mappings in dpdk parameters
|
|
set_fact:
|
|
dpdk_parameters: "{{ dpdk_parameters | combine({'NeutronTunnelNUMANodes': tunnel_numa_nodes_mappings}) }}"
|
|
when: "{{ tunnel_numa_nodes_mappings is defined }}"
|
|
|
|
- name: Update dpdk parameters in derived parameters dictionary
|
|
set_fact:
|
|
derived_parameters: "{{ (derived_parameters | default({})) | combine({(tripleo_role_name + 'Parameters'): dpdk_parameters}) }}"
|