Reject customized cpu_mode for unsupported virt_type
Using cpu_mode other than 'none' is supported only when virt_type is qemu or kvm and nova-compute fails to start in case an unsupported combination is used. Enforce this requirement during deployment to make the invalid configuration more visible. Change-Id: If9fc59797c4a24a3b7536cd3fe8770316fdf4f4d
This commit is contained in:
@@ -298,6 +298,9 @@ class nova::compute::libvirt (
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if $cpu_mode != 'none' and !($virt_type in ['qemu', 'kvm']) {
|
||||
fail("\$virt_type = \"${virt_type}\" supports only \$cpu_mode = \"none\"")
|
||||
}
|
||||
$cpu_mode_real = $cpu_mode
|
||||
}
|
||||
|
||||
|
@@ -164,6 +164,17 @@ describe 'nova::compute::libvirt' do
|
||||
it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_value('pcid')}
|
||||
end
|
||||
|
||||
context 'with cpu_mode and non qemu/kvm virt_type' do
|
||||
let :params do
|
||||
{
|
||||
:cpu_mode => 'host-passthrough',
|
||||
:virt_type => 'lxc',
|
||||
}
|
||||
end
|
||||
|
||||
it { should raise_error(Puppet::Error, /\$virt_type = "lxc" supports only \$cpu_mode = "none"/) }
|
||||
end
|
||||
|
||||
context 'with non-custom cpu_node and cpu_models' do
|
||||
let :params do
|
||||
{ :cpu_models => ['kvm64', 'qemu64'] }
|
||||
|
Reference in New Issue
Block a user