Expose 'mem_stats_period_seconds' config parameter

Add support for configuring 'mem_stats_period_seconds'
libvirt config option.

When using the balloon stats in the XML configuration, user gets
latency violation in guests, because balloon stats causes QEMU to
periodically send asynchronous requests to balloon driver in the guest.

Conflicts:
      manifests/compute/libvirt.pp

Resolved conflicts related to other parameter defined in
newer releases but not available in this release.

Change-Id: If69d32fb4b718b97efbfbe0d58a37966af957be9
(cherry picked from commit 05d7733e2a)
(cherry picked from commit 4c5881a746)
(cherry picked from commit 070f926a65)
This commit is contained in:
Rajesh Tailor 2019-05-16 15:20:32 +05:30
parent 96ba42dd1e
commit dde32ec40b
3 changed files with 34 additions and 16 deletions

View File

@ -148,6 +148,11 @@
# nfs man page for details. # nfs man page for details.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*mem_stats_period_seconds*]
# (optional) A number of seconds to memory usage statistics period,
# zero or negative value mean to disable memory usage statistics.
# Defaults to $::os_service_default
#
class nova::compute::libvirt ( class nova::compute::libvirt (
$ensure_package = 'present', $ensure_package = 'present',
$libvirt_virt_type = 'kvm', $libvirt_virt_type = 'kvm',
@ -176,6 +181,7 @@ class nova::compute::libvirt (
$log_outputs = undef, $log_outputs = undef,
$volume_use_multipath = $::os_service_default, $volume_use_multipath = $::os_service_default,
$nfs_mount_options = $::os_service_default, $nfs_mount_options = $::os_service_default,
$mem_stats_period_seconds = $::os_service_default,
) inherits nova::params { ) inherits nova::params {
include ::nova::deps include ::nova::deps
@ -235,20 +241,21 @@ class nova::compute::libvirt (
} }
nova_config { nova_config {
'DEFAULT/compute_driver': value => $compute_driver; 'DEFAULT/compute_driver': value => $compute_driver;
'DEFAULT/preallocate_images': value => $preallocate_images; 'DEFAULT/preallocate_images': value => $preallocate_images;
'vnc/vncserver_listen': value => $vncserver_listen; 'vnc/vncserver_listen': value => $vncserver_listen;
'libvirt/virt_type': value => $libvirt_virt_type; 'libvirt/virt_type': value => $libvirt_virt_type;
'libvirt/cpu_mode': value => $libvirt_cpu_mode_real; 'libvirt/cpu_mode': value => $libvirt_cpu_mode_real;
'libvirt/snapshot_image_format': value => $libvirt_snapshot_image_format; 'libvirt/snapshot_image_format': value => $libvirt_snapshot_image_format;
'libvirt/inject_password': value => $libvirt_inject_password; 'libvirt/inject_password': value => $libvirt_inject_password;
'libvirt/inject_key': value => $libvirt_inject_key; 'libvirt/inject_key': value => $libvirt_inject_key;
'libvirt/inject_partition': value => $libvirt_inject_partition; 'libvirt/inject_partition': value => $libvirt_inject_partition;
'libvirt/hw_disk_discard': value => $libvirt_hw_disk_discard; 'libvirt/hw_disk_discard': value => $libvirt_hw_disk_discard;
'libvirt/hw_machine_type': value => $libvirt_hw_machine_type; 'libvirt/hw_machine_type': value => $libvirt_hw_machine_type;
'libvirt/enabled_perf_events': value => join(any2array($libvirt_enabled_perf_events), ','); 'libvirt/enabled_perf_events': value => join(any2array($libvirt_enabled_perf_events), ',');
'libvirt/volume_use_multipath': value => $volume_use_multipath; 'libvirt/volume_use_multipath': value => $volume_use_multipath;
'libvirt/nfs_mount_options': value => $nfs_mount_options; 'libvirt/nfs_mount_options': value => $nfs_mount_options;
'libvirt/mem_stats_period_seconds': value => $mem_stats_period_seconds;
} }
# cpu_model param is only valid if cpu_mode=custom # cpu_model param is only valid if cpu_mode=custom

View File

@ -0,0 +1,6 @@
---
features:
- |
Add parameter `mem_stats_period_seconds` to specify number
of seconds to memory usage statistics period, zero or negative
value mean to disable memory usage statistics.

View File

@ -62,6 +62,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_ensure('absent')} it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value('<SERVICE DEFAULT>')} it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_ensure('<SERVICE DEFAULT>')} it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_ensure('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value('<SERVICE DEFAULT>')}
end end
describe 'with params' do describe 'with params' do
@ -87,7 +88,8 @@ describe 'nova::compute::libvirt' do
:preallocate_images => 'space', :preallocate_images => 'space',
:log_outputs => '1:file:/var/log/libvirt/libvirtd.log', :log_outputs => '1:file:/var/log/libvirt/libvirtd.log',
:volume_use_multipath => false, :volume_use_multipath => false,
:nfs_mount_options => 'rw,intr,nolock' :nfs_mount_options => 'rw,intr,nolock',
:mem_stats_period_seconds => 20,
} }
end end
@ -113,6 +115,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_libvirtd_config('log_outputs').with_value("\"#{params[:log_outputs]}\"")} it { is_expected.to contain_libvirtd_config('log_outputs').with_value("\"#{params[:log_outputs]}\"")}
it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value(false)} it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value(false)}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')} it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')}
it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value(20)}
it { it {
is_expected.to contain_service('libvirt').with( is_expected.to contain_service('libvirt').with(
:name => 'custom_service', :name => 'custom_service',
@ -292,7 +295,8 @@ describe 'nova::compute::libvirt' do
:remove_unused_resized_minimum_age_seconds => 3600, :remove_unused_resized_minimum_age_seconds => 3600,
:remove_unused_original_minimum_age_seconds => 3600, :remove_unused_original_minimum_age_seconds => 3600,
:libvirt_enabled_perf_events => ['cmt', 'mbml', 'mbmt'], :libvirt_enabled_perf_events => ['cmt', 'mbml', 'mbmt'],
:nfs_mount_options => 'rw,intr,nolock' :nfs_mount_options => 'rw,intr,nolock',
:mem_stats_period_seconds => 20,
} }
end end
@ -303,6 +307,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_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_nova_config('libvirt/enabled_perf_events').with_value('cmt,mbml,mbmt')} it { is_expected.to contain_nova_config('libvirt/enabled_perf_events').with_value('cmt,mbml,mbmt')}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')} it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')}
it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value(20)}
it { is_expected.to contain_package('libvirt').with( it { is_expected.to contain_package('libvirt').with(
:name => 'libvirt-daemon-kvm', :name => 'libvirt-daemon-kvm',
:ensure => 'present' :ensure => 'present'