Merge "Split SR-IOV configuration file into driver and agent pieces"

This commit is contained in:
Jenkins 2015-11-12 13:05:29 +00:00 committed by Gerrit Code Review
commit 25eb87f6be
10 changed files with 137 additions and 21 deletions

View File

@ -0,0 +1,10 @@
Puppet::Type.type(:neutron_plugin_sriov).provide(
:ini_setting,
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def file_path
'/etc/neutron/plugins/ml2/ml2_conf_sriov.ini'
end
end

View File

@ -0,0 +1,9 @@
Puppet::Type.type(:neutron_sriov_agent_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def file_path
'/etc/neutron/plugins/ml2/sriov_agent.ini'
end
end

View File

@ -0,0 +1,25 @@
Puppet::Type.newtype(:neutron_plugin_sriov) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/neutron/plugins/ml2/ml2_conf_sriov.ini'
newvalues(/\S+\/\S+/)
end
newparam(:ensure_absent_val) do
desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do ['neutron'] end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
end
end

View File

@ -0,0 +1,25 @@
Puppet::Type.newtype(:neutron_sriov_agent_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/neutron/plugins/ml2/sriov_agent.ini'
newvalues(/\S+\/\S+/)
end
newparam(:ensure_absent_val) do
desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do ['neutron'] end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
end
end

View File

@ -51,6 +51,8 @@
# 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,
@ -62,16 +64,15 @@ class neutron::agents::ml2::sriov (
include ::neutron::params
Neutron_plugin_ml2<||> ~> Service['neutron-sriov-nic-agent-service']
Neutron_sriov_agent_config <||> ~> Service['neutron-sriov-nic-agent-service']
neutron_plugin_ml2 {
neutron_sriov_agent_config {
'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'] -> Neutron_sriov_agent_config <||>
package { 'neutron-sriov-nic-agent':
ensure => $package_ensure,
name => $::neutron::params::sriov_nic_agent_package,

View File

@ -24,14 +24,14 @@
# to the PCI ID Repository. Default enables support for Intel and Mellanox SR-IOV capable NICs
#
# [*sriov_agent_required*]
# (required) SRIOV neutron agent is required for port binding
# (optional) SRIOV neutron agent is always required for port binding
#
define neutron::plugins::ml2::mech_driver (
$supported_pci_vendor_devs,
$sriov_agent_required,
$sriov_agent_required = true,
){
if ($name == 'sriovnicswitch') {
neutron_plugin_ml2 {
neutron_plugin_sriov {
'ml2_sriov/supported_pci_vendor_devs': value => join(any2array($supported_pci_vendor_devs), ',');
'ml2_sriov/agent_required': value => $sriov_agent_required;
}

View File

@ -120,8 +120,9 @@ describe 'basic neutron' do
class { '::neutron::plugins::ml2':
type_drivers => ['vxlan'],
tenant_network_types => ['vxlan'],
mechanism_drivers => ['openvswitch']
mechanism_drivers => ['openvswitch', 'sriovnicswitch']
}
class { '::neutron::agents::ml2::sriov': }
EOS

View File

@ -30,6 +30,8 @@ describe 'basic neutron_config resource' do
File <||> -> Neutron_agent_ovs <||>
File <||> -> Neutron_plugin_plumgrid <||>
File <||> -> Neutron_plumlib_plumgrid <||>
File <||> -> Neutron_plugin_sriov <||>
File <||> -> Neutron_sriov_agent_config <||>
$neutron_directories = ['/etc/neutron',
'/etc/neutron/plugins',
@ -59,7 +61,9 @@ describe 'basic neutron_config resource' do
'/etc/neutron/vpn_agent.ini',
'/etc/neutron/plugins/midonet/midonet.ini',
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
'/etc/neutron/plugins/plumgrid/plumgrid.ini']
'/etc/neutron/plugins/plumgrid/plumgrid.ini',
'/etc/neutron/plugins/ml2/ml2_conf_sriov.ini',
'/etc/neutron/plugins/ml2/sriov_agent.ini']
file { $neutron_directories :
ensure => directory,
@ -457,13 +461,49 @@ describe 'basic neutron_config resource' do
neutron_plumlib_plumgrid { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
ensure_absent_val => 'toto', }
neutron_plumlib_plumgrid { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_plugin_sriov { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_sriov { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_sriov { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_sriov { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_sriov_agent_config { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_sriov_agent_config { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_sriov_agent_config { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_sriov_agent_config { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
EOS
@ -490,7 +530,9 @@ describe 'basic neutron_config resource' do
'/etc/neutron/vpn_agent.ini',
'/etc/neutron/plugins/midonet/midonet.ini',
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
'/etc/neutron/plugins/plumgrid/plumgrid.ini']
'/etc/neutron/plugins/plumgrid/plumgrid.ini',
'/etc/neutron/plugins/ml2/ml2_conf_sriov.ini',
'/etc/neutron/plugins/ml2/sriov_agent.ini']
$neutron_files.each do |neutron_conf_file|
describe file(neutron_conf_file) do

View File

@ -13,6 +13,7 @@ describe 'neutron::agents::ml2::sriov' do
:physical_device_mappings => [],
:exclude_devices => [],
:polling_interval => 2,
:supported_pci_vendor_devs => [],
}
end
@ -33,19 +34,21 @@ describe 'neutron::agents::ml2::sriov' do
it { is_expected.to contain_class('neutron::params') }
it 'configures plugins/ml2/openvswitch_agent.ini' do
is_expected.to contain_neutron_plugin_ml2('sriov_nic/polling_interval').with_value(p[:polling_interval])
is_expected.to contain_neutron_plugin_ml2('sriov_nic/exclude_devices').with_value(p[:exclude_devices].join(','))
is_expected.to contain_neutron_plugin_ml2('sriov_nic/physical_device_mappings').with_value(p[:physical_device_mappings].join(','))
it 'configures /etc/neutron/plugins/ml2/sriov_agent.ini' do
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/polling_interval').with_value(p[:polling_interval])
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/exclude_devices').with_value(p[:exclude_devices].join(','))
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/physical_device_mappings').with_value(p[:physical_device_mappings].join(','))
end
it 'installs neutron sriov-nic agent package' do
is_expected.to contain_package('neutron-sriov-nic-agent').with(
:name => platform_params[:sriov_nic_agent_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron-sriov-nic-agent').with_before(/Neutron_plugin_ml2\[.+\]/)
is_expected.to contain_package('neutron-sriov-nic-agent').with_before(/Neutron_sriov_agent_config\[.+\]/)
end
it 'configures neutron sriov agent service' do
@ -75,8 +78,8 @@ describe 'neutron::agents::ml2::sriov' do
end
it 'configures physical device mappings with exclusion' do
is_expected.to contain_neutron_plugin_ml2('sriov_nic/exclude_devices').with_value(['physnet1:eth2'])
is_expected.to contain_neutron_plugin_ml2('sriov_nic/physical_device_mappings').with_value(['physnet1:eth1'])
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/exclude_devices').with_value(['physnet1:eth2'])
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/physical_device_mappings').with_value(['physnet1:eth1'])
end
end
end

View File

@ -216,8 +216,8 @@ describe 'neutron::plugins::ml2' do
)
end
it 'configures sriov mechanism driver with agent_enabled' do
is_expected.to contain_neutron_plugin_ml2('ml2_sriov/supported_pci_vendor_devs').with_value(['15b3:1004,8086:10ca'])
is_expected.to contain_neutron_plugin_ml2('ml2_sriov/agent_required').with_value('true')
is_expected.to contain_neutron_plugin_sriov('ml2_sriov/agent_required').with_value('true')
is_expected.to contain_neutron_plugin_sriov('ml2_sriov/supported_pci_vendor_devs').with_value(['15b3:1004,8086:10ca'])
end
end