Add support for the resource_provider_hypervisors parameter

Change-Id: I3d9f0b48a72f82f7d1a86aae94c1f5248b729987
(cherry picked from commit 830c66ccca)
(cherry picked from commit 7c0ffac91c)
This commit is contained in:
Takashi Kajinami 2020-11-17 17:04:02 +09:00
parent e77d34f037
commit 192fc513dc
5 changed files with 103 additions and 55 deletions

View File

@ -184,6 +184,10 @@
# (optional) List of <bridge>:<egress_bw>:<ingress_bw>
# Defaults to empty list
#
# [*resource_provider_hypervisors*]
# (optional) List of <bridge>:<hypervisor>
# Defaults to empty list
#
# [*explicitly_egress_direct*]
# (optional) When set to True, the accepted egress unicast traffic will not
# use action NORMAL. The accepted egress packets will be taken care of in the
@ -232,6 +236,7 @@ class neutron::agents::ml2::ovs (
$tunnel_csum = $::os_service_default,
$igmp_snooping_enable = $::os_service_default,
$resource_provider_bandwidths = [],
$resource_provider_hypervisors = [],
$explicitly_egress_direct = $::os_service_default,
# DEPRECATED
$ovsdb_interface = undef,
@ -323,8 +328,15 @@ class neutron::agents::ml2::ovs (
$resource_provider_bandwidths_real = $::os_service_default
}
if ($resource_provider_hypervisors != []){
$resource_provider_hypervisors_real = join(any2array($resource_provider_hypervisors), ',')
} else {
$resource_provider_hypervisors_real = $::os_service_default
}
neutron_agent_ovs {
'ovs/resource_provider_bandwidths': value => $resource_provider_bandwidths_real;
'ovs/resource_provider_hypervisors': value => $resource_provider_hypervisors_real;
}
# TODO(tobias.urdin): Remove in V release.

View File

@ -73,6 +73,10 @@
# (optional) List of <network_device>:<egress_bw>:<ingress_bw>
# Defaults to empty list
#
# [*resource_provider_hypervisors*]
# (optional) List of <bridge>:<hypervisor>
# Defaults to empty list
#
class neutron::agents::ml2::sriov (
$package_ensure = 'present',
$enabled = true,
@ -84,6 +88,7 @@ class neutron::agents::ml2::sriov (
$purge_config = false,
$number_of_vfs = $::os_service_default,
$resource_provider_bandwidths = [],
$resource_provider_hypervisors = [],
) {
include neutron::deps
@ -133,8 +138,16 @@ class neutron::agents::ml2::sriov (
} else {
$resource_provider_bandwidths_real = $::os_service_default
}
if ($resource_provider_hypervisors != []) {
$resource_provider_hypervisors_real = join(any2array($resource_provider_hypervisors), ',')
} else {
$resource_provider_hypervisors_real = $::os_service_default
}
neutron_sriov_agent_config {
'sriov_nic/resource_provider_bandwidths': value => $resource_provider_bandwidths_real;
'sriov_nic/resource_provider_hypervisors': value => $resource_provider_hypervisors_real;
}
}

View File

@ -0,0 +1,9 @@
---
features:
- |
The following two parameters have been added to define mapping of
bridge name and hyper visor name to locate the parent of the resource
provider tree.
- ``neutron::agents::ml2::ovs::resource_provider_hypervisors``
- ``neutorn::agents::ml2::sriov::resource_provider_hypervisors``

View File

@ -67,6 +67,8 @@ describe 'neutron::agents::ml2::ovs' do
should contain_neutron_agent_ovs('ovs/igmp_snooping_enable').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('ovs/resource_provider_bandwidths').\
with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('ovs/resource_provider_hypervisors').\
with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/explicitly_egress_direct').with_value(['<SERVICE DEFAULT>'])
end
@ -322,13 +324,20 @@ describe 'neutron::agents::ml2::ovs' do
it { should raise_error(Puppet::Error, /Enabling DPDK without manage vswitch does not have any effect/) }
end
context 'when resource_provider_bandwidths is set' do
context 'when parameters for resource providers are set' do
before :each do
params.merge!(:resource_provider_bandwidths => ['provider-a', 'provider-b'])
params.merge!(
:resource_provider_bandwidths => ['provider-a', 'provider-b'],
:resource_provider_hypervisors => ['provider-a:compute-a', 'provider-b:compute-b'],
)
end
it { should contain_neutron_agent_ovs('ovs/resource_provider_bandwidths').\
with_value('provider-a,provider-b') }
it 'configures resource providers' do
should contain_neutron_agent_ovs('ovs/resource_provider_bandwidths').\
with_value('provider-a,provider-b')
should contain_neutron_agent_ovs('ovs/resource_provider_hypervisors').\
with_value('provider-a:compute-a,provider-b:compute-b')
end
end
end

View File

@ -135,14 +135,19 @@ describe 'neutron::agents::ml2::sriov' do
end
end
context 'when resource_provider_bandwidths is set' do
context 'when parameters for resource providers are set' do
before :each do
params.merge!(:resource_provider_bandwidths => ['provider-a', 'provider-b'])
params.merge!(
:resource_provider_bandwidths => ['provider-a', 'provider-b'],
:resource_provider_hypervisors => ['provider-a:compute-a', 'provider-b:compute-b'],
)
end
it 'configures resource_provider_bandwidths' do
it 'configures resource providers' do
should contain_neutron_sriov_agent_config('sriov_nic/resource_provider_bandwidths').\
with_value('provider-a,provider-b')
should contain_neutron_sriov_agent_config('sriov_nic/resource_provider_hypervisors').\
with_value('provider-a:compute-a,provider-b:compute-b')
end
end
end