1 heat_template_version: pike
4 All configurations which require reboot should be initiated via PreNetworkConfig. After
5 this configuration is completed, the corresponding node will be rebooted.
12 description: Parameters specific to the role
15 type: comma_delimited_list
19 description: Whether or not to configure enable DPDK in OVS
23 List of cores to be used for DPDK lcore threads. Note, these threads
24 are used by the OVS control path for validator and handling functions.
27 - allowed_pattern: "[0-9,-]*"
29 OvsDpdkMemoryChannels:
30 description: Number of memory channels per socket to be used for DPDK
33 - allowed_pattern: "[0-9]*"
38 Sets the amount of hugepage memory to assign per NUMA node. It is
39 recommended to use the socket closest to the PCIe slot used for the
40 desired DPDK NIC. The format should be in "<socket 0 mem>, <socket 1
41 mem>, <socket n mem>", where the value is specified in MB. For example:
46 A list or range of CPU cores for PMD threads to be pinned to. Note, NIC
47 location to cores on socket, number of hyper-threaded logical cores, and
48 desired number of PMD threads can all play a role in configuring this
49 setting. These cores should be on the same socket where
50 OvsDpdkSocketMemory is assigned. If using hyperthreading then specify
51 both logical cores that would equal the physical core. Also, specifying
52 more than one core will trigger multiple PMD threads to be spawned which
53 may improve dataplane performance.
55 - allowed_pattern: "[0-9,-]*"
59 default: ['CREATE', 'UPDATE']
60 type: comma_delimited_list
62 List of stack actions that will trigger any deployments in this
63 templates. The actions will be an empty list of the server is in the
64 toplevel DeploymentServerBlacklist parameter's value.
65 EnableDpdkDeploymentActions:
67 type: comma_delimited_list
69 Exposing the DPDK deployment action, it may be required to run DPDK
70 config during an upgrade. By default DPDK will be enabled during the
71 CREATE action only. But on cases when it requires for certain migration,
72 it may be required to run it for UPDATE action too.
73 # DEPRECATED: the following options are deprecated and are currently maintained
74 # for backwards compatibility. They will be removed in the Queens cycle.
76 description: List of cores to be used for host process
79 - allowed_pattern: "[0-9,-]+"
82 description: List of cores to be used for DPDK Poll Mode Driver
85 - allowed_pattern: "[0-9,-]*"
87 NeutronDpdkMemoryChannels:
88 description: Number of memory channels to be used for DPDK
91 - allowed_pattern: "[0-9]*"
93 NeutronDpdkSocketMemory:
95 description: Memory allocated for each socket
99 is_host_config_required: {not: {equals: [{get_param: [RoleParameters, KernelArgs]}, ""]}}
100 is_dpdk_config_required:
103 expression: $.data.service_names.contains('neutron_ovs_dpdk_agent')
105 service_names: {get_param: ServiceNames}
106 - {equals: [{get_param: [RoleParameters, OvsEnableDpdk]}, true]}
107 is_reboot_config_required:
109 - is_host_config_required
110 - is_dpdk_config_required
111 l_cores_empty: {equals: [{get_param: OvsDpdkCoreList}, '']}
112 pmd_cores_empty: {equals: [{get_param: OvsPmdCoreList}, '']}
113 mem_channels_empty: {equals: [{get_param: OvsDpdkMemoryChannels}, '']}
114 socket_mem_empty: {equals: [{get_param: OvsDpdkSocketMemory}, '']}
115 deployment_actions_empty:
117 - {get_param: deployment_actions}
122 type: OS::Heat::Value
128 - OvsDpdkCoreList: OvsDpdkCoreList
129 OvsDpdkMemoryChannels: OvsDpdkMemoryChannels
130 OvsDpdkSocketMemory: OvsDpdkSocketMemory
131 OvsPmdCoreList: OvsPmdCoreList
132 - values: {get_param: [RoleParameters]}
134 OvsDpdkCoreList: {if: [l_cores_empty, {get_param: HostCpusList}, {get_param: OvsDpdkCoreList}]}
135 OvsDpdkMemoryChannels: {if: [mem_channels_empty, {get_param: NeutronDpdkMemoryChannels}, {get_param: OvsDpdkMemoryChannels}]}
136 OvsDpdkSocketMemory: {if: [socket_mem_empty, {get_param: NeutronDpdkSocketMemory}, {get_param: OvsDpdkSocketMemory}]}
137 OvsPmdCoreList: {if: [pmd_cores_empty, {get_param: NeutronDpdkCoreList}, {get_param: OvsPmdCoreList}]}
139 HostParametersConfig:
140 type: OS::Heat::SoftwareConfig
141 condition: is_host_config_required
145 - name: _KERNEL_ARGS_
146 - name: _TUNED_PROFILE_NAME_
147 - name: _TUNED_CORES_
151 get_file: ansible_host_config.yaml
153 HostParametersDeployment:
154 type: OS::Heat::SoftwareDeployment
155 condition: is_host_config_required
157 name: HostParametersDeployment
158 server: {get_param: server}
159 config: {get_resource: HostParametersConfig}
162 - deployment_actions_empty
164 - ['CREATE'] # Only do this on CREATE
166 _KERNEL_ARGS_: {get_param: [RoleParameters, KernelArgs]}
167 _TUNED_PROFILE_NAME_: {get_param: [RoleParameters, TunedProfileName]}
168 _TUNED_CORES_: {get_param: [RoleParameters, IsolCpusList]}
171 type: OS::Heat::SoftwareConfig
172 condition: is_reboot_config_required
177 # Stop os-collect-config to avoid any race collecting another
178 # deployment before reboot happens
179 systemctl stop os-collect-config.service
183 type: OS::Heat::SoftwareDeployment
184 depends_on: HostParametersDeployment
185 condition: is_reboot_config_required
187 name: RebootDeployment
188 server: {get_param: server}
189 config: {get_resource: RebootConfig}
192 - deployment_actions_empty
194 - ['CREATE'] # Only do this on CREATE
195 signal_transport: NO_SIGNAL
197 # With OvS2.7 (which is default with pike), ovs-vswitchd will start dpdk
198 # immediately after setting dpdk-init (behaviour change from ovs2.6).
199 # Starting of DPDK require the huge page configuration to be enabled. So
200 # reboot will happen before DPDK config and we don't need an explicity
201 # restart after dpdk-init as true because of the behavior change.
202 # TODO(skramaja): Dependency is that till the service file workaround, is
203 # maintained, restart of ovs is required.
205 type: OS::Heat::SoftwareConfig
206 condition: is_dpdk_config_required
215 # OvS Permission issue temporary workaround
216 # https://bugzilla.redhat.com/show_bug.cgi?id=1459436
217 # Actual solution from openvswitch - https://mail.openvswitch.org/pipermail/ovs-dev/2017-June/333423.html
218 ovs_service_path="/usr/lib/systemd/system/ovs-vswitchd.service"
220 if grep -q 'RuntimeDirectoryMode' $ovs_service_path; then
221 sed -i 's/RuntimeDirectoryMode=.*/RuntimeDirectoryMode=0775/' $ovs_service_path
223 echo "RuntimeDirectoryMode=0775" >> $ovs_service_path
226 if ! grep -Fxq "Group=qemu" $ovs_service_path ; then
227 echo "Group=qemu" >> $ovs_service_path
230 if ! grep -Fxq "UMask=0002" $ovs_service_path ; then
231 echo "UMask=0002" >> $ovs_service_path
234 ovs_ctl_path='/usr/share/openvswitch/scripts/ovs-ctl'
235 if ! grep -q "umask 0002 \&\& start_daemon \"\$OVS_VSWITCHD_PRIORITY\"" $ovs_ctl_path ; then
236 sed -i 's/start_daemon \"\$OVS_VSWITCHD_PRIORITY\"/umask 0002 \&\& start_daemon \"$OVS_VSWITCHD_PRIORITY\"/' $ovs_ctl_path
239 systemctl daemon-reload
240 systemctl restart openvswitch
242 # DO NOT use --detailed-exitcodes
243 puppet apply --logdest console \
244 --modulepath /etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules \
246 class {"vswitch::dpdk":
247 host_core_list => "$HOST_CORES",
248 pmd_core_list => "$PMD_CORES",
249 memory_channels => "$MEMORY_CHANNELS",
250 socket_mem => "$SOCKET_MEMORY",
254 $HOST_CORES: {get_attr: [RoleParametersValue, value, OvsDpdkCoreList]}
255 $PMD_CORES: {get_attr: [RoleParametersValue, value, OvsPmdCoreList]}
256 $MEMORY_CHANNELS: {get_attr: [RoleParametersValue, value, OvsDpdkMemoryChannels]}
257 $SOCKET_MEMORY: {get_attr: [RoleParametersValue, value, OvsDpdkSocketMemory]}
259 EnableDpdkDeployment:
260 type: OS::Heat::SoftwareDeployment
261 condition: is_dpdk_config_required
262 depends_on: RebootDeployment
264 name: EnableDpdkDeployment
265 server: {get_param: server}
266 config: {get_resource: EnableDpdkConfig}
269 - deployment_actions_empty
271 - {get_param: EnableDpdkDeploymentActions}
275 condition: is_host_config_required
277 get_attr: [HostParametersDeployment, result]
279 condition: is_host_config_required
281 get_attr: [HostParametersDeployment, deploy_stdout]
283 condition: is_host_config_required
285 get_attr: [HostParametersDeployment, deploy_stderr]
287 condition: is_host_config_required
289 get_attr: [HostParametersDeployment, deploy_status_code]