diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp index cb635083a..86727cc08 100644 --- a/manifests/compute/libvirt.pp +++ b/manifests/compute/libvirt.pp @@ -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 diff --git a/releasenotes/notes/nova_libvirt_mem_stats_period_seconds-679de08855e07254.yaml b/releasenotes/notes/nova_libvirt_mem_stats_period_seconds-679de08855e07254.yaml new file mode 100644 index 000000000..1b58bd0b2 --- /dev/null +++ b/releasenotes/notes/nova_libvirt_mem_stats_period_seconds-679de08855e07254.yaml @@ -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. diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index 38f012360..81ebd67ee 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -67,6 +67,7 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value('')} it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_ensure('')} it { is_expected.to contain_nova_config('libvirt/num_pcie_ports').with_ensure('')} + it { is_expected.to contain_nova_config('libvirt/mem_stats_period_seconds').with_value('')} 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'