]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
compute: Add support for tunables parameters
authorTakashi Kajinami <tkajinam@redhat.com>
Fri, 17 Dec 2021 06:39:14 +0000 (15:39 +0900)
committerYadnesh Kulkarni <yadnesh_kulkarni@proton.me>
Mon, 17 Apr 2023 06:53:11 +0000 (12:23 +0530)
Change-Id: I21c1f7b46c008131301a86ab01616dd9b63b610d
(cherry picked from commit 6892474ace1d02260f074c48eabf409cb16fdfb9)

manifests/agent/polling.pp
releasenotes/notes/compute-params-ecee48b43a1bdad2.yaml [new file with mode: 0644]
spec/classes/ceilometer_agent_polling_spec.rb

index 6b895d0ac52e278adb32ec0d5937dea1a5f870d2..c0914492a7a619278c9dd211b7d2c9605dc56a09 100644 (file)
 #    * libvirt_metadata: get instances from libvirt metadata
 #      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*]
 #   (Optional) Whether to manage polling.yaml
 #   Defaults to false
@@ -68,6 +77,8 @@ class ceilometer::agent::polling (
   $compute_namespace         = true,
   $ipmi_namespace            = true,
   $instance_discovery_method = $::os_service_default,
+  $resource_update_interval  = $::os_service_default,
+  $resource_cache_expiry     = $::os_service_default,
   $manage_polling            = false,
   $polling_interval          = 600,
   $polling_meters            = $::ceilometer::params::polling_meters,
@@ -108,7 +119,9 @@ class ceilometer::agent::polling (
     Package <| title == 'nova-common' |> -> Package['ceilometer-common']
 
     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 {
     $compute_namespace_name = undef
diff --git a/releasenotes/notes/compute-params-ecee48b43a1bdad2.yaml b/releasenotes/notes/compute-params-ecee48b43a1bdad2.yaml
new file mode 100644 (file)
index 0000000..495d72e
--- /dev/null
@@ -0,0 +1,5 @@
+---
+features:
+  - |
+    Support for the ``[compute] resource_update_interval`` parameter and
+    the ``[compute] resource_cache_expiry`` parameter has been added.
index 921d2854a863fb54af55c27370afd44f5342f019..40e7d979247046e387cdf369cac3f9fb88be7c78 100644 (file)
@@ -29,7 +29,11 @@ describe 'ceilometer::agent::polling' do
        :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(
         :ensure => 'present',
@@ -61,12 +65,20 @@ describe 'ceilometer::agent::polling' do
       )}
     end
 
-    context 'when setting instance_discovery_method' do
+    context 'when compute parameters set' do
       before do
-        params.merge!( :instance_discovery_method => 'naive' )
+        params.merge!(
+          :instance_discovery_method => 'naive',
+          :resource_update_interval  => 0,
+          :resource_cache_expiry     => 3600,
+        )
       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
 
     context 'with compute namespace disabled' do