Skip to content

Commit

Permalink
Closes-Bug: #1546725
Browse files Browse the repository at this point in the history
SM: Need to have support for SROIV provisioning

Support SRIOV provisioning in SM.

Testing:
Provisioned and testbed by launching a SRIOV VM and seeing the vland id
for the VF interface.

Change-Id: I42b9140d163950ac48e5c49268d1ae676e906b17
  • Loading branch information
thilakrajs committed Mar 28, 2016
1 parent 548a9a5 commit 06c2b38
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 1 deletion.
11 changes: 11 additions & 0 deletions contrail/environment/modules/contrail/manifests/compute/config.pp
Expand Up @@ -40,6 +40,7 @@
$xmpp_dns_auth_enable = $::contrail::params::xmpp_dns_auth_enable,
$enable_dpdk= $::contrail::params::enable_dpdk,
$contrail_rabbit_servers = $::contrail::params::contrail_rabbit_servers,
$sriov = $::contrail::params::sriov,
) {
$config_ip_to_use = $::contrail::params::config_ip_to_use
$keystone_ip_to_use = $::contrail::params::keystone_ip_to_use
Expand Down Expand Up @@ -328,6 +329,16 @@
}
}


notify { "sriov = ${sriov}":; }
$sriov_keys = keys($sriov)
if (!empty($sriov)) {
contrail::lib::setup_sriov_wrapper {$sriov_keys:
intf_hash => $sriov,
enable_dpdk => $enable_dpdk,
}
}

contrail_vrouter_agent_config {
'DEFAULT/xmpp_auth_enable' : value => "$xmpp_auth_enable";
'DEFAULT/xmpp_server_cert' : value => "/etc/contrail/ssl/certs/server.pem";
Expand Down
6 changes: 5 additions & 1 deletion contrail/environment/modules/contrail/manifests/init.pp
Expand Up @@ -694,6 +694,8 @@
$contrail_amqp_port = '',
$openstack_amqp_ip_list = '',
$openstack_amqp_port = '',
$sriov = {},
$sriov_enable = false,
) {
class { '::contrail::params':
# Common Parameters
Expand Down Expand Up @@ -778,6 +780,8 @@
contrail_amqp_port => hiera(openstack::contrail_amqp_port, hiera(contrail::params::contrail_amqp_port, $contrail_amqp_port)),
openstack_amqp_ip_list => hiera(openstack::openstack_amqp_ip_list, hiera(contrail::params::openstack_amqp_ip_list, $openstack_amqp_ip_list)),
openstack_amqp_port => hiera(openstack::openstack_amqp_port, hiera(contrail::params::openstack_amqp_port, $openstack_amqp_port)),
sriov_enable => hiera(contrail::openstack::sriov::enable, hiera(contrail::params::sriov_enable, $sriov_enable)),

# Openstack HA Parameters
internal_vip => hiera(openstack::ha::internal_vip, hiera(contrail::params::internal_vip, $internal_vip)),
external_vip => hiera(openstack::ha::external_vip, hiera(contrail::params::external_vip, $external_vip)),
Expand All @@ -804,7 +808,7 @@
compute_passwd_list => hiera(contrail::compute::compute_passwd_list, hiera(contrail::params::compute_passwd_list, $compute_passwd_list)),
huge_pages => hiera(contrail::compute::dpdk::huge_pages, hiera(contrail::params::huge_pages, $huge_pages)),
core_mask => hiera(contrail::compute::dpdk::core_mask, hiera(contrail::params::core_mask, $core_mask)),

sriov => hiera(contrail::compute::sriov,hiera(contrail::params::sriov, $sriov)),
# VMWare Parameters
vmware_ip => hiera(contrail::vmware::vmware_ip, hiera(contrail::params::vmware_ip, $vmware_ip)),
vmware_username => hiera(contrail::vmware::vmware_username, hiera(contrail::params::vmware_username, $vmware_username)),
Expand Down
@@ -0,0 +1,38 @@
define contrail::lib::setup_passthrough_white_list(
$dev_name,
) {
$physnet = $title

notify { "phys_nets_${title} = ${physnet}":; }
notify { "dev_name_${title} = ${dev_name}":; }
$wl = "{ \"devname\": \"${dev_name}\", \"physical_network\": \"${physnet}\"}"
$pci_passthrough_whitelist_line = "pci_passthrough_whitelist = ${wl}"
notify { "wl_${title}=${wl}":; }
notify { "pci_passthrough_whitellist_line_${title}=${pci_passthrough_whitelist_line}":; }
exec { "config_pci_whitelist_${title}":
command => "sed -i '/\[DEFAULT\]/a ${pci_passthrough_whitelist_line} ' /etc/nova/nova.conf",
provider => shell,
logoutput => true
}


/*
file_line { "config_pci_whitelist_${title}":
path => '/etc/nova/nova.conf',
line => "pci_passthrough_whitelist = ${wl}"
}
#cannot use openstack-config as multi-valued option is not supported
#Also cannot use nova_config resourse as it is seen as a re-declaration by puppet
exec { "config_pci_whitelist_${title}":
command => "openstack-config --set /etc/nova/nova.conf DEFAULT pci_passthrough_whitelist ${wl}",
provider => shell,
logoutput => true
}
$nova_pci_passthrough_whitelist_params = {
'pci_passthrough_whitelist' => { value => '{ "devname": $dev_name, "physical_network": $physnet}'}
}
create_resources(nova_config, $nova_pci_passthrough_whitelist_params, {})
*/
}
19 changes: 19 additions & 0 deletions contrail/environment/modules/contrail/manifests/lib/setup_sriov.pp
@@ -0,0 +1,19 @@
define contrail::lib::setup_sriov(
$intf_name,
$num_of_vfs,
$physnet_list,
) {
$line = "echo ${num_of_vfs} > /sys/class/net/${intf_name}/device/sriov_numvfs"
exec { "setup_rc_local_${title}":
command => "sed -i '/exit 0/i ${line}' /etc/rc.local",
provider => shell,
logoutput => true,
}



contrail::lib::setup_passthrough_white_list{ $physnet_list:
dev_name => $intf_name }


}
@@ -0,0 +1,42 @@
define contrail::lib::setup_sriov_wrapper(
$intf_hash,
$enable_dpdk,
) {

if ($enablle_dpdk){
$linux_default_val = "nomdmonddf nomdmonisw intel_iommu=pt"
} else {
$linux_default_val = "nomdmonddf nomdmonisw intel_iommu=on"
}


if (!empty($intf_hash)) {
$intf_details = $intf_hash[$title]
if ($intf_hash) {
file_line { "set_grub_iommu_${title}":
path => '/etc/default/grub',
line => "GRUB_CMDLINE_LINUX_DEFAULT=\"${linux_default_val}\"",
match => '^GRUB_CMDLINE_LINUX_DEFAULT.*',
}
/*
->
exec { "setup_default":
command => "echo '[DEFAULT]' >> /etc/nova/nova.conf",
provider => shell,
logoutput => true,
}
*/

}

notify { "intf_hash_${title} = ${intf_hash}":; }
notify { "title_${title} = ${title}":; }
notify { "intf_details_${title} = ${intf_details}":; }
contrail::lib::setup_sriov{$title :
intf_name => $title,
num_of_vfs => $intf_details['VF'],
physnet_list => $intf_details['physnets']
}

}
}
2 changes: 2 additions & 0 deletions contrail/environment/modules/contrail/manifests/params.pp
Expand Up @@ -693,6 +693,8 @@
$contrail_amqp_port,
$openstack_amqp_ip_list,
$openstack_amqp_port,
$sriov,
$sriov_enable,
) {
if (($contrail_internal_vip != '') or
($internal_vip != '') or
Expand Down
22 changes: 22 additions & 0 deletions contrail/environment/modules/openstack/manifests/common/nova.pp
Expand Up @@ -20,6 +20,8 @@
$contrail_neutron_server = $::contrail::params::config_ip_to_use

$openstack_ip_list = $::contrail::params::openstack_ip_list

$sriov_enable = $::contrail::params::sriov_enable
$contrail_memcache_servers = inline_template('<%= @openstack_ip_list.map{ |ip| "#{ip}:11211" }.join(",") %>')

nova_config { 'DEFAULT/default_floating_pool': value => 'public' }
Expand Down Expand Up @@ -161,4 +163,24 @@
}
}

notify { "sriov = ${sriov}":; }
if ($sriov_enable) {
file_line_after {
'scheduler_default_filters':
line =>
'scheduler_default_filters=PciPassthroughFilter',
path => '/etc/nova/nova.conf',
after => '^\s*\[DEFAULT\]';
'scheduler_available_filters':
line => 'scheduler_available_filters=nova.scheduler.filters.pci_passthrough_filter.PciPassthroughFilter',
path => '/etc/nova/nova.conf',
after => '^\s*\[DEFAULT\]';
'scheduler_available_filters2':
line => 'scheduler_available_filters=nova.scheduler.filters.all_filters',
path => '/etc/nova/nova.conf',
after => '^\s*\[DEFAULT\]';

}
}

}

0 comments on commit 06c2b38

Please sign in to comment.