Merge "Support SR-IOV mechanism driver in ML2"
This commit is contained in:
commit
8e68140219
88
manifests/agents/ml2/sriov.pp
Normal file
88
manifests/agents/ml2/sriov.pp
Normal file
@ -0,0 +1,88 @@
|
||||
#
|
||||
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
||||
#
|
||||
# Author: Emilien Macchi <emilien.macchi@enovance.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# == Class: neutron::agents::ml2::sriov
|
||||
#
|
||||
# Setups SR-IOV neutron agent when using ML2 plugin
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (optional) The state of the package
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*enabled*]
|
||||
# (required) Whether or not to enable the OVS Agent
|
||||
# Defaults to true
|
||||
#
|
||||
# [*physical_device_mappings*]
|
||||
# (optional) List of <physical_network>:<physical device>
|
||||
# All physical networks listed in network_vlan_ranges
|
||||
# on the server should have mappings to appropriate
|
||||
# interfaces on each agent.
|
||||
# Defaults to empty list
|
||||
#
|
||||
# [*polling_interval*]
|
||||
# (optional) The number of seconds the agent will wait between
|
||||
# polling for local device changes.
|
||||
# Defaults to '2"
|
||||
#
|
||||
# [*exclude_devices*]
|
||||
# (optional) List of <network_device>:<excluded_devices> mapping
|
||||
# network_device to the agent's node-specific list of virtual functions
|
||||
# that should not be used for virtual networking. excluded_devices is a
|
||||
# semicolon separated list of virtual functions to exclude from network_device.
|
||||
# The network_device in the mapping should appear in the physical_device_mappings list.
|
||||
class neutron::agents::ml2::sriov (
|
||||
$package_ensure = 'present',
|
||||
$enabled = true,
|
||||
$physical_device_mappings = [],
|
||||
$polling_interval = 2,
|
||||
$exclude_devices = [],
|
||||
) {
|
||||
|
||||
include neutron::params
|
||||
|
||||
Neutron_plugin_ml2<||> ~> Service['neutron-sriov-nic-agent-service']
|
||||
|
||||
neutron_plugin_ml2 {
|
||||
'sriov_nic/polling_interval': value => $polling_interval;
|
||||
'sriov_nic/exclude_devices': value => join($exclude_devices, ',');
|
||||
'sriov_nic/physical_device_mappings': value => join($physical_device_mappings, ',');
|
||||
}
|
||||
|
||||
|
||||
Package['neutron-sriov-nic-agent'] -> Neutron_plugin_ml2<||>
|
||||
package { 'neutron-sriov-nic-agent':
|
||||
ensure => $package_ensure,
|
||||
name => $::neutron::params::sriov_nic_agent_package,
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
|
||||
service { 'neutron-sriov-nic-agent-service':
|
||||
ensure => $service_ensure,
|
||||
name => $::neutron::params::sriov_nic_agent_service,
|
||||
enable => $enabled,
|
||||
require => Class['neutron'],
|
||||
}
|
||||
|
||||
}
|
@ -24,6 +24,9 @@ class neutron::params {
|
||||
$linuxbridge_server_package = 'openstack-neutron-linuxbridge'
|
||||
$linuxbridge_config_file = '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini'
|
||||
|
||||
$sriov_nic_agent_service = 'neutron-sriov-nic-agent'
|
||||
$sriov_nic_agent_package = 'openstack-neutron-sriov-nic-agent'
|
||||
|
||||
$cisco_server_package = 'openstack-neutron-cisco'
|
||||
$cisco_config_file = '/etc/neutron/plugins/cisco/cisco_plugins.ini'
|
||||
$cisco_ml2_config_file = '/etc/neutron/plugins/ml2/ml2_conf_cisco.ini'
|
||||
@ -88,6 +91,9 @@ class neutron::params {
|
||||
$linuxbridge_server_package = 'neutron-plugin-linuxbridge'
|
||||
$linuxbridge_config_file = '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini'
|
||||
|
||||
$sriov_nic_agent_service = 'neutron-plugin-sriov-agent'
|
||||
$sriov_nic_agent_package = 'neutron-plugin-sriov-agent'
|
||||
|
||||
$cisco_server_package = 'neutron-plugin-cisco'
|
||||
$cisco_config_file = '/etc/neutron/plugins/cisco/cisco_plugins.ini'
|
||||
$cisco_ml2_config_file = '/etc/neutron/plugins/ml2/ml2_conf_cisco.ini'
|
||||
|
@ -42,7 +42,7 @@
|
||||
# entrypoints to be loaded from the neutron.ml2.mechanism_drivers namespace.
|
||||
# Should be an array that can have these elements:
|
||||
# logger, test, linuxbridge, openvswitch, hyperv, ncs, arista, cisco_nexus,
|
||||
# l2population.
|
||||
# l2population, sriovnicswitch
|
||||
# Default to ['openvswitch', 'linuxbridge'].
|
||||
#
|
||||
# [*flat_networks*]
|
||||
@ -88,18 +88,32 @@
|
||||
# It should be false when you use nova security group.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*supported_pci_vendor_devs*]
|
||||
# (optional) Supported PCI vendor devices, defined by
|
||||
# vendor_id:product_id according to the PCI ID
|
||||
# Repository. Should be an array of devices.
|
||||
# Defaults to ['15b3:1004', '8086:10ca'] (Intel & Mellanox SR-IOV capable NICs)
|
||||
#
|
||||
# [*sriov_agent_required*]
|
||||
# (optional) SRIOV neutron agent is required for port binding.
|
||||
# Only set to true if SRIOV network adapters support VF link state setting
|
||||
# and if admin state management is desired.
|
||||
# Defaults to false.
|
||||
#
|
||||
|
||||
class neutron::plugins::ml2 (
|
||||
$type_drivers = ['local', 'flat', 'vlan', 'gre', 'vxlan'],
|
||||
$tenant_network_types = ['local', 'flat', 'vlan', 'gre', 'vxlan'],
|
||||
$mechanism_drivers = ['openvswitch', 'linuxbridge'],
|
||||
$flat_networks = ['*'],
|
||||
$network_vlan_ranges = ['physnet1:1000:2999'],
|
||||
$tunnel_id_ranges = ['20:100'],
|
||||
$vxlan_group = '224.0.0.1',
|
||||
$vni_ranges = ['10:100'],
|
||||
$enable_security_group = true,
|
||||
$package_ensure = 'present'
|
||||
$type_drivers = ['local', 'flat', 'vlan', 'gre', 'vxlan'],
|
||||
$tenant_network_types = ['local', 'flat', 'vlan', 'gre', 'vxlan'],
|
||||
$mechanism_drivers = ['openvswitch', 'linuxbridge'],
|
||||
$flat_networks = ['*'],
|
||||
$network_vlan_ranges = ['physnet1:1000:2999'],
|
||||
$tunnel_id_ranges = ['20:100'],
|
||||
$vxlan_group = '224.0.0.1',
|
||||
$vni_ranges = ['10:100'],
|
||||
$enable_security_group = true,
|
||||
$package_ensure = 'present',
|
||||
$supported_pci_vendor_devs = ['15b3:1004', '8086:10ca'],
|
||||
$sriov_agent_required = false,
|
||||
) {
|
||||
|
||||
include neutron::params
|
||||
@ -142,7 +156,7 @@ class neutron::plugins::ml2 (
|
||||
Package['neutron'] -> File['/etc/neutron/plugin.ini']
|
||||
}
|
||||
|
||||
neutron::plugins::ml2::driver { $type_drivers:
|
||||
neutron::plugins::ml2::type_driver { $type_drivers:
|
||||
flat_networks => $flat_networks,
|
||||
tunnel_id_ranges => $tunnel_id_ranges,
|
||||
network_vlan_ranges => $network_vlan_ranges,
|
||||
@ -150,6 +164,11 @@ class neutron::plugins::ml2 (
|
||||
vxlan_group => $vxlan_group,
|
||||
}
|
||||
|
||||
neutron::plugins::ml2::mech_driver { $mechanism_drivers:
|
||||
supported_pci_vendor_devs => $supported_pci_vendor_devs,
|
||||
sriov_agent_required => $sriov_agent_required,
|
||||
}
|
||||
|
||||
neutron_plugin_ml2 {
|
||||
'ml2/type_drivers': value => join($type_drivers, ',');
|
||||
'ml2/tenant_network_types': value => join($tenant_network_types, ',');
|
||||
|
31
manifests/plugins/ml2/mech_driver.pp
Normal file
31
manifests/plugins/ml2/mech_driver.pp
Normal file
@ -0,0 +1,31 @@
|
||||
#
|
||||
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
||||
#
|
||||
# Author: Emilien Macchi <emilien.macchi@enovance.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# neutron::plugins::ml2::mech_driver used by neutron::plugins::ml2
|
||||
#
|
||||
|
||||
define neutron::plugins::ml2::mech_driver (
|
||||
$supported_pci_vendor_devs,
|
||||
$sriov_agent_required,
|
||||
){
|
||||
if ($name == 'sriovnicswitch') {
|
||||
neutron_plugin_ml2 {
|
||||
'ml2_sriov/supported_pci_vendor_dev': value => join($supported_pci_vendor_devs, ',');
|
||||
'ml2_sriov/agent_required': value => $sriov_agent_required;
|
||||
}
|
||||
}
|
||||
}
|
@ -15,10 +15,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# neutron::plugins::ml2::drivers used by neutron::plugins::ml2
|
||||
# neutron::plugins::ml2::type_driver used by neutron::plugins::ml2
|
||||
#
|
||||
|
||||
define neutron::plugins::ml2::driver (
|
||||
define neutron::plugins::ml2::type_driver (
|
||||
$flat_networks,
|
||||
$tunnel_id_ranges,
|
||||
$network_vlan_ranges,
|
90
spec/classes/neutron_agents_ml2_sriov_spec.rb
Normal file
90
spec/classes/neutron_agents_ml2_sriov_spec.rb
Normal file
@ -0,0 +1,90 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'neutron::agents::ml2::sriov' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'neutron': rabbit_password => 'passw0rd' }"
|
||||
end
|
||||
|
||||
let :default_params do
|
||||
{ :package_ensure => 'present',
|
||||
:enabled => true,
|
||||
:physical_device_mappings => [],
|
||||
:exclude_devices => [],
|
||||
:polling_interval => 2,
|
||||
}
|
||||
end
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
shared_examples_for 'neutron sriov-nic agent with ml2 plugin' do
|
||||
let :p do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
it { should contain_class('neutron::params') }
|
||||
|
||||
it 'configures ovs_neutron_plugin.ini' do
|
||||
should contain_neutron_plugin_ml2('sriov_nic/polling_interval').with_value(p[:polling_interval])
|
||||
should contain_neutron_plugin_ml2('sriov_nic/exclude_devices').with_value(p[:exclude_devices].join(','))
|
||||
should contain_neutron_plugin_ml2('sriov_nic/physical_device_mappings').with_value(p[:physical_device_mappings].join(','))
|
||||
end
|
||||
|
||||
it 'installs neutron sriov-nic agent package' do
|
||||
should contain_package('neutron-sriov-nic-agent').with(
|
||||
:name => platform_params[:sriov_nic_agent_package],
|
||||
:ensure => p[:package_ensure]
|
||||
)
|
||||
should contain_package('neutron-sriov-nic-agent').with_before(/Neutron_plugin_ml2\[.+\]/)
|
||||
end
|
||||
|
||||
it 'configures neutron ovs agent service' do
|
||||
should contain_service('neutron-sriov-nic-agent-service').with(
|
||||
:name => platform_params[:sriov_nic_agent_service],
|
||||
:enable => true,
|
||||
:ensure => 'running',
|
||||
:require => 'Class[Neutron]'
|
||||
)
|
||||
end
|
||||
|
||||
context 'when supplying device mapping' do
|
||||
before :each do
|
||||
params.merge!(:physical_device_mappings => ['physnet1:eth1'],
|
||||
:exclude_devices => ['physnet1:eth2'])
|
||||
end
|
||||
|
||||
it 'configures physical device mappings with exclusion' do
|
||||
should contain_neutron_plugin_ml2('sriov_nic/exclude_devices').with_value(['physnet1:eth2'])
|
||||
should contain_neutron_plugin_ml2('sriov_nic/physical_device_mappings').with_value(['physnet1:eth1'])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :sriov_nic_agent_package => 'neutron-plugin-sriov-agent',
|
||||
:sriov_nic_agent_service => 'neutron-plugin-sriov-agent' }
|
||||
end
|
||||
|
||||
it_configures 'neutron sriov-nic agent with ml2 plugin'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :sriov_nic_agent_package => 'openstack-neutron-sriov-nic-agent',
|
||||
:sriov_nic_agent_service => 'neutron-sriov-nic-agent' }
|
||||
end
|
||||
|
||||
it_configures 'neutron sriov-nic agent with ml2 plugin'
|
||||
end
|
||||
end
|
@ -183,6 +183,19 @@ describe 'neutron::plugins::ml2' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when running sriov mechanism driver' do
|
||||
before :each do
|
||||
params.merge!(
|
||||
:mechanism_drivers => ['openvswitch', 'sriovnicswitch'],
|
||||
:sriov_agent_required => true,
|
||||
)
|
||||
end
|
||||
it 'configures sriov mechanism driver with agent_enabled' do
|
||||
should contain_neutron_plugin_ml2('ml2_sriov/supported_pci_vendor_dev').with_value(['15b3:1004,8086:10ca'])
|
||||
should contain_neutron_plugin_ml2('ml2_sriov/agent_required').with_value('true')
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Ubuntu operating systems' do
|
||||
before do
|
||||
facts.merge!({:operatingsystem => 'Ubuntu'})
|
||||
|
Loading…
Reference in New Issue
Block a user