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

View File

@ -174,6 +174,12 @@
# zero or negative value mean to disable memory usage statistics.
# 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 (
$ensure_package = 'present',
$libvirt_virt_type = 'kvm',
@ -207,6 +213,7 @@ class nova::compute::libvirt (
$nfs_mount_options = $::os_service_default,
$num_pcie_ports = $::os_service_default,
$mem_stats_period_seconds = $::os_service_default,
$log_filters = undef,
) inherits nova::params {
include ::nova::deps
@ -243,6 +250,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] {
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

@ -68,6 +68,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_ensure('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/num_pcie_ports').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_libvirtd_config('log_filters').with_ensure('absent')}
end
describe 'with params' do
@ -98,6 +99,7 @@ describe 'nova::compute::libvirt' do
:nfs_mount_options => 'rw,intr,nolock',
:num_pcie_ports => 16,
:mem_stats_period_seconds => 20,
:log_filters => '1:qemu',
}
end
@ -127,6 +129,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')}
it { is_expected.to contain_nova_config('libvirt/num_pcie_ports').with_value(16)}
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 {
is_expected.to contain_service('libvirt').with(
:name => 'custom_service',