Expose log_outputs parameter for libvirt

This allows us to configure where the libvirt logs end up, as described
in the documentation: https://libvirt.org/logging.html

Change-Id: Ia74e138aeeb1e09e253707de70ea9d0a4344ad1a
This commit is contained in:
Juan Antonio Osorio Robles 2017-10-09 14:50:02 +03:00
parent 2f1681f4a5
commit e844cefa63
3 changed files with 22 additions and 0 deletions

View File

@ -126,6 +126,11 @@
# you actually want to deploy.
# Defaults to true for backward compatibility.
#
# [*log_outputs*]
# (optional) Defines log outputs, as specified in
# https://libvirt.org/logging.html
# Defaults to undef
#
class nova::compute::libvirt (
$ensure_package = 'present',
$libvirt_virt_type = 'kvm',
@ -150,6 +155,7 @@ class nova::compute::libvirt (
$compute_driver = 'libvirt.LibvirtDriver',
$preallocate_images = $::os_service_default,
$manage_libvirt_services = true,
$log_outputs = undef,
) inherits nova::params {
include ::nova::deps
@ -180,6 +186,12 @@ class nova::compute::libvirt (
include ::nova::migration::libvirt
}
if $log_outputs {
libvirtd_config {
'log_outputs': value => "\"${log_outputs}\"";
}
}
# manage_libvirt_services is here for backward compatibility to support
# deployments that do not include nova::compute::libvirt::services
#

View File

@ -0,0 +1,8 @@
---
features:
- |
The parameter log_outputs in the libvirt manifest has been expose in order
to be able to configure where the libvirtd logs end up (which could be in
multiple places depending on the value for that parameter). It configures
the configuration value with the same name, as explained in the
documentation - https://libvirt.org/logging.html

View File

@ -81,6 +81,7 @@ describe 'nova::compute::libvirt' do
:virtlog_service_name => 'virtlog',
:compute_driver => 'libvirt.FoobarDriver',
:preallocate_images => 'space',
:log_outputs => '1:file:/var/log/libvirt/libvirtd.log'
}
end
@ -102,6 +103,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_base_images').with_value(true)}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_value(3600)}
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_value(3600)}
it { is_expected.to contain_libvirtd_config('log_outputs').with_value("\"#{params[:log_outputs]}\"")}
it {
is_expected.to contain_service('libvirt').with(
:name => 'custom_service',