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
This commit is contained in:
Yadnesh Kulkarni 2023-06-12 13:46:55 +05:30
parent 41268f3493
commit 524ae2eead
3 changed files with 12 additions and 14 deletions

View File

@ -115,16 +115,8 @@ class ceilometer::agent::polling (
if $central_namespace { if $central_namespace {
$central_namespace_name = 'central' $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 { } else {
$central_namespace_name = undef $central_namespace_name = undef
ceilometer_config {
'DEFAULT/tenant_name_discovery': ensure => absent;
}
} }
if $compute_namespace { if $compute_namespace {
@ -225,7 +217,8 @@ class ceilometer::agent::polling (
} }
ceilometer_config { 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 { if $manage_service {

View File

@ -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.

View File

@ -38,7 +38,6 @@ describe 'ceilometer::agent::polling' do
)} )}
it { it {
should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value('<SERVICE DEFAULT>')
should contain_ceilometer_config('compute/instance_discovery_method').with_value('<SERVICE DEFAULT>') should contain_ceilometer_config('compute/instance_discovery_method').with_value('<SERVICE DEFAULT>')
should contain_ceilometer_config('compute/resource_update_interval').with_value('<SERVICE DEFAULT>') should contain_ceilometer_config('compute/resource_update_interval').with_value('<SERVICE DEFAULT>')
should contain_ceilometer_config('compute/resource_cache_expiry').with_value('<SERVICE DEFAULT>') should contain_ceilometer_config('compute/resource_cache_expiry').with_value('<SERVICE DEFAULT>')
@ -73,6 +72,7 @@ describe 'ceilometer::agent::polling' do
it { should contain_ceilometer_config('polling/batch_size').with_value('<SERVICE DEFAULT>') } it { should contain_ceilometer_config('polling/batch_size').with_value('<SERVICE DEFAULT>') }
it { should_not contain_file('polling') } it { should_not contain_file('polling') }
it { should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value('<SERVICE DEFAULT>') }
end end
context 'when setting package_ensure' do context 'when setting package_ensure' do
@ -101,15 +101,15 @@ describe 'ceilometer::agent::polling' do
} }
end end
context 'with central parameters set' do context 'when tenant_name_discovery is set' do
before do before do
params.merge!( params.merge!(
:tenant_name_discovery => false :tenant_name_discovery => true
) )
end end
it { it {
should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value(false) should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value(true)
} }
end end
@ -137,7 +137,6 @@ describe 'ceilometer::agent::polling' do
it { it {
should contain_ceilometer_config('DEFAULT/polling_namespaces').with_value('compute,ipmi') should contain_ceilometer_config('DEFAULT/polling_namespaces').with_value('compute,ipmi')
should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_ensure('absent')
} }
end end