From 3337a809b4ebf8247709f69675287a04a2517d5c Mon Sep 17 00:00:00 2001 From: Yadnesh Kulkarni Date: Mon, 12 Jun 2023 13:46:55 +0530 Subject: [PATCH] Add "tenant_name_discovery" to all namespaces Upon enabling this parameter in all namespaces, ceilometer agents(central, compute, ipmi) will be able to identify users and project names in the metrics generated from their nodes. Without this change, the parameter is missing in compute and ipmi namespace. Change-Id: I0c047e9c8e33c05247d7af69d2a80e7cc22a0304 (cherry picked from commit 524ae2eead2ad9014046bb703daccbf8a9cf0921) --- manifests/agent/polling.pp | 11 ++--------- .../fix_tenant_name_discovery-838f5d64bc405eca.yaml | 6 ++++++ spec/classes/ceilometer_agent_polling_spec.rb | 9 ++++----- 3 files changed, 12 insertions(+), 14 deletions(-) create mode 100644 releasenotes/notes/fix_tenant_name_discovery-838f5d64bc405eca.yaml diff --git a/manifests/agent/polling.pp b/manifests/agent/polling.pp index e7b70102..608781d6 100644 --- a/manifests/agent/polling.pp +++ b/manifests/agent/polling.pp @@ -115,16 +115,8 @@ class ceilometer::agent::polling ( if $central_namespace { $central_namespace_name = 'central' - ceilometer_config { - # set `tenant_name_discovery` parameter only on the nodes - # where central namespace is enabled - 'DEFAULT/tenant_name_discovery': value => $tenant_name_discovery; - } } else { $central_namespace_name = undef - ceilometer_config { - 'DEFAULT/tenant_name_discovery': ensure => absent; - } } if $compute_namespace { @@ -225,7 +217,8 @@ class ceilometer::agent::polling ( } ceilometer_config { - 'polling/batch_size': value => $batch_size + 'polling/batch_size': value => $batch_size; + 'DEFAULT/tenant_name_discovery': value => $tenant_name_discovery; } if $manage_service { diff --git a/releasenotes/notes/fix_tenant_name_discovery-838f5d64bc405eca.yaml b/releasenotes/notes/fix_tenant_name_discovery-838f5d64bc405eca.yaml new file mode 100644 index 00000000..8c407505 --- /dev/null +++ b/releasenotes/notes/fix_tenant_name_discovery-838f5d64bc405eca.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Configure ``tenant_name_discovery`` parameter on + all nodes where ceilometer is expected to run. This inculdes + central, compute and ipmi namespaces. diff --git a/spec/classes/ceilometer_agent_polling_spec.rb b/spec/classes/ceilometer_agent_polling_spec.rb index 21050518..5543fb63 100644 --- a/spec/classes/ceilometer_agent_polling_spec.rb +++ b/spec/classes/ceilometer_agent_polling_spec.rb @@ -38,7 +38,6 @@ describe 'ceilometer::agent::polling' do )} it { - should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value('') should contain_ceilometer_config('compute/instance_discovery_method').with_value('') should contain_ceilometer_config('compute/resource_update_interval').with_value('') should contain_ceilometer_config('compute/resource_cache_expiry').with_value('') @@ -73,6 +72,7 @@ describe 'ceilometer::agent::polling' do it { should contain_ceilometer_config('polling/batch_size').with_value('') } it { should_not contain_file('polling') } + it { should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value('') } end context 'when setting package_ensure' do @@ -101,15 +101,15 @@ describe 'ceilometer::agent::polling' do } end - context 'with central parameters set' do + context 'when tenant_name_discovery is set' do before do params.merge!( - :tenant_name_discovery => false + :tenant_name_discovery => true ) end it { - should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value(false) + should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value(true) } end @@ -137,7 +137,6 @@ describe 'ceilometer::agent::polling' do it { should contain_ceilometer_config('DEFAULT/polling_namespaces').with_value('compute,ipmi') - should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_ensure('absent') } end