Merge "compute: Add support for tunables parameters"

This commit is contained in:
Zuul 2022-01-08 05:41:40 +00:00 committed by Gerrit Code Review
commit 8ff2661983
3 changed files with 35 additions and 5 deletions

View File

@ -36,6 +36,15 @@
# * libvirt_metadata: get instances from libvirt metadata # * libvirt_metadata: get instances from libvirt metadata
# but without instance metadata (recommended for Gnocchi backend). # but without instance metadata (recommended for Gnocchi backend).
# #
# [*resource_update_interval*]
# (Optional) New instances will be discovered periodically based on this
# option (in seconds).
# Defaults to $::os_service_default.
#
# [*resource_cache_expiry*]
# (Optional) The expiry to totally refresh the instances resource cache.
# Defaults to $::os_service_default.
#
# [*manage_polling*] # [*manage_polling*]
# (Optional) Whether to manage polling.yaml # (Optional) Whether to manage polling.yaml
# Defaults to false # Defaults to false
@ -72,6 +81,8 @@ class ceilometer::agent::polling (
$compute_namespace = true, $compute_namespace = true,
$ipmi_namespace = true, $ipmi_namespace = true,
$instance_discovery_method = $::os_service_default, $instance_discovery_method = $::os_service_default,
$resource_update_interval = $::os_service_default,
$resource_cache_expiry = $::os_service_default,
$manage_polling = false, $manage_polling = false,
$polling_interval = 600, $polling_interval = 600,
$polling_meters = $::ceilometer::params::polling_meters, $polling_meters = $::ceilometer::params::polling_meters,
@ -113,7 +124,9 @@ class ceilometer::agent::polling (
Package <| title == 'nova-common' |> -> Package['ceilometer-common'] Package <| title == 'nova-common' |> -> Package['ceilometer-common']
ceilometer_config { ceilometer_config {
'compute/instance_discovery_method': value => $instance_discovery_method, 'compute/instance_discovery_method': value => $instance_discovery_method;
'compute/resource_update_interval': value => $resource_update_interval;
'compute/resource_cache_expiry': value => $resource_cache_expiry;
} }
} else { } else {
$compute_namespace_name = '' $compute_namespace_name = ''

View File

@ -0,0 +1,5 @@
---
features:
- |
Support for the ``[compute] resource_update_interval`` parameter and
the ``[compute] resource_cache_expiry`` parameter has been added.

View File

@ -29,7 +29,11 @@ describe 'ceilometer::agent::polling' do
:before => /Package\[ceilometer-common\]/ :before => /Package\[ceilometer-common\]/
)} )}
it { should contain_ceilometer_config('compute/instance_discovery_method').with_value('<SERVICE DEFAULT>') } it {
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>')
}
it { should contain_package('ceilometer-polling').with( it { should contain_package('ceilometer-polling').with(
:ensure => 'present', :ensure => 'present',
@ -62,12 +66,20 @@ describe 'ceilometer::agent::polling' do
)} )}
end end
context 'when setting instance_discovery_method' do context 'when compute parameters set' do
before do before do
params.merge!( :instance_discovery_method => 'naive' ) params.merge!(
:instance_discovery_method => 'naive',
:resource_update_interval => 0,
:resource_cache_expiry => 3600,
)
end end
it { should contain_ceilometer_config('compute/instance_discovery_method').with_value('naive') } it {
should contain_ceilometer_config('compute/instance_discovery_method').with_value('naive')
should contain_ceilometer_config('compute/resource_update_interval').with_value(0)
should contain_ceilometer_config('compute/resource_cache_expiry').with_value(3600)
}
end end
context 'with central and ipmi polling namespaces disabled' do context 'with central and ipmi polling namespaces disabled' do