Merge "libvirt: Accept more flexible types for [libvirt] hw_machine_type"

This commit is contained in:
Zuul
2023-10-13 15:41:06 +00:00
committed by Gerrit Code Review
2 changed files with 23 additions and 1 deletions

View File

@@ -345,6 +345,11 @@ class nova::compute::libvirt (
}
}
$hw_machine_type_real = $hw_machine_type ? {
Hash => join(join_keys_to_values($hw_machine_type, '='), ','),
default => join(any2array($hw_machine_type), ','),
}
nova_config {
'DEFAULT/compute_driver': value => $compute_driver;
'DEFAULT/preallocate_images': value => $preallocate_images;
@@ -361,7 +366,7 @@ class nova::compute::libvirt (
'libvirt/inject_key': value => $inject_key;
'libvirt/inject_partition': value => $inject_partition;
'libvirt/hw_disk_discard': value => $hw_disk_discard;
'libvirt/hw_machine_type': value => $hw_machine_type;
'libvirt/hw_machine_type': value => $hw_machine_type_real;
'libvirt/sysinfo_serial': value => $sysinfo_serial;
'libvirt/enabled_perf_events': value => join(any2array($enabled_perf_events), ',');
'libvirt/device_detach_attempts': value => $device_detach_attempts;

View File

@@ -219,6 +219,23 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('none')}
end
describe 'with hw_machine_type set by array' do
let :params do
{ :hw_machine_type => ['x86_64=machinetype1', 'armv7l=machinetype2'] }
end
it { is_expected.to contain_nova_config('libvirt/hw_machine_type').with_value('x86_64=machinetype1,armv7l=machinetype2')}
end
describe 'with hw_machine_type set by hash' do
let :params do
{ :hw_machine_type => {
'x86_64' => 'machinetype1',
'armv7l' => 'machinetype2'
} }
end
it { is_expected.to contain_nova_config('libvirt/hw_machine_type').with_value('x86_64=machinetype1,armv7l=machinetype2')}
end
describe 'with migration_support enabled' do
context 'with vncserver_listen set to 0.0.0.0' do