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)
This commit is contained in:
Martin Schuppert 2019-08-14 13:46:55 +02:00
parent 070f926a65
commit bb8ff6cdc4
3 changed files with 23 additions and 0 deletions

View File

@ -163,6 +163,12 @@
# zero or negative value mean to disable memory usage statistics. # zero or negative value mean to disable memory usage statistics.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*log_filters*]
# (optional) Defines a filter to select a different logging level
# for a given category log outputs, as specified in
# https://libvirt.org/logging.html
# Defaults to undef
#
class nova::compute::libvirt ( class nova::compute::libvirt (
$ensure_package = 'present', $ensure_package = 'present',
$libvirt_virt_type = 'kvm', $libvirt_virt_type = 'kvm',
@ -194,6 +200,7 @@ class nova::compute::libvirt (
$volume_use_multipath = $::os_service_default, $volume_use_multipath = $::os_service_default,
$nfs_mount_options = $::os_service_default, $nfs_mount_options = $::os_service_default,
$mem_stats_period_seconds = $::os_service_default, $mem_stats_period_seconds = $::os_service_default,
$log_filters = undef,
) inherits nova::params { ) inherits nova::params {
include ::nova::deps include ::nova::deps
@ -230,6 +237,12 @@ class nova::compute::libvirt (
} }
} }
if $log_filters {
libvirtd_config {
'log_filters': value => "\"${log_filters}\"";
}
}
unless $rx_queue_size == $::os_service_default or $rx_queue_size in [256, 512, 1024] { unless $rx_queue_size == $::os_service_default or $rx_queue_size in [256, 512, 1024] {
fail("Invalid rx_queue_size parameter: ${rx_queue_size}") fail("Invalid rx_queue_size parameter: ${rx_queue_size}")
} }

View File

@ -0,0 +1,7 @@
---
features:
- |
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

View File

@ -67,6 +67,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value('<SERVICE DEFAULT>')} it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_ensure('<SERVICE DEFAULT>')} it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_ensure('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value('<SERVICE DEFAULT>')} it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_libvirtd_config('log_filters').with_ensure('absent')}
end end
describe 'with params' do describe 'with params' do
@ -96,6 +97,7 @@ describe 'nova::compute::libvirt' do
:volume_use_multipath => false, :volume_use_multipath => false,
:nfs_mount_options => 'rw,intr,nolock', :nfs_mount_options => 'rw,intr,nolock',
:mem_stats_period_seconds => 20, :mem_stats_period_seconds => 20,
:log_filters => '1:qemu',
} }
end end
@ -124,6 +126,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value(false)} it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value(false)}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')} it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')}
it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value(20)} it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value(20)}
it { is_expected.to contain_libvirtd_config('log_filters').with_value("\"#{params[:log_filters]}\"")}
it { it {
is_expected.to contain_service('libvirt').with( is_expected.to contain_service('libvirt').with(
:name => 'custom_service', :name => 'custom_service',