Enable DPDK on boot using PreNetworkConfig

DPDK has to be enabled on openvswitch on the boot before
configuring the network as when the network uses DPDK ports
OvS should be ready to handle DPDK. Enabled DPDK via
PreNetworkConfig by checking if ServiceNames contains
DPDK service.
Implements: blueprint ovs-2-6-dpdk
Closes-Bug: #1654975

Depends-On: I83a540336c01a696780621fb2b39486a6abf0917
Change-Id: I7af4534d91e67c94ba559b78b9ac6a001e639db3
This commit is contained in:
Saravanan KR 2017-05-24 11:28:37 +05:30
parent 7b60e56c0e
commit 4e19c7a13e
8 changed files with 109 additions and 2 deletions

View File

@ -11,11 +11,68 @@ parameters:
type: json type: json
description: Role Specific parameters description: Role Specific parameters
default: {} default: {}
ServiceNames:
type: comma_delimited_list
default: []
HostCpusList:
default: "0"
description: List of cores to be used for host process
type: string
constraints:
- allowed_pattern: "[0-9,-]+"
NeutronDpdkCoreList:
default: ""
description: List of cores to be used for DPDK Poll Mode Driver
type: string
constraints:
- allowed_pattern: "[0-9,-]*"
NeutronDpdkMemoryChannels:
default: ""
description: Number of memory channels to be used for DPDK
type: string
constraints:
- allowed_pattern: "[0-9]*"
NeutronDpdkSocketMemory:
default: ""
description: Memory allocated for each socket
type: string
NeutronDpdkDriverType:
default: "vfio-pci"
description: DPDK Driver type
type: string
conditions: conditions:
is_host_config_required: {not: {equals: [{get_param: [RoleParameters, KernelArgs]}, ""]}} is_host_config_required: {not: {equals: [{get_param: [RoleParameters, KernelArgs]}, ""]}}
# YAQL is enabled in conditions with https://review.openstack.org/#/c/467506/
is_dpdk_config_required:
yaql:
expression: $.data.service_names.contains('neutron_ovs_dpdk_agent')
data:
service_names: {get_param: ServiceNames}
is_reboot_config_required:
or:
- is_host_config_required
- is_dpdk_config_required
resources: resources:
RoleParametersValue:
type: OS::Heat::Value
properties:
type: json
value:
map_replace:
- map_replace:
- HostCpusList: HostCpusList
NeutronDpdkCoreList: NeutronDpdkCoreList
NeutronDpdkMemoryChannels: NeutronDpdkMemoryChannels
NeutronDpdkSocketMemory: NeutronDpdkSocketMemory
- values: {get_param: [RoleParameters]}
- values:
HostCpusList: {get_param: HostCpusList}
NeutronDpdkCoreList: {get_param: NeutronDpdkCoreList}
NeutronDpdkMemoryChannels: {get_param: NeutronDpdkMemoryChannels}
NeutronDpdkSocketMemory: {get_param: NeutronDpdkSocketMemory}
HostParametersConfig: HostParametersConfig:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
condition: is_host_config_required condition: is_host_config_required
@ -43,9 +100,45 @@ resources:
_TUNED_PROFILE_NAME_: {get_param: [RoleParameters, TunedProfileName]} _TUNED_PROFILE_NAME_: {get_param: [RoleParameters, TunedProfileName]}
_TUNED_CORES_: {get_param: [RoleParameters, HostIsolatedCoreList]} _TUNED_CORES_: {get_param: [RoleParameters, HostIsolatedCoreList]}
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 \
--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, HostCpusList]}
$PMD_CORES: {get_attr: [RoleParametersValue, value, NeutronDpdkCoreList]}
$MEMORY_CHANNELS: {get_attr: [RoleParametersValue, value, NeutronDpdkMemoryChannels]}
$SOCKET_MEMORY: {get_attr: [RoleParametersValue, value, NeutronDpdkSocketMemory]}
EnableDpdkDeployment:
type: OS::Heat::SoftwareDeployment
condition: is_dpdk_config_required
properties:
name: EnableDpdkDeployment
server: {get_param: server}
config: {get_resource: EnableDpdkConfig}
actions: ['CREATE'] # Only do this on CREATE
RebootConfig: RebootConfig:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
condition: is_host_config_required condition: is_reboot_config_required
properties: properties:
group: script group: script
config: | config: |
@ -58,7 +151,7 @@ resources:
RebootDeployment: RebootDeployment:
type: OS::Heat::SoftwareDeployment type: OS::Heat::SoftwareDeployment
depends_on: HostParametersDeployment depends_on: HostParametersDeployment
condition: is_host_config_required condition: is_reboot_config_required
properties: properties:
name: RebootDeployment name: RebootDeployment
server: {get_param: server} server: {get_param: server}

View File

@ -377,6 +377,7 @@ resources:
properties: properties:
server: {get_resource: BlockStorage} server: {get_resource: BlockStorage}
RoleParameters: {get_param: RoleParameters} RoleParameters: {get_param: RoleParameters}
ServiceNames: {get_param: ServiceNames}
NetworkDeployment: NetworkDeployment:
type: OS::TripleO::SoftwareDeployment type: OS::TripleO::SoftwareDeployment

View File

@ -383,6 +383,7 @@ resources:
properties: properties:
server: {get_resource: CephStorage} server: {get_resource: CephStorage}
RoleParameters: {get_param: RoleParameters} RoleParameters: {get_param: RoleParameters}
ServiceNames: {get_param: ServiceNames}
NetworkDeployment: NetworkDeployment:
type: OS::TripleO::SoftwareDeployment type: OS::TripleO::SoftwareDeployment

View File

@ -386,6 +386,7 @@ resources:
properties: properties:
server: {get_resource: NovaCompute} server: {get_resource: NovaCompute}
RoleParameters: {get_param: RoleParameters} RoleParameters: {get_param: RoleParameters}
ServiceNames: {get_param: ServiceNames}
NetworkConfig: NetworkConfig:
type: OS::TripleO::Compute::Net::SoftwareConfig type: OS::TripleO::Compute::Net::SoftwareConfig

View File

@ -406,6 +406,7 @@ resources:
properties: properties:
server: {get_resource: Controller} server: {get_resource: Controller}
RoleParameters: {get_param: RoleParameters} RoleParameters: {get_param: RoleParameters}
ServiceNames: {get_param: ServiceNames}
NetworkConfig: NetworkConfig:
type: OS::TripleO::Controller::Net::SoftwareConfig type: OS::TripleO::Controller::Net::SoftwareConfig

View File

@ -377,6 +377,7 @@ resources:
properties: properties:
server: {get_resource: SwiftStorage} server: {get_resource: SwiftStorage}
RoleParameters: {get_param: RoleParameters} RoleParameters: {get_param: RoleParameters}
ServiceNames: {get_param: ServiceNames}
NetworkDeployment: NetworkDeployment:
type: OS::TripleO::SoftwareDeployment type: OS::TripleO::SoftwareDeployment

View File

@ -399,6 +399,7 @@ resources:
properties: properties:
server: {get_resource: {{role}}} server: {get_resource: {{role}}}
RoleParameters: {get_param: RoleParameters} RoleParameters: {get_param: RoleParameters}
ServiceNames: {get_param: ServiceNames}
NetworkDeployment: NetworkDeployment:
type: OS::TripleO::SoftwareDeployment type: OS::TripleO::SoftwareDeployment

View File

@ -0,0 +1,8 @@
---
features:
- DPDK is enabled in OvS before the NetworkDeployment to ensure DPDK
is ready to handle new port additions.
upgrade:
- A new parameter ServiceNames is added to the PreNeworkConfig resource.
All templates associated with PreNeworkConfig should add this new
parameter during the upgrade.