Merge "sriov check for physical_device_mappings and exclude_devices"

This commit is contained in:
Jenkins 2016-08-11 20:19:11 +00:00 committed by Gerrit Code Review
commit 9a94cab4e0
2 changed files with 22 additions and 11 deletions

View File

@ -34,11 +34,11 @@
# Defaults to true
#
# [*physical_device_mappings*]
# (optional) List of <physical_network>:<physical device>
# (optional) Array 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
# Value should be of type array, Defaults to $::os_service_default
#
# [*polling_interval*]
# (optional) The number of seconds the agent will wait between
@ -46,11 +46,12 @@
# Defaults to '2"
#
# [*exclude_devices*]
# (optional) List of <network_device>:<excluded_devices> mapping
# (optional) Array 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.
# Value should be of type array, Defaults to $::os_service_default
#
# [*extensions*]
# (optional) Extensions list to use
@ -65,9 +66,9 @@ class neutron::agents::ml2::sriov (
$package_ensure = 'present',
$enabled = true,
$manage_service = true,
$physical_device_mappings = [],
$physical_device_mappings = $::os_service_default,
$polling_interval = 2,
$exclude_devices = [],
$exclude_devices = $::os_service_default,
$extensions = $::os_service_default,
$purge_config = false,
) {
@ -81,8 +82,8 @@ class neutron::agents::ml2::sriov (
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, ',');
'sriov_nic/exclude_devices': value => pick(join(any2array($exclude_devices), ','), $::os_service_default);
'sriov_nic/physical_device_mappings': value => pick(join(any2array($physical_device_mappings), ','), $::os_service_default);
'agent/extensions': value => join(any2array($extensions), ',');
}

View File

@ -10,8 +10,6 @@ describe 'neutron::agents::ml2::sriov' do
{ :package_ensure => 'present',
:enabled => true,
:manage_service => true,
:physical_device_mappings => [],
:exclude_devices => [],
:polling_interval => 2,
:supported_pci_vendor_devs => [],
:purge_config => false,
@ -43,8 +41,8 @@ describe 'neutron::agents::ml2::sriov' do
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(','))
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/exclude_devices').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/physical_device_mappings').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_sriov_agent_config('agent/extensions').with_value(['<SERVICE DEFAULT>'])
end
@ -92,6 +90,18 @@ describe 'neutron::agents::ml2::sriov' do
end
end
context 'when supplying empty device mapping' do
before :each do
params.merge!(:physical_device_mappings => "",
:exclude_devices => "")
end
it 'configures physical device mappings with exclusion' do
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/exclude_devices').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/physical_device_mappings').with_value('<SERVICE DEFAULT>')
end
end
context 'when supplying extensions for ML2 SR-IOV agent' do
before :each do
params.merge!(:extensions => ['qos'])