tripleo-heat-templates/extraconfig/pre_network/host_config_and_reboot.yaml
Saravanan KR 7d18d96a4e Add DPDK support for OVN
Add a service to enable DPDK on the compute nodes,
along with OVN.

Change-Id: I4473f1dfef9eebb886823fb2f436d14dd5b6d5ad
Depends-On: Idf81990d4075f4332d99326170ed733452a85cab
Depends-On: I7e098075580721dfb7d3fb4b696ca8d33743ef84
(cherry picked from commit fca0945708)
2019-06-03 21:54:23 +00:00

164 lines
5.9 KiB
YAML

heat_template_version: rocky
description: >
All configurations which require reboot should be initiated via PreNetworkConfig. After
this configuration is completed, the corresponding node will be rebooted.
parameters:
server:
type: string
RoleParameters:
type: json
description: Parameters specific to the role
default: {}
ServiceNames:
type: comma_delimited_list
default: []
OvsEnableDpdk:
default: false
description: Whether or not to configure enable DPDK in OVS
type: boolean
tags:
- role_specific
OvsDpdkCoreList:
description: >
List of cores to be used for DPDK lcore threads. Note, these threads
are used by the OVS control path for validator and handling functions.
type: string
constraints:
- allowed_pattern: "[0-9,-]*"
default: ""
tags:
- role_specific
OvsDpdkMemoryChannels:
description: Number of memory channels per socket to be used for DPDK
type: string
constraints:
- allowed_pattern: "[0-9]*"
default: "4"
tags:
- role_specific
OvsDpdkSocketMemory:
default: ""
description: >
Sets the amount of hugepage memory to assign per NUMA node. It is
recommended to use the socket closest to the PCIe slot used for the
desired DPDK NIC. The format should be in "<socket 0 mem>, <socket 1
mem>, <socket n mem>", where the value is specified in MB. For example:
"1024,0".
type: string
tags:
- role_specific
OvsPmdCoreList:
description: >
A list or range of CPU cores for PMD threads to be pinned to. Note, NIC
location to cores on socket, number of hyper-threaded logical cores, and
desired number of PMD threads can all play a role in configuring this
setting. These cores should be on the same socket where
OvsDpdkSocketMemory is assigned. If using hyperthreading then specify
both logical cores that would equal the physical core. Also, specifying
more than one core will trigger multiple PMD threads to be spawned which
may improve dataplane performance.
constraints:
- allowed_pattern: "[0-9,-]*"
type: string
default: ""
tags:
- role_specific
deployment_actions:
default: ['CREATE', 'UPDATE']
type: comma_delimited_list
description: >
List of stack actions that will trigger any deployments in this
templates. The actions will be an empty list of the server is in the
toplevel DeploymentServerBlacklist parameter's value.
EnableDpdkDeploymentActions:
default: ['CREATE']
type: comma_delimited_list
description: >
Exposing the DPDK deployment action, it may be required to run DPDK
config during an upgrade. By default DPDK will be enabled during the
CREATE action only. But on cases when it requires for certain migration,
it may be required to run it for UPDATE action too.
conditions:
is_dpdk_config_required:
or:
- yaql:
expression: $.data.service_names.contains('neutron_ovs_dpdk_agent') or $.data.service_names.contains('neutron_ovn_dpdk')
data:
service_names: {get_param: ServiceNames}
- {equals: [{get_param: [RoleParameters, OvsEnableDpdk]}, true]}
deployment_actions_empty:
equals:
- {get_param: deployment_actions}
- []
resources:
RoleParametersValue:
type: OS::Heat::Value
properties:
type: json
value:
map_replace:
- map_replace:
- OvsDpdkCoreList: OvsDpdkCoreList
OvsDpdkMemoryChannels: OvsDpdkMemoryChannels
OvsDpdkSocketMemory: OvsDpdkSocketMemory
OvsPmdCoreList: OvsPmdCoreList
- values: {get_param: [RoleParameters]}
- values:
OvsDpdkCoreList: {get_param: OvsDpdkCoreList}
OvsDpdkMemoryChannels: {get_param: OvsDpdkMemoryChannels}
OvsDpdkSocketMemory: {get_param: OvsDpdkSocketMemory}
OvsPmdCoreList: {get_param: OvsPmdCoreList}
# With OvS2.7 (which is default with pike), ovs-vswitchd will start dpdk
# immediately after setting dpdk-init (behaviour change from ovs2.6).
# Starting of DPDK require the huge page configuration to be enabled. So
# reboot will happen before DPDK config and we don't need an explicity
# restart after dpdk-init as true because of the behavior change.
# TODO(skramaja): Dependency is that till the service file workaround, is
# maintained, restart of ovs is required.
EnableDpdkConfig:
type: OS::Heat::SoftwareConfig
condition: is_dpdk_config_required
properties:
group: script
config:
str_replace:
template: |
#!/bin/bash
set -x
# DO NOT use --detailed-exitcodes
puppet apply --logdest console --summarize \
--modulepath /etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules \
-e '
class {"vswitch::dpdk":
host_core_list => "$HOST_CORES",
pmd_core_list => "$PMD_CORES",
memory_channels => "$MEMORY_CHANNELS",
socket_mem => "$SOCKET_MEMORY",
}
'
params:
$HOST_CORES: {get_attr: [RoleParametersValue, value, OvsDpdkCoreList]}
$PMD_CORES: {get_attr: [RoleParametersValue, value, OvsPmdCoreList]}
$MEMORY_CHANNELS: {get_attr: [RoleParametersValue, value, OvsDpdkMemoryChannels]}
$SOCKET_MEMORY: {get_attr: [RoleParametersValue, value, OvsDpdkSocketMemory]}
EnableDpdkDeployment:
type: OS::Heat::SoftwareDeployment
condition: is_dpdk_config_required
properties:
name: EnableDpdkDeployment
server: {get_param: server}
config: {get_resource: EnableDpdkConfig}
actions:
if:
- deployment_actions_empty
- []
- {get_param: EnableDpdkDeploymentActions}