Merge "Do not install swtpm by default"

This commit is contained in:
Zuul 2024-02-09 16:55:24 +00:00 committed by Gerrit Code Review
commit 06d3348553
3 changed files with 58 additions and 16 deletions

View File

@ -55,7 +55,7 @@
# #
# [*manage_swtpm*] # [*manage_swtpm*]
# (optional) install the swtpm package. # (optional) install the swtpm package.
# Defaults to true # Defaults to false
# #
class nova::compute::libvirt::services ( class nova::compute::libvirt::services (
$ensure_package = 'present', $ensure_package = 'present',
@ -70,7 +70,7 @@ class nova::compute::libvirt::services (
$virtproxy_service_name = $::nova::params::virtproxy_socket_name, $virtproxy_service_name = $::nova::params::virtproxy_socket_name,
$virtstorage_service_name = $::nova::params::virtstorage_socket_name, $virtstorage_service_name = $::nova::params::virtstorage_socket_name,
Boolean $manage_ovmf = true, Boolean $manage_ovmf = true,
Boolean $manage_swtpm = true, Boolean $manage_swtpm = false,
) inherits nova::params { ) inherits nova::params {
include nova::deps include nova::deps

View File

@ -1,6 +1,6 @@
--- ---
features: features:
- | - |
The ``nova::compute::libvirt::services`` class now installs the ``swtpm`` The new ``manage_swtpm`` parameter has been added to
package by default. To disable the package installation, use the ``nova::compute::libvirt::services`` class. Set this parameter to
the ``manage_swtpm`` parameter. ``true`` to install swtpm package.

View File

@ -5,11 +5,34 @@ describe 'nova::compute::libvirt::services' do
shared_examples_for 'nova compute libvirt services' do shared_examples_for 'nova compute libvirt services' do
context 'with default parameters' do context 'with default parameters' do
it 'deploys libvirt packages and services' do it 'deploys libvirt service' do
is_expected.to contain_package('ovmf') is_expected.to contain_package('libvirt').with(
is_expected.to contain_package('swtpm') :ensure => 'present',
is_expected.to contain_package('libvirt') :name => platform_params[:libvirt_package_name],
is_expected.to contain_service('libvirt') :tag => ['openstack', 'nova-support-package'],
)
is_expected.to contain_service('libvirt').with(
:ensure => 'running',
:enable => true,
:name => platform_params[:libvirt_service_name],
:tag => ['libvirt-service', 'libvirt-qemu-service'],
)
end
it 'installs ovmf' do
is_expected.to contain_package('ovmf').with(
:ensure => 'present',
:name => platform_params[:ovmf_package_name],
:tag => ['openstack', 'nova-support-package'],
)
end
it 'installs swtpm' do
is_expected.to_not contain_package('swtpm').with(
:ensure => 'present',
:name => platform_params[:swtpm_package_name],
:tag => ['openstack', 'nova-support-package'],
)
end end
end end
@ -17,13 +40,12 @@ describe 'nova::compute::libvirt::services' do
let :params do let :params do
{ {
:libvirt_service_name => false, :libvirt_service_name => false,
:modular_libvirt => false,
:manage_ovmf => false, :manage_ovmf => false,
:manage_swtpm => false, :manage_swtpm => true,
} }
end end
it 'disable libvirt service' do it 'skips installing libvirt' do
is_expected.not_to contain_package('libvirt') is_expected.not_to contain_package('libvirt')
is_expected.not_to contain_service('libvirt') is_expected.not_to contain_service('libvirt')
end end
@ -32,8 +54,8 @@ describe 'nova::compute::libvirt::services' do
is_expected.not_to contain_package('ovmf') is_expected.not_to contain_package('ovmf')
end end
it 'skips installing swtpm' do it 'skips installs swtpm' do
is_expected.not_to contain_package('swtpm') is_expected.to contain_package('swtpm')
end end
end end
end end
@ -66,9 +88,29 @@ describe 'nova::compute::libvirt::services' do
:supported_os => OSDefaults.get_supported_os :supported_os => OSDefaults.get_supported_os
}).each do |os,facts| }).each do |os,facts|
context "on #{os}" do context "on #{os}" do
let (:facts) do let :facts do
facts.merge!(OSDefaults.get_facts()) facts.merge!(OSDefaults.get_facts())
end end
let :platform_params do
case facts[:os]['family']
when 'Debian'
{
:libvirt_package_name => 'libvirt-daemon-system',
:libvirt_service_name => 'libvirtd',
:ovmf_package_name => 'ovmf',
:swtpm_package_name => 'swtpm'
}
when 'RedHat'
{
:libvirt_package_name => 'libvirt-daemon-kvm',
:libvirt_service_name => 'libvirtd',
:ovmf_package_name => 'edk2-ovmf',
:swtpm_package_name => 'swtpm'
}
end
end
it_configures 'nova compute libvirt services' it_configures 'nova compute libvirt services'
if facts['osfamily'] == 'RedHat' if facts['osfamily'] == 'RedHat'
it_configures 'nova compute libvirt services with modular libvirt' it_configures 'nova compute libvirt services with modular libvirt'