-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdpdk.pp
75 lines (68 loc) · 2.12 KB
/
dpdk.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#
# Configure OVS to use DPDK
#
# === Parameters
#
# [*core_list*]
# (required) The list of cores to be used by the DPDK Poll Mode Driver
# The core_list is a string with format as <c1>[-c2][,c3[-c4],...] where c1, c2, etc are core indexes between 0 and 128
# For example, to configure 3 cores the value should be "0-2"
#
# [*memory_channels*]
# (required) The number of memory channels to use as an integer
#
# [*package_ensure*]
# (Optional) State of the openvswitch package
# Defaults to 'present'.
#
# [*socket_mem*]
# (Optional) Set the memory to be allocated on each socket
# The socket_mem is a string with comma separated memory list in MB in the order of socket numbers.
# For example, to allocate memory of 1GB for socket 1 and no allocation for socket 0, the value should be "0,1024"
# Defaults to undef.
#
# [*driver_type*]
# (Optional) The DPDK Driver type
# Defaults to 'vfio-pci'
#
class vswitch::dpdk (
$core_list,
$memory_channels,
$package_ensure = 'present',
$socket_mem = undef,
$driver_type = 'vfio-pci',
) {
include ::vswitch::params
kmod::load { 'vfio-pci': }
package { $::vswitch::params::ovs_dpdk_package_name:
ensure => $package_ensure,
before => Service['openvswitch'],
tag => 'openvswitch',
}
if $driver_type {
$pci_list = inline_template('<%= Facter.value("pci_address_driver_#@driver_type") %>')
}
case $::osfamily {
'Redhat': {
# Set DPDK_OPTIONS to openvswitch
dpdk_options { '/etc/sysconfig/openvswitch':
ensure => present,
path => '/etc/sysconfig/openvswitch',
pci_list => $pci_list,
core_list => $core_list,
socket_memory => $socket_mem,
memory_channels => $memory_channels,
require => Package[$::vswitch::params::ovs_dpdk_package_name],
before => Service['openvswitch']
}
service { 'openvswitch':
ensure => true,
enable => true,
name => $::vswitch::params::ovs_service_name,
}
}
default: {
fail( "${::osfamily} not yet supported for dpdk installation by puppet-vswitch")
}
}
}