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

View File

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

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 {
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/resource_update_interval').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_not contain_file('polling') }
it { should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value('<SERVICE DEFAULT>') }
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