Browse Source

Adds log_filters parameter to nova::compute::libvirt

Defines a filter to select a different logging level
for a given category log outputs, as specified in
https://libvirt.org/logging.html. Default undef

Change-Id: Ic48afe856ae60654d6cebf627b12509881933c59
Related-Bug: #1840140
(cherry picked from commit 0b0bd40065)
(cherry picked from commit 749e4fbb25)
(cherry picked from commit bb8ff6cdc4)
tags/12.5.0
Martin Schuppert 1 month ago
parent
commit
78e70e16e2

+ 13
- 0
manifests/compute/libvirt.pp View File

@@ -153,6 +153,12 @@
153 153
 #   zero or negative value mean to disable memory usage statistics.
154 154
 #   Defaults to $::os_service_default
155 155
 #
156
+# [*log_filters*]
157
+#   (optional) Defines a filter to select a different logging level
158
+#   for a given category log outputs, as specified in
159
+#   https://libvirt.org/logging.html
160
+#   Defaults to undef
161
+#
156 162
 class nova::compute::libvirt (
157 163
   $ensure_package                             = 'present',
158 164
   $libvirt_virt_type                          = 'kvm',
@@ -182,6 +188,7 @@ class nova::compute::libvirt (
182 188
   $volume_use_multipath                       = $::os_service_default,
183 189
   $nfs_mount_options                          = $::os_service_default,
184 190
   $mem_stats_period_seconds                   = $::os_service_default,
191
+  $log_filters                                = undef,
185 192
 ) inherits nova::params {
186 193
 
187 194
   include ::nova::deps
@@ -218,6 +225,12 @@ class nova::compute::libvirt (
218 225
     }
219 226
   }
220 227
 
228
+  if $log_filters {
229
+    libvirtd_config {
230
+      'log_filters': value => "\"${log_filters}\"";
231
+    }
232
+  }
233
+
221 234
   # manage_libvirt_services is here for backward compatibility to support
222 235
   # deployments that do not include nova::compute::libvirt::services
223 236
   #

+ 7
- 0
releasenotes/notes/libvirtd_log_filters-22e461e00f482d69.yaml View File

@@ -0,0 +1,7 @@
1
+---
2
+features:
3
+  - |
4
+    Adds log_filters parameter to nova::compute::libvirt.
5
+    Defines a filter to select a different logging level
6
+    for a given category log outputs, as specified in
7
+    https://libvirt.org/logging.html . Default undef

+ 3
- 0
spec/classes/nova_compute_libvirt_spec.rb View File

@@ -63,6 +63,7 @@ describe 'nova::compute::libvirt' do
63 63
       it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value('<SERVICE DEFAULT>')}
64 64
       it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_ensure('<SERVICE DEFAULT>')}
65 65
       it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value('<SERVICE DEFAULT>')}
66
+      it { is_expected.to contain_libvirtd_config('log_filters').with_ensure('absent')}
66 67
     end
67 68
 
68 69
     describe 'with params' do
@@ -90,6 +91,7 @@ describe 'nova::compute::libvirt' do
90 91
           :volume_use_multipath                       => false,
91 92
           :nfs_mount_options                          => 'rw,intr,nolock',
92 93
           :mem_stats_period_seconds                   => 20,
94
+          :log_filters                                => '1:qemu',
93 95
         }
94 96
       end
95 97
 
@@ -116,6 +118,7 @@ describe 'nova::compute::libvirt' do
116 118
       it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value(false)}
117 119
       it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')}
118 120
       it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value(20)}
121
+      it { is_expected.to contain_libvirtd_config('log_filters').with_value("\"#{params[:log_filters]}\"")}
119 122
       it {
120 123
         is_expected.to contain_service('libvirt').with(
121 124
           :name     => 'custom_service',

Loading…
Cancel
Save