From 4d604ff4a914d452d3d3749a174789d41558ea18 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 1 Nov 2023 12:50:53 +0900 Subject: [PATCH] Install OVMF package The OVMF package is required to allow UEFI boot of instances[1]. [1] https://docs.openstack.org/nova/latest/admin/uefi.html Closes-Bug: #1853845 Change-Id: Ibb63750f20788c22c535a61c32ca09d484040ed0 --- manifests/compute/libvirt/services.pp | 17 ++++++++++++++++- manifests/params.pp | 2 ++ .../notes/bug-1853845-a1e25645af26242b.yaml | 6 ++++++ .../nova_compute_libvirt_services_spec.rb | 6 ++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/bug-1853845-a1e25645af26242b.yaml diff --git a/manifests/compute/libvirt/services.pp b/manifests/compute/libvirt/services.pp index 72506b158..a294ebf74 100644 --- a/manifests/compute/libvirt/services.pp +++ b/manifests/compute/libvirt/services.pp @@ -49,6 +49,10 @@ # (optional) virtstorage service name. # Defaults to $::nova::params::virtstorage_socket_name # +# [*manage_ovmf*] +# (optional) install the OVMF package. +# Defaults to true +# class nova::compute::libvirt::services ( $ensure_package = 'present', $libvirt_service_name = $::nova::params::libvirt_service_name, @@ -60,7 +64,8 @@ class nova::compute::libvirt::services ( $virtnodedev_service_name = $::nova::params::virtnodedev_socket_name, $virtqemu_service_name = $::nova::params::virtqemu_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, ) inherits nova::params { include nova::deps @@ -70,6 +75,16 @@ class nova::compute::libvirt::services ( fail('Modular libvirt daemons are not supported in this distribution') } + if $manage_ovmf { + package { 'ovmf': + ensure => $ensure_package, + name => $::nova::params::ovmf_package_name, + tag => ['openstack', 'nova-support-package'], + } + Package['ovmf'] ~> Service<| tag == 'libvirt-qemu-service' |> + Package['ovmf'] ~> Service<| title == 'nova-compute'|> + } + if $libvirt_service_name { # libvirt-nwfilter if $facts['os']['family'] == 'RedHat' { diff --git a/manifests/params.pp b/manifests/params.pp index af2dba218..7a84d9cae 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -36,6 +36,7 @@ class nova::params { $oslo_vmware_package_name = 'python3-oslo-vmware' $mkisofs_package_name = 'xorriso' $mkisofs_cmd = 'mkisofs' + $ovmf_package_name = 'edk2-ovmf' # service names $api_service_name = 'openstack-nova-api' $api_metadata_service_name = undef @@ -85,6 +86,7 @@ class nova::params { $oslo_vmware_package_name = 'python3-oslo-vmware' $mkisofs_package_name = 'genisoimage' $mkisofs_cmd = false + $ovmf_package_name = 'ovmf' # service names $api_service_name = 'nova-api' $compute_service_name = 'nova-compute' diff --git a/releasenotes/notes/bug-1853845-a1e25645af26242b.yaml b/releasenotes/notes/bug-1853845-a1e25645af26242b.yaml new file mode 100644 index 000000000..3968a37cd --- /dev/null +++ b/releasenotes/notes/bug-1853845-a1e25645af26242b.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The ``nova::compute::libvirt::services`` now installs the OVMF package to + allow UEFI boot of instances. The package installation can be disabled by + setting the ``manage_ovmf`` parameter. diff --git a/spec/classes/nova_compute_libvirt_services_spec.rb b/spec/classes/nova_compute_libvirt_services_spec.rb index 3725bb3d2..26810cb7b 100644 --- a/spec/classes/nova_compute_libvirt_services_spec.rb +++ b/spec/classes/nova_compute_libvirt_services_spec.rb @@ -6,6 +6,7 @@ describe 'nova::compute::libvirt::services' do context 'with default parameters' do it 'deploys libvirt packages and services' do + is_expected.to contain_package('ovmf') is_expected.to contain_package('libvirt') is_expected.to contain_service('libvirt') end @@ -16,6 +17,7 @@ describe 'nova::compute::libvirt::services' do { :libvirt_service_name => false, :modular_libvirt => false, + :manage_ovmf => false, } end @@ -23,6 +25,10 @@ describe 'nova::compute::libvirt::services' do is_expected.not_to contain_package('libvirt') is_expected.not_to contain_service('libvirt') end + + it 'skips installing ovmf' do + is_expected.not_to contain_package('ovmf') + end end end