From 9441d9657e4d5411da7697fb406e37c9e26e38a1 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 4 Feb 2022 15:00:31 +0900 Subject: [PATCH] ovs: Add support for packet processing info report This change introduces support for parameters used to report packet processing info to placement, which was added during the current Yoga cycle[1]. [1] 1ea26616b41335b24b9c162062740ee3de78372d Change-Id: I61d0a5340da6216fb4d885abebc4f109a6fe22b4 --- manifests/agents/ml2/ovs.pp | 71 +++++++++++++++++-- .../pps-config-ovs-d47b70922b4c53c2.yaml | 9 +++ spec/classes/neutron_agents_ml2_ovs_spec.rb | 22 ++++++ 3 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/pps-config-ovs-d47b70922b4c53c2.yaml diff --git a/manifests/agents/ml2/ovs.pp b/manifests/agents/ml2/ovs.pp index fb15b52ab..79826f14d 100644 --- a/manifests/agents/ml2/ovs.pp +++ b/manifests/agents/ml2/ovs.pp @@ -203,6 +203,16 @@ # (optional) List of : # Defaults to empty list # +# [*resource_provider_packet_processing_without_direction*] +# (optional) List of : tuples, defining the minimum +# pachet rate the OVS backend can guarantee in kilo (1000) packet per second. +# Defaults to empty list +# +# [*resource_provider_packet_processing_with_direction*] +# (optional) Similar to resource_provider_packet_processing_without_direction +# but used in case the OVS backend has hardware offload capabilities. +# Defauls to empty list +# # [*resource_provider_default_hypervisor*] # (optional) The default hypervisor name used to locate the parent of # the resource provider. @@ -213,6 +223,11 @@ # rate inventories,. # Defauls to empty hash # +# [*resource_provider_packet_processing_inventory_defaults*] +# (optional) Key:value pairs to specify defaults used while reporting packet +# rate inventories,. +# Defauls to empty hash +# # [*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 @@ -274,9 +289,15 @@ class neutron::agents::ml2::ovs ( $bridge_mac_table_size = $::os_service_default, $igmp_snooping_enable = $::os_service_default, $resource_provider_bandwidths = [], + $resource_provider_packet_processing_without_direction + = [], + $resource_provider_packet_processing_with_direction + = [], $resource_provider_hypervisors = [], $resource_provider_default_hypervisor = $::os_service_default, $resource_provider_inventory_defaults = {}, + $resource_provider_packet_processing_inventory_defaults + = {}, $explicitly_egress_direct = $::os_service_default, $network_log_rate_limit = $::os_service_default, $network_log_burst_limit = $::os_service_default, @@ -380,21 +401,59 @@ class neutron::agents::ml2::ovs ( $resource_provider_hypervisors_real = $::os_service_default } + if ($resource_provider_packet_processing_without_direction != []){ + $resource_provider_packet_processing_without_direction_real = + join(any2array($resource_provider_packet_processing_without_direction), ',') + } else { + $resource_provider_packet_processing_without_direction_real = $::os_service_default + } + + if ($resource_provider_packet_processing_with_direction != []){ + $resource_provider_packet_processing_with_direction_real = + join(any2array($resource_provider_packet_processing_with_direction), ',') + } else { + $resource_provider_packet_processing_with_direction_real = $::os_service_default + } + if empty($resource_provider_inventory_defaults) { $resource_provider_inventory_defaults_real = $::os_service_default } else { if ($resource_provider_inventory_defaults =~ Hash){ - $resource_provider_inventory_defaults_real = join(join_keys_to_values($resource_provider_inventory_defaults, ':'), ',') + $resource_provider_inventory_defaults_real = + join(join_keys_to_values($resource_provider_inventory_defaults, ':'), ',') } else { - $resource_provider_inventory_defaults_real = join(any2array($resource_provider_inventory_defaults), ',') + $resource_provider_inventory_defaults_real = + join(any2array($resource_provider_inventory_defaults), ',') + } + } + + if empty($resource_provider_packet_processing_inventory_defaults) { + $resource_provider_packet_processing_inventory_defaults_real = $::os_service_default + } else { + if ($resource_provider_packet_processing_inventory_defaults =~ Hash){ + $resource_provider_packet_processing_inventory_defaults_real = + join(join_keys_to_values($resource_provider_packet_processing_inventory_defaults, ':'), ',') + } else { + $resource_provider_packet_processing_inventory_defaults_real = + join(any2array($resource_provider_packet_processing_inventory_defaults), ',') } } neutron_agent_ovs { - 'ovs/resource_provider_bandwidths': value => $resource_provider_bandwidths_real; - 'ovs/resource_provider_hypervisors': value => $resource_provider_hypervisors_real; - 'ovs/resource_provider_default_hypervisor': value => $resource_provider_default_hypervisor; - 'ovs/resource_provider_inventory_defaults': value => $resource_provider_inventory_defaults_real; + 'ovs/resource_provider_bandwidths': + value => $resource_provider_bandwidths_real; + 'ovs/resource_provider_hypervisors': + value => $resource_provider_hypervisors_real; + 'ovs/resource_provider_packet_processing_without_direction': + value => $resource_provider_packet_processing_without_direction_real; + 'ovs/resource_provider_packet_processing_with_direction': + value => $resource_provider_packet_processing_with_direction_real; + 'ovs/resource_provider_default_hypervisor': + value => $resource_provider_default_hypervisor; + 'ovs/resource_provider_inventory_defaults': + value => $resource_provider_inventory_defaults_real; + 'ovs/resource_provider_packet_processing_inventory_defaults': + value => $resource_provider_packet_processing_inventory_defaults_real; } neutron_agent_ovs { diff --git a/releasenotes/notes/pps-config-ovs-d47b70922b4c53c2.yaml b/releasenotes/notes/pps-config-ovs-d47b70922b4c53c2.yaml new file mode 100644 index 000000000..ae6cd11c8 --- /dev/null +++ b/releasenotes/notes/pps-config-ovs-d47b70922b4c53c2.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + The following parameters have been added to + the ``neutron::agent::ml2::ovs`` class. + + - ``resource_provider_packet_processing_without_direction`` + - ``resource_provider_packet_processing_with_direction`` + - ``resource_provider_packet_processing_inventory_defaults`` diff --git a/spec/classes/neutron_agents_ml2_ovs_spec.rb b/spec/classes/neutron_agents_ml2_ovs_spec.rb index 36d02fc3e..d651b8db4 100644 --- a/spec/classes/neutron_agents_ml2_ovs_spec.rb +++ b/spec/classes/neutron_agents_ml2_ovs_spec.rb @@ -72,10 +72,16 @@ describe 'neutron::agents::ml2::ovs' do with_value('') should contain_neutron_agent_ovs('ovs/resource_provider_hypervisors').\ with_value('') + should contain_neutron_agent_ovs('ovs/resource_provider_packet_processing_without_direction').\ + with_value('') + should contain_neutron_agent_ovs('ovs/resource_provider_packet_processing_with_direction').\ + with_value('') should contain_neutron_agent_ovs('ovs/resource_provider_default_hypervisor').\ with_value('') should contain_neutron_agent_ovs('ovs/resource_provider_inventory_defaults').\ with_value('') + should contain_neutron_agent_ovs('ovs/resource_provider_packet_processing_inventory_defaults').\ + with_value('') should contain_neutron_agent_ovs('agent/explicitly_egress_direct').with_value('') should contain_neutron_agent_ovs('network_log/rate_limit').with_value('') should contain_neutron_agent_ovs('network_log/burst_limit').with_value('') @@ -339,8 +345,11 @@ describe 'neutron::agents::ml2::ovs' do params.merge!( :resource_provider_bandwidths => ['provider-a', 'provider-b'], :resource_provider_hypervisors => ['provider-a:compute-a', 'provider-b:compute-b'], + :resource_provider_packet_processing_without_direction => [':1000:1000'], + :resource_provider_packet_processing_with_direction => [':2000:2000'], :resource_provider_default_hypervisor => 'compute-c', :resource_provider_inventory_defaults => ['allocation_ratio:1.0', 'min_unit:1', 'step_size:1'], + :resource_provider_packet_processing_inventory_defaults => ['allocation_ratio:2.0', 'min_unit:2', 'step_size:2'], ) end @@ -349,10 +358,16 @@ describe 'neutron::agents::ml2::ovs' do 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') + should contain_neutron_agent_ovs('ovs/resource_provider_packet_processing_without_direction').\ + with_value(':1000:1000') + should contain_neutron_agent_ovs('ovs/resource_provider_packet_processing_with_direction').\ + with_value(':2000:2000') should contain_neutron_agent_ovs('ovs/resource_provider_default_hypervisor').\ with_value('compute-c') should contain_neutron_agent_ovs('ovs/resource_provider_inventory_defaults').\ with_value('allocation_ratio:1.0,min_unit:1,step_size:1') + should contain_neutron_agent_ovs('ovs/resource_provider_packet_processing_inventory_defaults').\ + with_value('allocation_ratio:2.0,min_unit:2,step_size:2') end end @@ -364,12 +379,19 @@ describe 'neutron::agents::ml2::ovs' do 'min_unit' => '1', 'step_size' => '1' }, + :resource_provider_packet_processing_inventory_defaults => { + 'allocation_ratio' => '2.0', + 'min_unit' => '2', + 'step_size' => '2' + } ) end it 'configures resource providers' do should contain_neutron_agent_ovs('ovs/resource_provider_inventory_defaults').\ with_value('allocation_ratio:1.0,min_unit:1,step_size:1') + should contain_neutron_agent_ovs('ovs/resource_provider_packet_processing_inventory_defaults').\ + with_value('allocation_ratio:2.0,min_unit:2,step_size:2') end end end