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
(cherry picked from commit 8ed5c5e974)
This commit is contained in:
Alex Schultz 2017-05-15 16:54:01 -06:00
parent 91072e14d9
commit d92af817ba
3 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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'