Merge "Add support for resource provider bandwidth in Neutron config"

This commit is contained in:
Zuul 2020-04-17 14:32:01 +00:00 committed by Gerrit Code Review
commit a641c9b051
6 changed files with 119 additions and 43 deletions

View File

@ -180,6 +180,10 @@
# mechanism driver for Neutron.
# Defaults to $::os_service_default
#
# [*resource_provider_bandwidths*]
# (optional) List of <bridge>:<egress_bw>:<ingress_bw>
# Defaults to empty list
#
# DEPRECATED
#
# [*ovsdb_interface*]
@ -188,41 +192,42 @@
# 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,
$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 = [],
# DEPRECATED
$ovsdb_interface = undef,
$ovsdb_interface = undef,
) {
include neutron::deps
@ -305,6 +310,13 @@ class neutron::agents::ml2::ovs (
}
}
if ($resource_provider_bandwidths != []) {
$res_prov_bw_map_str = join(any2array($resource_provider_bandwidths), ',')
neutron_agent_ovs {
'ovs/resource_provider_bandwidths': value => $res_prov_bw_map_str;
}
}
# TODO(tobias.urdin): Remove in V release.
if $ovsdb_interface != undef {
warning('ovsdb_interface is deprecated and has no effect')

View File

@ -69,16 +69,21 @@
# it as "eth1:4,eth2:10"
# Defaults to $::os_service_default.
#
# [*resource_provider_bandwidths*]
# (optional) List of <network_device>:<egress_bw>:<ingress_bw>
# 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,
$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 = [],
) {
include neutron::deps
@ -123,4 +128,11 @@ class neutron::agents::ml2::sriov (
tag => 'neutron-service',
}
if ($resource_provider_bandwidths != []) {
$res_prov_bw_map_str = join(any2array($resource_provider_bandwidths), ',')
neutron_sriov_agent_config {
'sriov_nic/resource_provider_bandwidths': value => $res_prov_bw_map_str;
}
}
}

View File

@ -23,8 +23,18 @@
# (required) Supported PCI vendor devices, defined by vendor_id:product_id according
# to the PCI ID Repository. Default enables support for Intel and Mellanox SR-IOV capable NICs
#
# [*ovs_vnic_type_blacklist*]
# (optional) list of VNIC types for which support in Neutron is
# administratively prohibited by the OVS mechanism driver
#
# [*sriov_vnic_type_blacklist*]
# (optional) list of VNIC types for which support in Neutron is
# administratively prohibited by the SR-IOV mechanism driver
#
define neutron::plugins::ml2::mech_driver (
$supported_pci_vendor_devs,
$ovs_vnic_type_blacklist = [],
$sriov_vnic_type_blacklist = [],
){
include neutron::deps
@ -51,4 +61,16 @@ define neutron::plugins::ml2::mech_driver (
}
}
}
if ($ovs_vnic_type_blacklist != []) {
neutron_plugin_ml2 {
'ovs_driver/vnic_type_blacklist': value => join(any2array($ovs_vnic_type_blacklist), ',');
}
}
if ($sriov_vnic_type_blacklist != []) {
neutron_plugin_ml2 {
'sriov_driver/vnic_type_blacklist': value => join(any2array($sriov_vnic_type_blacklist), ',');
}
}
}

View File

@ -0,0 +1,4 @@
---
features:
- |
Add support for resource provider bandwidth.

View File

@ -65,6 +65,7 @@ describe 'neutron::agents::ml2::ovs' do
should contain_neutron_agent_ovs('ovs/tun_peer_patch_port').with_ensure('absent')
should contain_neutron_agent_ovs('agent/tunnel_types').with_ensure('absent')
should contain_neutron_agent_ovs('ovs/igmp_snooping_enable').with_value('<SERVICE DEFAULT>')
should_not contain_neutron_agent_ovs('ovs/resource_provider_bandwidths')
end
it 'installs neutron ovs agent package' do
@ -318,6 +319,16 @@ 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
before :each do
params.merge!(:resource_provider_bandwidths => ['provider-a', 'provider-b'])
end
it { should contain_neutron_agent_ovs('ovs/resource_provider_bandwidths').\
with_value('provider-a,provider-b') }
end
end
shared_examples 'neutron::agents::ml2::ovs on Debian' do

View File

@ -66,6 +66,10 @@ describe 'neutron::agents::ml2::sriov' do
should contain_service('neutron-sriov-nic-agent-service').that_notifies('Anchor[neutron::service::end]')
end
it 'does not configure resource_provider_bandwidths by default' do
should_not contain_neutron_sriov_agent_config('sriov_nic/resource_provider_bandwidths')
end
context 'when number_of_vfs is empty' do
before :each do
params.merge!(:number_of_vfs => "")
@ -129,6 +133,17 @@ describe 'neutron::agents::ml2::sriov' do
should contain_neutron_sriov_agent_config('agent/extensions').with_value(params[:extensions].join(','))
end
end
context 'when resource_provider_bandwidths is set' do
before :each do
params.merge!(:resource_provider_bandwidths => ['provider-a', 'provider-b'])
end
it 'configures resource_provider_bandwidths' do
should contain_neutron_sriov_agent_config('sriov_nic/resource_provider_bandwidths').\
with_value('provider-a,provider-b')
end
end
end
on_supported_os({