From ff23708ef47baa9cb67c0afa30edb1ec5c6da802 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 16 Nov 2020 21:01:19 +0900 Subject: [PATCH] Ensure resource_provider_bandwitdhs is unset by default Currently puppet-neutron supports the resource_provider_bandwidths parameter for ovs agent and sriov agent, but it doesn't provide the way to clear existing settings. This change makes sure that the resource_provider_bandwiths parameter is unset by default so that operators can reset the parameter to the default value defined in neutron service itself. Change-Id: Icd834f4f4ca6578c836935614931af2a3e79bf7d (cherry picked from commit 5b7bc9f4f93231a321adba920f9778e447ceb0cf) --- manifests/agents/ml2/ovs.pp | 11 +++++++---- manifests/agents/ml2/sriov.pp | 10 ++++++---- spec/classes/neutron_agents_ml2_ovs_spec.rb | 3 ++- spec/classes/neutron_agents_ml2_sriov_spec.rb | 3 ++- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/manifests/agents/ml2/ovs.pp b/manifests/agents/ml2/ovs.pp index 27ac22e85..f5e39a71c 100644 --- a/manifests/agents/ml2/ovs.pp +++ b/manifests/agents/ml2/ovs.pp @@ -318,10 +318,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; - } + $resource_provider_bandwidths_real = join(any2array($resource_provider_bandwidths), ',') + } else { + $resource_provider_bandwidths_real = $::os_service_default + } + + neutron_agent_ovs { + 'ovs/resource_provider_bandwidths': value => $resource_provider_bandwidths_real; } # TODO(tobias.urdin): Remove in V release. diff --git a/manifests/agents/ml2/sriov.pp b/manifests/agents/ml2/sriov.pp index d8e372bb8..cf85e54c2 100644 --- a/manifests/agents/ml2/sriov.pp +++ b/manifests/agents/ml2/sriov.pp @@ -129,10 +129,12 @@ class neutron::agents::ml2::sriov ( } 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; - } + $resource_provider_bandwidths_real = join(any2array($resource_provider_bandwidths), ',') + } else { + $resource_provider_bandwidths_real = $::os_service_default + } + neutron_sriov_agent_config { + 'sriov_nic/resource_provider_bandwidths': value => $resource_provider_bandwidths_real; } } diff --git a/spec/classes/neutron_agents_ml2_ovs_spec.rb b/spec/classes/neutron_agents_ml2_ovs_spec.rb index 0da1f73ed..b45ec2b3c 100644 --- a/spec/classes/neutron_agents_ml2_ovs_spec.rb +++ b/spec/classes/neutron_agents_ml2_ovs_spec.rb @@ -65,7 +65,8 @@ 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('') - should_not contain_neutron_agent_ovs('ovs/resource_provider_bandwidths') + should contain_neutron_agent_ovs('ovs/resource_provider_bandwidths').\ + with_value('') should contain_neutron_agent_ovs('agent/explicitly_egress_direct').with_value(['']) end diff --git a/spec/classes/neutron_agents_ml2_sriov_spec.rb b/spec/classes/neutron_agents_ml2_sriov_spec.rb index 9e73093ad..96a80909d 100644 --- a/spec/classes/neutron_agents_ml2_sriov_spec.rb +++ b/spec/classes/neutron_agents_ml2_sriov_spec.rb @@ -67,7 +67,8 @@ describe 'neutron::agents::ml2::sriov' do end it 'does not configure resource_provider_bandwidths by default' do - should_not contain_neutron_sriov_agent_config('sriov_nic/resource_provider_bandwidths') + should contain_neutron_sriov_agent_config('sriov_nic/resource_provider_bandwidths').\ + with_value('') end context 'when number_of_vfs is empty' do