From 830c66cccaf1446ff59081630977033dbdc72b6a Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 17 Nov 2020 17:04:02 +0900 Subject: [PATCH] Add support for the resource_provider_hypervisors parameter Change-Id: I3d9f0b48a72f82f7d1a86aae94c1f5248b729987 --- manifests/agents/ml2/ovs.pp | 86 +++++++++++-------- manifests/agents/ml2/sriov.pp | 35 +++++--- ...provider_hypervisors-907db47afa6d5d72.yaml | 9 ++ spec/classes/neutron_agents_ml2_ovs_spec.rb | 17 +++- spec/classes/neutron_agents_ml2_sriov_spec.rb | 11 ++- 5 files changed, 103 insertions(+), 55 deletions(-) create mode 100644 releasenotes/notes/resource_provider_hypervisors-907db47afa6d5d72.yaml diff --git a/manifests/agents/ml2/ovs.pp b/manifests/agents/ml2/ovs.pp index f5e39a71c..a68e4d16c 100644 --- a/manifests/agents/ml2/ovs.pp +++ b/manifests/agents/ml2/ovs.pp @@ -184,6 +184,10 @@ # (optional) List of :: # Defaults to empty list # +# [*resource_provider_hypervisors*] +# (optional) List of : +# 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. diff --git a/manifests/agents/ml2/sriov.pp b/manifests/agents/ml2/sriov.pp index cf85e54c2..9fa88676c 100644 --- a/manifests/agents/ml2/sriov.pp +++ b/manifests/agents/ml2/sriov.pp @@ -73,17 +73,22 @@ # (optional) List of :: # Defaults to empty list # +# [*resource_provider_hypervisors*] +# (optional) List of : +# 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; } } diff --git a/releasenotes/notes/resource_provider_hypervisors-907db47afa6d5d72.yaml b/releasenotes/notes/resource_provider_hypervisors-907db47afa6d5d72.yaml new file mode 100644 index 000000000..46294b259 --- /dev/null +++ b/releasenotes/notes/resource_provider_hypervisors-907db47afa6d5d72.yaml @@ -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`` diff --git a/spec/classes/neutron_agents_ml2_ovs_spec.rb b/spec/classes/neutron_agents_ml2_ovs_spec.rb index b45ec2b3c..18e7401c6 100644 --- a/spec/classes/neutron_agents_ml2_ovs_spec.rb +++ b/spec/classes/neutron_agents_ml2_ovs_spec.rb @@ -67,6 +67,8 @@ describe 'neutron::agents::ml2::ovs' do should contain_neutron_agent_ovs('ovs/igmp_snooping_enable').with_value('') should contain_neutron_agent_ovs('ovs/resource_provider_bandwidths').\ with_value('') + should contain_neutron_agent_ovs('ovs/resource_provider_hypervisors').\ + with_value('') should contain_neutron_agent_ovs('agent/explicitly_egress_direct').with_value(['']) 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 diff --git a/spec/classes/neutron_agents_ml2_sriov_spec.rb b/spec/classes/neutron_agents_ml2_sriov_spec.rb index 96a80909d..02d85dc8d 100644 --- a/spec/classes/neutron_agents_ml2_sriov_spec.rb +++ b/spec/classes/neutron_agents_ml2_sriov_spec.rb @@ -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