2016-12-16 21:36:36 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'nova::compute::libvirt::qemu' do
|
|
|
|
|
|
|
|
shared_examples_for 'nova compute libvirt with qemu' do
|
|
|
|
|
|
|
|
context 'when not configuring qemu' do
|
2023-04-04 00:48:59 +09:00
|
|
|
it 'should remove all configuations' do
|
|
|
|
is_expected.to contain_qemu_config('max_files').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('max_processes').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('vnc_tls').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('vnc_tls_x509_verify').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('default_tls_x509_verify').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('user').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('group').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('memory_backing_dir').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('nbd_tls').with_ensure('absent')
|
2018-09-11 11:20:54 +02:00
|
|
|
end
|
2016-12-16 21:36:36 +01:00
|
|
|
end
|
|
|
|
|
2023-04-04 00:48:59 +09:00
|
|
|
context 'when configuring qemu with defaults' do
|
2016-12-16 21:36:36 +01:00
|
|
|
let :params do
|
|
|
|
{
|
2018-09-11 11:20:54 +02:00
|
|
|
:configure_qemu => true,
|
|
|
|
}
|
|
|
|
end
|
2023-04-04 00:48:59 +09:00
|
|
|
it 'should configure the default values' do
|
|
|
|
is_expected.to contain_qemu_config('max_files').with_value(1024)
|
|
|
|
is_expected.to contain_qemu_config('max_processes').with_value(4096)
|
|
|
|
is_expected.to contain_qemu_config('vnc_tls').with_value(false)
|
|
|
|
is_expected.to contain_qemu_config('vnc_tls_x509_verify').with_value(false)
|
|
|
|
is_expected.to contain_qemu_config('default_tls_x509_verify').with_value(true)
|
|
|
|
is_expected.to contain_qemu_config('user').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('group').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('memory_backing_dir').with_ensure('absent')
|
|
|
|
is_expected.to contain_qemu_config('nbd_tls').with_value(false)
|
2018-09-11 11:20:54 +02:00
|
|
|
end
|
2016-12-16 21:36:36 +01:00
|
|
|
end
|
2017-11-28 19:00:52 +05:30
|
|
|
|
2023-04-04 00:48:59 +09:00
|
|
|
context 'when configuring qemu with overridden parameters' do
|
2017-11-28 19:00:52 +05:30
|
|
|
let :params do
|
|
|
|
{
|
2022-02-02 10:10:06 +09:00
|
|
|
:configure_qemu => true,
|
|
|
|
:max_files => 32768,
|
|
|
|
:max_processes => 131072,
|
2023-04-04 00:48:59 +09:00
|
|
|
:user => 'qemu-user',
|
|
|
|
:group => 'qemu-group',
|
2018-09-11 11:20:54 +02:00
|
|
|
:memory_backing_dir => '/tmp',
|
2017-11-28 19:00:52 +05:30
|
|
|
}
|
|
|
|
end
|
2023-04-04 00:48:59 +09:00
|
|
|
it 'should configure the given values' do
|
|
|
|
is_expected.to contain_qemu_config('max_files').with_value(32768)
|
|
|
|
is_expected.to contain_qemu_config('max_processes').with_value(131072)
|
|
|
|
is_expected.to contain_qemu_config('user').with_value('qemu-user').with_quote(true)
|
|
|
|
is_expected.to contain_qemu_config('group').with_value('qemu-group').with_quote(true)
|
|
|
|
is_expected.to contain_qemu_config('memory_backing_dir').with_value('/tmp').with_quote(true)
|
|
|
|
end
|
2017-11-28 19:00:52 +05:30
|
|
|
end
|
2018-01-19 10:04:51 +00:00
|
|
|
|
|
|
|
context 'when configuring qemu with vnc_tls' do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:configure_qemu => true,
|
2022-02-02 10:10:06 +09:00
|
|
|
:vnc_tls => true,
|
2018-01-19 10:04:51 +00:00
|
|
|
}
|
|
|
|
end
|
2023-04-04 00:48:59 +09:00
|
|
|
it 'should configure vnc tls' do
|
|
|
|
is_expected.to contain_qemu_config('vnc_tls').with_value(true)
|
|
|
|
is_expected.to contain_qemu_config('vnc_tls_x509_verify').with_value(true)
|
|
|
|
end
|
2018-01-19 10:04:51 +00:00
|
|
|
end
|
|
|
|
|
2021-04-12 14:55:19 -04:00
|
|
|
context 'when configuring qemu with default_tls_verify enabled' do
|
|
|
|
let :params do
|
|
|
|
{
|
2022-02-02 10:10:06 +09:00
|
|
|
:configure_qemu => true,
|
2021-04-12 14:55:19 -04:00
|
|
|
:default_tls_verify => true,
|
|
|
|
}
|
|
|
|
end
|
2023-04-04 00:48:59 +09:00
|
|
|
it 'should enable default_tls_x509_verify' do
|
|
|
|
is_expected.to contain_qemu_config('default_tls_x509_verify').with_value(true)
|
|
|
|
end
|
2021-04-12 14:55:19 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when configuring qemu with vnc_tls_verify disabled' do
|
2018-01-19 10:04:51 +00:00
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:configure_qemu => true,
|
2022-02-02 10:10:06 +09:00
|
|
|
:vnc_tls => true,
|
2018-09-11 11:20:54 +02:00
|
|
|
:vnc_tls_verify => false,
|
2018-01-19 10:04:51 +00:00
|
|
|
}
|
|
|
|
end
|
2023-04-04 00:48:59 +09:00
|
|
|
it 'should disable vnc_tls_x509_veridy' do
|
|
|
|
is_expected.to contain_qemu_config('vnc_tls').with_value(true)
|
|
|
|
is_expected.to contain_qemu_config('vnc_tls_x509_verify').with_value(false)
|
|
|
|
end
|
2021-04-12 14:55:19 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when configuring qemu with default_tls_verify disabled' do
|
|
|
|
let :params do
|
|
|
|
{
|
2022-02-02 10:10:06 +09:00
|
|
|
:configure_qemu => true,
|
2021-04-12 14:55:19 -04:00
|
|
|
:default_tls_verify => false,
|
|
|
|
}
|
|
|
|
end
|
2023-04-04 00:48:59 +09:00
|
|
|
it 'should disable default_tls_x509_verify' do
|
|
|
|
is_expected.to contain_qemu_config('default_tls_x509_verify').with_value(false)
|
|
|
|
end
|
2018-09-11 11:20:54 +02:00
|
|
|
end
|
|
|
|
|
2023-04-04 00:48:59 +09:00
|
|
|
context 'when configuring qemu with nbd_tls' do
|
2018-09-11 11:20:54 +02:00
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:configure_qemu => true,
|
2022-02-02 10:10:06 +09:00
|
|
|
:nbd_tls => true,
|
2018-09-11 11:20:54 +02:00
|
|
|
}
|
|
|
|
end
|
2023-04-04 00:48:59 +09:00
|
|
|
it 'should enable nbd_tls' do
|
|
|
|
is_expected.to contain_qemu_config('nbd_tls').with_value(true)
|
|
|
|
end
|
2018-01-19 10:04:51 +00:00
|
|
|
end
|
|
|
|
|
2016-12-16 21:36:36 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
on_supported_os({
|
|
|
|
:supported_os => OSDefaults.get_supported_os
|
|
|
|
}).each do |os,facts|
|
|
|
|
context "on #{os}" do
|
|
|
|
let (:facts) do
|
|
|
|
facts.merge!(OSDefaults.get_facts())
|
|
|
|
end
|
|
|
|
|
|
|
|
it_configures 'nova compute libvirt with qemu'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|