Create a separate class for libvirtd settings
Currently we have separate classes for individual daemons except for libvirtd. This change splits out the libvirtd settings to make class structure consistent. Change-Id: I13fb819ad0f561d8fcd53430cb62318bd38b8766
This commit is contained in:
parent
e192c9c789
commit
18c4b34d6b
@ -200,28 +200,6 @@
|
||||
# Trusted Platform Module (TPM) functionality, runs as.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*log_outputs*]
|
||||
# (optional) Defines log outputs, as specified in
|
||||
# https://libvirt.org/logging.html
|
||||
# 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 $::os_service_default
|
||||
#
|
||||
# [*tls_priority*]
|
||||
# (optional) Override the compile time default TLS priority string. The
|
||||
# default is usually "NORMAL" unless overridden at build time.
|
||||
# Only set this if it is desired for libvirt to deviate from
|
||||
# the global default settings.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*ovs_timeout*]
|
||||
# (optional) A timeout for openvswitch calls made by libvirt
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*max_queues*]
|
||||
# (optional) The maximum number of virtio queue pairs that can be enabled
|
||||
# when creating a multiqueue guest. The number of virtio queues allocated
|
||||
@ -235,6 +213,28 @@
|
||||
# run concurrently on this compute host.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*log_outputs*]
|
||||
# (optional) Defines log outputs, as specified in
|
||||
# https://libvirt.org/logging.html
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*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
|
||||
#
|
||||
# [*tls_priority*]
|
||||
# (optional) Override the compile time default TLS priority string. The
|
||||
# default is usually "NORMAL" unless overridden at build time.
|
||||
# Only set this if it is desired for libvirt to deviate from
|
||||
# the global default settings.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*ovs_timeout*]
|
||||
# (optional) A timeout for openvswitch calls made by libvirt
|
||||
# Defaults to undef
|
||||
#
|
||||
class nova::compute::libvirt (
|
||||
$ensure_package = 'present',
|
||||
$virt_type = 'kvm',
|
||||
@ -274,12 +274,13 @@ class nova::compute::libvirt (
|
||||
$swtpm_enabled = $::os_service_default,
|
||||
$swtpm_user = $::os_service_default,
|
||||
$swtpm_group = $::os_service_default,
|
||||
$log_outputs = $::os_service_default,
|
||||
$log_filters = $::os_service_default,
|
||||
$tls_priority = $::os_service_default,
|
||||
$ovs_timeout = $::os_service_default,
|
||||
$max_queues = $::os_service_default,
|
||||
$num_memory_encrypted_guests = $::os_service_default,
|
||||
# DEPRECATED PARAMETERS
|
||||
$log_outputs = undef,
|
||||
$log_filters = undef,
|
||||
$tls_priority = undef,
|
||||
$ovs_timeout = undef,
|
||||
) inherits nova::params {
|
||||
|
||||
include nova::deps
|
||||
@ -311,11 +312,11 @@ class nova::compute::libvirt (
|
||||
}
|
||||
|
||||
if !$modular_libvirt {
|
||||
libvirtd_config {
|
||||
'log_outputs': value => $log_outputs, quote => true;
|
||||
'log_filters': value => $log_filters, quote => true;
|
||||
'tls_priority': value => $tls_priority, quote => true;
|
||||
'ovs_timeout': value => $ovs_timeout;
|
||||
['log_outputs', 'log_filters', 'tls_priority', 'ovs_timeout'].each |String $libvirtd_opt| {
|
||||
if getvar($libvirtd_opt) != undef {
|
||||
warning("The ${libvirtd_opt} parameter is deprecated. Use the nova::compute::libvirt::libvirtd class.")
|
||||
include nova::compute::libvirt::libvirtd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
68
manifests/compute/libvirt/libvirtd.pp
Normal file
68
manifests/compute/libvirt/libvirtd.pp
Normal file
@ -0,0 +1,68 @@
|
||||
# == Class: nova::compute::libvirt::libvirtd
|
||||
#
|
||||
# libvirtd configuration
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*log_level*]
|
||||
# Defines a log level to filter log outputs.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*log_filters*]
|
||||
# Defines a log filter to select a different logging level for
|
||||
# for a given category log outputs.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*log_outputs*]
|
||||
# (optional) Defines log outputs, as specified in
|
||||
# https://libvirt.org/logging.html
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*max_clients*]
|
||||
# The maximum number of concurrent client connections to allow
|
||||
# on primary socket.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*admin_max_clients*]
|
||||
# The maximum number of concurrent client connections to allow
|
||||
# on administrative socket.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*tls_priority*]
|
||||
# (optional) Override the compile time default TLS priority string. The
|
||||
# default is usually "NORMAL" unless overridden at build time.
|
||||
# Only set this if it is desired for libvirt to deviate from
|
||||
# the global default settings.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*ovs_timeout*]
|
||||
# (optional) A timeout for openvswitch calls made by libvirt
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class nova::compute::libvirt::libvirtd (
|
||||
$log_level = $::os_service_default,
|
||||
$log_filters = $::os_service_default,
|
||||
$log_outputs = $::os_service_default,
|
||||
$max_clients = $::os_service_default,
|
||||
$admin_max_clients = $::os_service_default,
|
||||
$tls_priority = $::os_service_default,
|
||||
$ovs_timeout = $::os_service_default,
|
||||
) {
|
||||
|
||||
include nova::deps
|
||||
|
||||
$log_outputs_real = pick($::nova::compute::libvirt::log_outputs, $log_outputs)
|
||||
$log_filters_real = pick($::nova::compute::libvirt::log_filters, $log_filters)
|
||||
$tls_priority_real = pick($::nova::compute::libvirt::tls_prority, $tls_priority)
|
||||
$ovs_timeout_real = pick($::nova::compute::libvirt::ovs_timeout, $ovs_timeout)
|
||||
|
||||
libvirtd_config {
|
||||
'log_level': value => $log_level;
|
||||
'log_filters': value => $log_filters_real, quote => true;
|
||||
'log_outputs': value => $log_outputs_real, quote => true;
|
||||
'max_clients': value => $max_clients;
|
||||
'admin_max_clients': value => $admin_max_clients;
|
||||
'tls_priority': value => $tls_priority_real, quote => true;
|
||||
'ovs_timeout': value => $ovs_timeout_real;
|
||||
}
|
||||
}
|
14
releasenotes/notes/libvirtd-class-88111b4a2aa40336.yaml
Normal file
14
releasenotes/notes/libvirtd-class-88111b4a2aa40336.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
The following parameters of the ``nova::compute::libvirt`` class have been
|
||||
deprecated. Use the ``nova::compute::libvirt::libvirtd`` class intead.
|
||||
|
||||
- ``log_output``
|
||||
- ``log_filters``
|
||||
- ``tls_priority``
|
||||
- ``ovs_timeout``
|
||||
|
||||
features:
|
||||
- |
|
||||
The new ``nova::compute::libvirt::libvirtd`` class has been added.
|
71
spec/classes/nova_compute_libvirt_libvirtd_spec.rb
Normal file
71
spec/classes/nova_compute_libvirt_libvirtd_spec.rb
Normal file
@ -0,0 +1,71 @@
|
||||
# Unit tests for nova::compute::libvirt::libvirtd class
|
||||
#
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'nova::compute::libvirt::libvirtd' do
|
||||
|
||||
let :pre_condition do
|
||||
<<-eos
|
||||
include nova
|
||||
include nova::compute
|
||||
include nova::compute::libvirt
|
||||
eos
|
||||
end
|
||||
|
||||
shared_examples_for 'nova-compute-libvirt-libvirtd' do
|
||||
|
||||
context 'with default parameters' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class('nova::deps')}
|
||||
it { is_expected.to contain_class('nova::compute::libvirt::libvirtd')}
|
||||
|
||||
it { is_expected.to contain_libvirtd_config('log_level').with_value('<SERVICE DEFAULT>')}
|
||||
it { is_expected.to contain_libvirtd_config('log_outputs').with_value('<SERVICE DEFAULT>').with_quote(true)}
|
||||
it { is_expected.to contain_libvirtd_config('log_filters').with_value('<SERVICE DEFAULT>').with_quote(true)}
|
||||
it { is_expected.to contain_libvirtd_config('max_clients').with_value('<SERVICE DEFAULT>')}
|
||||
it { is_expected.to contain_libvirtd_config('admin_max_clients').with_value('<SERVICE DEFAULT>')}
|
||||
it { is_expected.to contain_libvirtd_config('tls_priority').with_value('<SERVICE DEFAULT>').with_quote(true)}
|
||||
it { is_expected.to contain_libvirtd_config('ovs_timeout').with_value('<SERVICE DEFAULT>')}
|
||||
end
|
||||
|
||||
context 'with specified parameters' do
|
||||
let :params do
|
||||
{ :log_level => 3,
|
||||
:log_outputs => '3:syslog',
|
||||
:log_filters => '1:logging 4:object 4:json 4:event 1:util',
|
||||
:max_clients => 1024,
|
||||
:admin_max_clients => 5,
|
||||
:tls_priority => 'NORMAL',
|
||||
:ovs_timeout => 20,
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class('nova::deps')}
|
||||
it { is_expected.to contain_class('nova::compute::libvirt::libvirtd')}
|
||||
|
||||
it { is_expected.to contain_libvirtd_config('log_level').with_value(params[:log_level])}
|
||||
it { is_expected.to contain_libvirtd_config('log_outputs').with_value(params[:log_outputs]).with_quote(true)}
|
||||
it { is_expected.to contain_libvirtd_config('log_filters').with_value(params[:log_filters]).with_quote(true)}
|
||||
it { is_expected.to contain_libvirtd_config('max_clients').with_value(params[:max_clients])}
|
||||
it { is_expected.to contain_libvirtd_config('admin_max_clients').with_value(params[:admin_max_clients])}
|
||||
it { is_expected.to contain_libvirtd_config('tls_priority').with_value(params[:tls_priority]).with_quote(true)}
|
||||
it { is_expected.to contain_libvirtd_config('ovs_timeout').with_value(params[:ovs_timeout])}
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'nova-compute-libvirt-libvirtd'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -75,10 +75,6 @@ describe 'nova::compute::libvirt' do
|
||||
it { is_expected.to contain_nova_config('libvirt/swtpm_group').with_value('<SERVICE DEFAULT>')}
|
||||
it { is_expected.to contain_nova_config('libvirt/max_queues').with_value('<SERVICE DEFAULT>')}
|
||||
it { is_expected.to contain_nova_config('libvirt/num_memory_encrypted_guests').with_value('<SERVICE DEFAULT>')}
|
||||
it { is_expected.to contain_libvirtd_config('log_outputs').with_value('<SERVICE DEFAULT>').with_quote(true)}
|
||||
it { is_expected.to contain_libvirtd_config('log_filters').with_value('<SERVICE DEFAULT>').with_quote(true)}
|
||||
it { is_expected.to contain_libvirtd_config('tls_priority').with_value('<SERVICE DEFAULT>').with_quote(true)}
|
||||
it { is_expected.to contain_libvirtd_config('ovs_timeout').with_value('<SERVICE DEFAULT>')}
|
||||
end
|
||||
|
||||
describe 'with params' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user