diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp index 408a5f60a..3f51fe304 100644 --- a/manifests/compute/libvirt.pp +++ b/manifests/compute/libvirt.pp @@ -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 # diff --git a/releasenotes/notes/libvirtd-log-outputs-cd93433d0bfe2e63.yaml b/releasenotes/notes/libvirtd-log-outputs-cd93433d0bfe2e63.yaml new file mode 100644 index 000000000..405d91c51 --- /dev/null +++ b/releasenotes/notes/libvirtd-log-outputs-cd93433d0bfe2e63.yaml @@ -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 diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index 100eecf53..2fe38d280 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -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',