-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Partial-Bug: #1533386 Server Manager Support DPDK provisioning"
- Loading branch information
Showing
14 changed files
with
338 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
contrail/environment/modules/contrail/lib/facter/contrail_interfaces.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'facter' | ||
|
||
Facter.add(:contrail_interfaces) do | ||
setcode do | ||
contrail_interfaces = {} | ||
interface_list_str = %x[ifconfig -a | grep HWaddr | awk \'{ print $1 \'}] | ||
intf_list = interface_list_str.split("\n") | ||
|
||
intf_list.each do |intf| | ||
intf_detail = {} | ||
vlan_intf = %x[ip addr show #{intf} | head -1| cut -f2 -d':' | grep -o '@.*'] | ||
if (vlan_intf != "") | ||
intf_detail["vlan"] = true | ||
intf_detail["parent"] = vlan_intf.delete("\n").delete('@') | ||
else | ||
intf_detail["vlan"] = false | ||
pci_address = %x[udevadm info -a -p /sys/class/net/#{intf} | awk -F/ '/device.*eth/ {print $4}'] | ||
intf_detail["pci_address"] = pci_address.delete("\n") | ||
end | ||
contrail_interfaces[intf] = intf_detail | ||
end | ||
contrail_interfaces | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
grep MemTotal /proc/meminfo | tr -s ' ' | cut -d' ' -f 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
grep Hugepagesize /proc/meminfo | tr -s ' ' | cut -d' ' -f 2 |
2 changes: 2 additions & 0 deletions
2
contrail/environment/modules/contrail/lib/facter/reserv_pg.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
grep HugePages_total /proc/meminfo | tr -s ' ' | cut -d' ' -f 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
contrail/environment/modules/contrail/manifests/lib/setup_coremask.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
define contrail::lib::setup_coremask( | ||
$contrail_logoutput = false, | ||
$core_mask= $::contrail::params::core_mask, | ||
$enable_dpdk = $::contrail::params::enable_dpdk, | ||
) { | ||
|
||
if ($enable_dpdk) { | ||
if ( ',' in coremask or '-' in coremask ) { | ||
$taskset_params = " -C" | ||
} else { | ||
$taskset_params = "" | ||
} | ||
|
||
$vrouter_file = '/etc/contrail/supervisord_vrouter_files/contrail-vrouter-dpdk.ini' | ||
|
||
#try startuing a dummy task with coremask, | ||
#if that goes through set in the supervisor file. | ||
exec { 'try_core_mask' : | ||
command => "taskset${taskset_params} ${core_mask} true", | ||
provider => 'shell', | ||
logoutput => $contrail_logoutput | ||
} -> | ||
#unable to use file_line as it works only on whole | ||
#lines and not on wordS | ||
exec { 'change_supervisor' : | ||
command => "sed -i \"s/command=/command=taskset${taskset_params} ${core_mask} /g\" ${vrouter_file}", | ||
provider => 'shell', | ||
logoutput => $contrail_logoutput | ||
} | ||
} | ||
|
||
} |
76 changes: 76 additions & 0 deletions
76
contrail/environment/modules/contrail/manifests/lib/setup_dpdk_depends.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
define contrail::lib::setup_dpdk_depends( | ||
$contrail_logoutput = false, | ||
$enable_dpdk = $::contrail::params::enable_dpdk, | ||
$contrail_repo_name = $::contrail::params::contrail_repo_name, | ||
) | ||
{ | ||
if ($enable_dpdk) { | ||
|
||
if ($::operatingsystem == "Ubuntu") { | ||
|
||
|
||
notify { "settting up DPDK Repo":; } | ||
-> | ||
apt::source { 'contrail-dpdk-depends': | ||
location => "http://puppet/contrail/repo/${contrail_repo_name}/dpdk_depends", | ||
repos => 'main', | ||
release => 'contrail-dpdk-depends', | ||
} | ||
-> | ||
apt::pin { 'contrail-dpdk-depreds-repo_preferences': | ||
priority => '999', | ||
codename => 'contrail-dpdk-depends' | ||
} | ||
|
||
|
||
#for setting up the repo without apt at any stage | ||
#as there given the stages for now | ||
#apt module can only be used in first stage. | ||
|
||
/* | ||
file { '/etc/apt/sources.list.d/contrail_dpdk.list' : | ||
ensure => present, | ||
content => template("${module_name}/contrail_dpdk_depends_sources.list.erb") | ||
} | ||
-> | ||
file { '/etc/apt/preferences.d/contrail_dpdk_preferences.pref' : | ||
ensure => present, | ||
content => template("${module_name}/contrail_dpdk_preferences.pref") | ||
} | ||
-> | ||
exec { 'apt_get_update' : | ||
command => 'apt-get update', | ||
provider => 'shell', | ||
logoutput => $contrail_logoutput | ||
} | ||
*/ | ||
|
||
#for setting up a local repo of dpdk-packages | ||
/* | ||
package { dpdk-depends-packages : | ||
ensure => present, | ||
} | ||
-> | ||
file_line { "add_dpdk_depends": | ||
path => '/etc/apt/sources.list', | ||
line => 'deb file:/opt/contrail/contrail_install_repo_dpdk ./', | ||
} | ||
-> | ||
exec { 'scan_packages' : | ||
command => 'dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz', | ||
provider => 'shell', | ||
cwd => '/opt/contrail/contrail_install_repo_dpdk', | ||
logoutput => $contrail_logoutput, | ||
} | ||
-> | ||
exec { 'apt_get_update' : | ||
command => 'apt-get update', | ||
provider => 'shell', | ||
logoutput => $contrail_logoutput | ||
} | ||
*/ | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.