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)
changes/38/677238/1
Martin Schuppert 1 month ago
parent
commit
749e4fbb25

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

@@ -174,6 +174,12 @@
174 174
 #   zero or negative value mean to disable memory usage statistics.
175 175
 #   Defaults to $::os_service_default
176 176
 #
177
+# [*log_filters*]
178
+#   (optional) Defines a filter to select a different logging level
179
+#   for a given category log outputs, as specified in
180
+#   https://libvirt.org/logging.html
181
+#   Defaults to undef
182
+#
177 183
 class nova::compute::libvirt (
178 184
   $ensure_package                             = 'present',
179 185
   $libvirt_virt_type                          = 'kvm',
@@ -207,6 +213,7 @@ class nova::compute::libvirt (
207 213
   $nfs_mount_options                          = $::os_service_default,
208 214
   $num_pcie_ports                             = $::os_service_default,
209 215
   $mem_stats_period_seconds                   = $::os_service_default,
216
+  $log_filters                                = undef,
210 217
 ) inherits nova::params {
211 218
 
212 219
   include ::nova::deps
@@ -243,6 +250,12 @@ class nova::compute::libvirt (
243 250
     }
244 251
   }
245 252
 
253
+  if $log_filters {
254
+    libvirtd_config {
255
+      'log_filters': value => "\"${log_filters}\"";
256
+    }
257
+  }
258
+
246 259
   unless $rx_queue_size == $::os_service_default or $rx_queue_size in [256, 512, 1024] {
247 260
     fail("Invalid rx_queue_size parameter: ${rx_queue_size}")
248 261
   }

+ 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

@@ -68,6 +68,7 @@ describe 'nova::compute::libvirt' do
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/num_pcie_ports').with_ensure('<SERVICE DEFAULT>')}
70 70
       it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value('<SERVICE DEFAULT>')}
71
+      it { is_expected.to contain_libvirtd_config('log_filters').with_ensure('absent')}
71 72
     end
72 73
 
73 74
     describe 'with params' do
@@ -98,6 +99,7 @@ describe 'nova::compute::libvirt' do
98 99
           :nfs_mount_options                          => 'rw,intr,nolock',
99 100
           :num_pcie_ports                             => 16,
100 101
           :mem_stats_period_seconds                   => 20,
102
+          :log_filters                                => '1:qemu',
101 103
         }
102 104
       end
103 105
 
@@ -127,6 +129,7 @@ describe 'nova::compute::libvirt' do
127 129
       it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')}
128 130
       it { is_expected.to contain_nova_config('libvirt/num_pcie_ports').with_value(16)}
129 131
       it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value(20)}
132
+      it { is_expected.to contain_libvirtd_config('log_filters').with_value("\"#{params[:log_filters]}\"")}
130 133
       it {
131 134
         is_expected.to contain_service('libvirt').with(
132 135
           :name     => 'custom_service',

Loading…
Cancel
Save