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)
changes/98/677998/1
Martin Schuppert 1 month ago
parent
commit
bb8ff6cdc4

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

@@ -163,6 +163,12 @@
163 163
 #   zero or negative value mean to disable memory usage statistics.
164 164
 #   Defaults to $::os_service_default
165 165
 #
166
+# [*log_filters*]
167
+#   (optional) Defines a filter to select a different logging level
168
+#   for a given category log outputs, as specified in
169
+#   https://libvirt.org/logging.html
170
+#   Defaults to undef
171
+#
166 172
 class nova::compute::libvirt (
167 173
   $ensure_package                             = 'present',
168 174
   $libvirt_virt_type                          = 'kvm',
@@ -194,6 +200,7 @@ class nova::compute::libvirt (
194 200
   $volume_use_multipath                       = $::os_service_default,
195 201
   $nfs_mount_options                          = $::os_service_default,
196 202
   $mem_stats_period_seconds                   = $::os_service_default,
203
+  $log_filters                                = undef,
197 204
 ) inherits nova::params {
198 205
 
199 206
   include ::nova::deps
@@ -230,6 +237,12 @@ class nova::compute::libvirt (
230 237
     }
231 238
   }
232 239
 
240
+  if $log_filters {
241
+    libvirtd_config {
242
+      'log_filters': value => "\"${log_filters}\"";
243
+    }
244
+  }
245
+
233 246
   unless $rx_queue_size == $::os_service_default or $rx_queue_size in [256, 512, 1024] {
234 247
     fail("Invalid rx_queue_size parameter: ${rx_queue_size}")
235 248
   }

+ 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

@@ -67,6 +67,7 @@ describe 'nova::compute::libvirt' do
67 67
       it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value('<SERVICE DEFAULT>')}
68 68
       it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_ensure('<SERVICE DEFAULT>')}
69 69
       it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value('<SERVICE DEFAULT>')}
70
+      it { is_expected.to contain_libvirtd_config('log_filters').with_ensure('absent')}
70 71
     end
71 72
 
72 73
     describe 'with params' do
@@ -96,6 +97,7 @@ describe 'nova::compute::libvirt' do
96 97
           :volume_use_multipath                       => false,
97 98
           :nfs_mount_options                          => 'rw,intr,nolock',
98 99
           :mem_stats_period_seconds                   => 20,
100
+          :log_filters                                => '1:qemu',
99 101
         }
100 102
       end
101 103
 
@@ -124,6 +126,7 @@ describe 'nova::compute::libvirt' do
124 126
       it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value(false)}
125 127
       it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')}
126 128
       it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value(20)}
129
+      it { is_expected.to contain_libvirtd_config('log_filters').with_value("\"#{params[:log_filters]}\"")}
127 130
       it {
128 131
         is_expected.to contain_service('libvirt').with(
129 132
           :name     => 'custom_service',

Loading…
Cancel
Save