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. Change-Id: If69d32fb4b718b97efbfbe0d58a37966af957be9
This commit is contained in:
		@@ -169,6 +169,11 @@
 | 
			
		||||
#  for hotplug use.
 | 
			
		||||
#  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 (
 | 
			
		||||
  $ensure_package                             = 'present',
 | 
			
		||||
  $libvirt_virt_type                          = 'kvm',
 | 
			
		||||
@@ -201,6 +206,7 @@ class nova::compute::libvirt (
 | 
			
		||||
  $volume_use_multipath                       = $::os_service_default,
 | 
			
		||||
  $nfs_mount_options                          = $::os_service_default,
 | 
			
		||||
  $num_pcie_ports                             = $::os_service_default,
 | 
			
		||||
  $mem_stats_period_seconds                   = $::os_service_default,
 | 
			
		||||
) inherits nova::params {
 | 
			
		||||
 | 
			
		||||
  include ::nova::deps
 | 
			
		||||
@@ -268,24 +274,25 @@ class nova::compute::libvirt (
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  nova_config {
 | 
			
		||||
    'DEFAULT/compute_driver':        value => $compute_driver;
 | 
			
		||||
    'DEFAULT/preallocate_images':    value => $preallocate_images;
 | 
			
		||||
    'vnc/vncserver_listen':          value => $vncserver_listen;
 | 
			
		||||
    'libvirt/virt_type':             value => $libvirt_virt_type;
 | 
			
		||||
    'libvirt/cpu_mode':              value => $libvirt_cpu_mode_real;
 | 
			
		||||
    'libvirt/snapshot_image_format': value => $libvirt_snapshot_image_format;
 | 
			
		||||
    'libvirt/inject_password':       value => $libvirt_inject_password;
 | 
			
		||||
    'libvirt/inject_key':            value => $libvirt_inject_key;
 | 
			
		||||
    'libvirt/inject_partition':      value => $libvirt_inject_partition;
 | 
			
		||||
    'libvirt/hw_disk_discard':       value => $libvirt_hw_disk_discard;
 | 
			
		||||
    'libvirt/hw_machine_type':       value => $libvirt_hw_machine_type;
 | 
			
		||||
    'libvirt/enabled_perf_events':   value => join(any2array($libvirt_enabled_perf_events), ',');
 | 
			
		||||
    'libvirt/rx_queue_size':         value => $rx_queue_size;
 | 
			
		||||
    'libvirt/tx_queue_size':         value => $tx_queue_size;
 | 
			
		||||
    'libvirt/file_backed_memory':    value => $file_backed_memory;
 | 
			
		||||
    'libvirt/volume_use_multipath':  value => $volume_use_multipath;
 | 
			
		||||
    'libvirt/nfs_mount_options':     value => $nfs_mount_options;
 | 
			
		||||
    'libvirt/num_pcie_ports':        value => $num_pcie_ports;
 | 
			
		||||
    'DEFAULT/compute_driver':           value => $compute_driver;
 | 
			
		||||
    'DEFAULT/preallocate_images':       value => $preallocate_images;
 | 
			
		||||
    'vnc/vncserver_listen':             value => $vncserver_listen;
 | 
			
		||||
    'libvirt/virt_type':                value => $libvirt_virt_type;
 | 
			
		||||
    'libvirt/cpu_mode':                 value => $libvirt_cpu_mode_real;
 | 
			
		||||
    'libvirt/snapshot_image_format':    value => $libvirt_snapshot_image_format;
 | 
			
		||||
    'libvirt/inject_password':          value => $libvirt_inject_password;
 | 
			
		||||
    'libvirt/inject_key':               value => $libvirt_inject_key;
 | 
			
		||||
    'libvirt/inject_partition':         value => $libvirt_inject_partition;
 | 
			
		||||
    'libvirt/hw_disk_discard':          value => $libvirt_hw_disk_discard;
 | 
			
		||||
    'libvirt/hw_machine_type':          value => $libvirt_hw_machine_type;
 | 
			
		||||
    'libvirt/enabled_perf_events':      value => join(any2array($libvirt_enabled_perf_events), ',');
 | 
			
		||||
    'libvirt/rx_queue_size':            value => $rx_queue_size;
 | 
			
		||||
    'libvirt/tx_queue_size':            value => $tx_queue_size;
 | 
			
		||||
    'libvirt/file_backed_memory':       value => $file_backed_memory;
 | 
			
		||||
    'libvirt/volume_use_multipath':     value => $volume_use_multipath;
 | 
			
		||||
    'libvirt/nfs_mount_options':        value => $nfs_mount_options;
 | 
			
		||||
    'libvirt/num_pcie_ports':           value => $num_pcie_ports;
 | 
			
		||||
    'libvirt/mem_stats_period_seconds': value => $mem_stats_period_seconds;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  # cpu_model param is only valid if cpu_mode=custom
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
@@ -67,6 +67,7 @@ describe 'nova::compute::libvirt' do
 | 
			
		||||
      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/num_pcie_ports').with_ensure('<SERVICE DEFAULT>')}
 | 
			
		||||
      it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value('<SERVICE DEFAULT>')}
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    describe 'with params' do
 | 
			
		||||
@@ -95,7 +96,8 @@ describe 'nova::compute::libvirt' do
 | 
			
		||||
          :tx_queue_size                              => 1024,
 | 
			
		||||
          :volume_use_multipath                       => false,
 | 
			
		||||
          :nfs_mount_options                          => 'rw,intr,nolock',
 | 
			
		||||
          :num_pcie_ports                             => 16
 | 
			
		||||
          :num_pcie_ports                             => 16,
 | 
			
		||||
          :mem_stats_period_seconds                   => 20,
 | 
			
		||||
        }
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
@@ -124,6 +126,7 @@ describe 'nova::compute::libvirt' do
 | 
			
		||||
      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/num_pcie_ports').with_value(16)}
 | 
			
		||||
      it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value(20)}
 | 
			
		||||
      it {
 | 
			
		||||
        is_expected.to contain_service('libvirt').with(
 | 
			
		||||
          :name     => 'custom_service',
 | 
			
		||||
@@ -303,7 +306,8 @@ describe 'nova::compute::libvirt' do
 | 
			
		||||
          :remove_unused_resized_minimum_age_seconds  => 3600,
 | 
			
		||||
          :remove_unused_original_minimum_age_seconds => 3600,
 | 
			
		||||
          :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
 | 
			
		||||
 | 
			
		||||
@@ -314,6 +318,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/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/mem_stats_period_seconds').with_value(20)}
 | 
			
		||||
      it { is_expected.to contain_package('libvirt').with(
 | 
			
		||||
        :name   => 'libvirt-daemon-kvm',
 | 
			
		||||
        :ensure => 'present'
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user