From 2613b67036b3a889b529ba62d936e167bc78da02 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 30 Sep 2020 21:56:42 +0900 Subject: [PATCH] libvirt: Add support for ovs_timeout Change-Id: I1ed0d16dab85473c8ffaa361fef8e1d842c382c2 --- manifests/compute/libvirt.pp | 47 ++++++++++++------- .../libvirt-ovs_timeout-832a00ff71950dd3.yaml | 5 ++ spec/classes/nova_compute_libvirt_spec.rb | 17 ++++--- 3 files changed, 46 insertions(+), 23 deletions(-) create mode 100644 releasenotes/notes/libvirt-ovs_timeout-832a00ff71950dd3.yaml diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp index 43837f35f..f9a4a858a 100644 --- a/manifests/compute/libvirt.pp +++ b/manifests/compute/libvirt.pp @@ -132,11 +132,6 @@ # 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 -# # [*rx_queue_size*] # (optional) virtio-net rx queue size # Valid values are 256, 512, 1024 @@ -174,6 +169,20 @@ # zero or negative value mean to disable memory usage statistics. # Defaults to $::os_service_default # +# [*pmem_namespaces*] +# (optional) Configure persistent memory(pmem) namespaces. These namespaces +# must have been already created on the host. This config option is in the +# following format: "$LABEL:$NSNAME[|$NSNAME][,$LABEL:$NSNAME[|$NSNAME]]" +# $NSNAME is the name of the pmem namespace. $LABEL represents one resource +# class, this is used to generate the resource class name as +# CUSTOM_PMEM_NAMESPACE_$LABEL. +# 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 @@ -187,14 +196,9 @@ # the global default settings. # Defaults to undef # -# [*pmem_namespaces*] -# (optional) Configure persistent memory(pmem) namespaces. These namespaces -# must have been already created on the host. This config option is in the -# following format: "$LABEL:$NSNAME[|$NSNAME][,$LABEL:$NSNAME[|$NSNAME]]" -# $NSNAME is the name of the pmem namespace. $LABEL represents one resource -# class, this is used to generate the resource class name as -# CUSTOM_PMEM_NAMESPACE_$LABEL. -# Defaults to $::os_service_default +# [*ovs_timeout*] +# (optional) A timeout for openvswitch calls made by libvirt +# Defaults to undef # # [*swtpm_enabled*] # (optional) Enable emulated Trusted Platform Module (TPM) for guests. @@ -303,7 +307,6 @@ class nova::compute::libvirt ( $compute_driver = 'libvirt.LibvirtDriver', $preallocate_images = $::os_service_default, $manage_libvirt_services = true, - $log_outputs = undef, $rx_queue_size = $::os_service_default, $tx_queue_size = $::os_service_default, $file_backed_memory = undef, @@ -311,12 +314,14 @@ 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, - $tls_priority = undef, $pmem_namespaces = $::os_service_default, $swtpm_enabled = $::os_service_default, $swtpm_user = $::os_service_default, $swtpm_group = $::os_service_default, + $log_outputs = undef, + $log_filters = undef, + $tls_priority = undef, + $ovs_timeout = undef, # DEPRECATED PARAMETERS $libvirt_virt_type = undef, $libvirt_cpu_mode = undef, @@ -478,6 +483,16 @@ in a future release. Use the enabled_perf_events parameter instead') } } + if $ovs_timeout { + libvirtd_config { + 'ovs_timeout': value => $ovs_timeout; + } + } else { + libvirtd_config { + 'ovs_timeout': ensure => 'absent'; + } + } + unless $rx_queue_size == $::os_service_default or $rx_queue_size in [256, 512, 1024] { fail("Invalid rx_queue_size parameter: ${rx_queue_size}") } diff --git a/releasenotes/notes/libvirt-ovs_timeout-832a00ff71950dd3.yaml b/releasenotes/notes/libvirt-ovs_timeout-832a00ff71950dd3.yaml new file mode 100644 index 000000000..12061e0ef --- /dev/null +++ b/releasenotes/notes/libvirt-ovs_timeout-832a00ff71950dd3.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The new ``nova::compute::libvirt::ovs_timeout`` parameter has been added + to support the ovs_timeout parameter in libvirtd.conf. diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index b4e146f89..c6476bc2a 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -74,6 +74,7 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_libvirtd_config('log_outputs').with_ensure('absent')} it { is_expected.to contain_libvirtd_config('log_filters').with_ensure('absent')} it { is_expected.to contain_libvirtd_config('tls_priority').with_ensure('absent')} + it { is_expected.to contain_libvirtd_config('ovs_timeout').with_ensure('absent')} end describe 'with params' do @@ -97,19 +98,20 @@ 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', :rx_queue_size => 512, :tx_queue_size => 1024, :volume_use_multipath => false, :nfs_mount_options => 'rw,intr,nolock', :num_pcie_ports => 16, :mem_stats_period_seconds => 20, - :log_filters => '1:qemu', - :tls_priority => 'NORMAL:-VERS-SSL3.0', :pmem_namespaces => '128G:ns0|ns1|ns2|ns3', :swtpm_enabled => true, :swtpm_user => 'libvirt', - :swtpm_group => 'libvirt' + :swtpm_group => 'libvirt', + :log_outputs => '1:file:/var/log/libvirt/libvirtd.log', + :log_filters => '1:qemu', + :tls_priority => 'NORMAL:-VERS-SSL3.0', + :ovs_timeout => 10, } end @@ -133,7 +135,6 @@ 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_nova_config('libvirt/rx_queue_size').with_value(512)} it { is_expected.to contain_nova_config('libvirt/tx_queue_size').with_value(1024)} it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value(false)} @@ -144,8 +145,10 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_nova_config('libvirt/swtpm_enabled').with_value(true)} it { is_expected.to contain_nova_config('libvirt/swtpm_user').with_value('libvirt')} it { is_expected.to contain_nova_config('libvirt/swtpm_group').with_value('libvirt')} - it { is_expected.to contain_libvirtd_config('log_filters').with_value("\"#{params[:log_filters]}\"")} - it { is_expected.to contain_libvirtd_config('tls_priority').with_value("\"#{params[:tls_priority]}\"")} + it { is_expected.to contain_libvirtd_config('log_outputs').with_value('"1:file:/var/log/libvirt/libvirtd.log"')} + it { is_expected.to contain_libvirtd_config('log_filters').with_value('"1:qemu"')} + it { is_expected.to contain_libvirtd_config('tls_priority').with_value('"NORMAL:-VERS-SSL3.0"')} + it { is_expected.to contain_libvirtd_config('ovs_timeout').with_value(10)} it { is_expected.to contain_service('libvirt').with( :name => 'custom_service',