Add support for the resource_provider_hypervisors parameter

Change-Id: I3d9f0b48a72f82f7d1a86aae94c1f5248b729987
This commit is contained in:
Takashi Kajinami 2020-11-17 17:04:02 +09:00
parent 5b7bc9f4f9
commit 830c66ccca
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
@ -198,43 +202,44 @@
# Defaults to undef
#
class neutron::agents::ml2::ovs (
$package_ensure = 'present',
$enabled = true,
$manage_service = true,
$extensions = $::os_service_default,
$bridge_uplinks = [],
$bridge_mappings = [],
$ovsdb_timeout = $::os_service_default,
$of_connect_timeout = $::os_service_default,
$of_request_timeout = $::os_service_default,
$of_inactivity_probe = $::os_service_default,
$integration_bridge = 'br-int',
$tunnel_types = [],
$local_ip = false,
$tunnel_bridge = 'br-tun',
$vxlan_udp_port = 4789,
$polling_interval = $::os_service_default,
$l2_population = $::os_service_default,
$arp_responder = $::os_service_default,
$firewall_driver = 'iptables_hybrid',
$enable_distributed_routing = $::os_service_default,
$drop_flows_on_start = false,
$manage_vswitch = true,
$int_peer_patch_port = $::os_service_default,
$tun_peer_patch_port = $::os_service_default,
$datapath_type = $::os_service_default,
$vhostuser_socket_dir = $::os_service_default,
$purge_config = false,
$enable_dpdk = false,
$enable_security_group = $::os_service_default,
$permitted_ethertypes = $::os_service_default,
$minimize_polling = $::os_service_default,
$tunnel_csum = $::os_service_default,
$igmp_snooping_enable = $::os_service_default,
$resource_provider_bandwidths = [],
$explicitly_egress_direct = $::os_service_default,
$package_ensure = 'present',
$enabled = true,
$manage_service = true,
$extensions = $::os_service_default,
$bridge_uplinks = [],
$bridge_mappings = [],
$ovsdb_timeout = $::os_service_default,
$of_connect_timeout = $::os_service_default,
$of_request_timeout = $::os_service_default,
$of_inactivity_probe = $::os_service_default,
$integration_bridge = 'br-int',
$tunnel_types = [],
$local_ip = false,
$tunnel_bridge = 'br-tun',
$vxlan_udp_port = 4789,
$polling_interval = $::os_service_default,
$l2_population = $::os_service_default,
$arp_responder = $::os_service_default,
$firewall_driver = 'iptables_hybrid',
$enable_distributed_routing = $::os_service_default,
$drop_flows_on_start = false,
$manage_vswitch = true,
$int_peer_patch_port = $::os_service_default,
$tun_peer_patch_port = $::os_service_default,
$datapath_type = $::os_service_default,
$vhostuser_socket_dir = $::os_service_default,
$purge_config = false,
$enable_dpdk = false,
$enable_security_group = $::os_service_default,
$permitted_ethertypes = $::os_service_default,
$minimize_polling = $::os_service_default,
$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,
$ovsdb_interface = undef,
) {
include neutron::deps
@ -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_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,17 +73,22 @@
# (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,
$manage_service = true,
$physical_device_mappings = $::os_service_default,
$polling_interval = 2,
$exclude_devices = $::os_service_default,
$extensions = $::os_service_default,
$purge_config = false,
$number_of_vfs = $::os_service_default,
$resource_provider_bandwidths = [],
$package_ensure = 'present',
$enabled = true,
$manage_service = true,
$physical_device_mappings = $::os_service_default,
$polling_interval = 2,
$exclude_devices = $::os_service_default,
$extensions = $::os_service_default,
$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_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