From 8ed5c5e974b35c65bdee617e9881c833179a7b7c Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Mon, 15 May 2017 16:54:01 -0600 Subject: [PATCH] Properly handle arrays for enabled_perf_events Since the nova_config provider assumes that arrays are multi-str configuration items, the enabled_perf_events would not be properly configured if an array was provided. This resulted in idempotency issues when [] was used as well as dropping values if ['cmt','mbml'] was passed. This change ensures a comma seperated list is used for the configuration value of enabled_perf_events. Change-Id: I41ad1d4a7f14acae10e673676cd8adc98eddbec5 Closes-Bug: #1690946 --- manifests/compute/libvirt.pp | 2 +- .../libvirt-enabled-perf-events-fix-79be68140b4e9a81.yaml | 6 ++++++ spec/classes/nova_compute_libvirt_spec.rb | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/libvirt-enabled-perf-events-fix-79be68140b4e9a81.yaml diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp index 774f22fd8..408a5f60a 100644 --- a/manifests/compute/libvirt.pp +++ b/manifests/compute/libvirt.pp @@ -214,7 +214,7 @@ class nova::compute::libvirt ( '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 => $libvirt_enabled_perf_events; + 'libvirt/enabled_perf_events': value => join(any2array($libvirt_enabled_perf_events), ','); } # cpu_model param is only valid if cpu_mode=custom diff --git a/releasenotes/notes/libvirt-enabled-perf-events-fix-79be68140b4e9a81.yaml b/releasenotes/notes/libvirt-enabled-perf-events-fix-79be68140b4e9a81.yaml new file mode 100644 index 000000000..1d50c2483 --- /dev/null +++ b/releasenotes/notes/libvirt-enabled-perf-events-fix-79be68140b4e9a81.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + The configuration for libvirt/enabled_perf_events requires a comma + seperated string for the value. The libvirt_enabled_perf_events parameter + will now properly convert arrays being passed in to a string. LP#1690946 diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index 4066043d7..100eecf53 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -276,7 +276,8 @@ describe 'nova::compute::libvirt' do :vncserver_listen => '0.0.0.0', :remove_unused_base_images => true, :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'] } end @@ -285,6 +286,7 @@ 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_nova_config('libvirt/enabled_perf_events').with_value('cmt,mbml,mbmt')} it { is_expected.to contain_package('libvirt').with( :name => 'libvirt-daemon-kvm', :ensure => 'present'