From 449507e1a929c60f0a89f9f0d3ee16d0103b8289 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 21 Nov 2022 15:55:14 +0900 Subject: [PATCH] Ubuntu/Debian: Install qemu-block-extra when rbd backend is used In Ubuntu Jammy, the qemu-block-extra package is no longer required by the qemu-utils package and should be additionally installed to use rbd backend. Change-Id: I2ae6ed374dda55f8f68c3be5449b1fcd2a890123 --- manifests/compute/rbd.pp | 16 ++++++++++++-- .../qemu-block-extra-998bf6f1d9d75eda.yaml | 6 +++++ spec/classes/nova_compute_rbd_spec.rb | 22 +++++++++++++++++-- 3 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/qemu-block-extra-998bf6f1d9d75eda.yaml diff --git a/manifests/compute/rbd.pp b/manifests/compute/rbd.pp index 2bf051df9..534cc524b 100644 --- a/manifests/compute/rbd.pp +++ b/manifests/compute/rbd.pp @@ -78,8 +78,12 @@ # [*ceph_client_ensure*] # (optional) Ensure value for ceph client package. # Defaults to 'present'. - - +# +# [*package_ensure*] +# (optional) The state of qemu-block-extra package. This parameter has effect +# only in Ubuntu/Debian. +# Defaults to 'present' +# class nova::compute::rbd ( $libvirt_rbd_user, $libvirt_rbd_secret_uuid = false, @@ -93,6 +97,7 @@ class nova::compute::rbd ( $ephemeral_storage = true, $manage_ceph_client = true, $ceph_client_ensure = 'present', + $package_ensure = 'present', ) { include nova::deps @@ -107,6 +112,13 @@ class nova::compute::rbd ( } } + if $::osfamily == 'Debian' { + package { 'qemu-block-extra': + ensure => $package_ensure, + tag => ['openstack', 'nova-support-package'], + } + } + nova_config { 'libvirt/rbd_user': value => $libvirt_rbd_user; } diff --git a/releasenotes/notes/qemu-block-extra-998bf6f1d9d75eda.yaml b/releasenotes/notes/qemu-block-extra-998bf6f1d9d75eda.yaml new file mode 100644 index 000000000..c6be43344 --- /dev/null +++ b/releasenotes/notes/qemu-block-extra-998bf6f1d9d75eda.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The ``nova::compute::rbd`` class now installs the ``qemu-block-extra`` + package in Ubuntu or Debian. The ``package_ensure`` parameter can be used + to customize state of the package. diff --git a/spec/classes/nova_compute_rbd_spec.rb b/spec/classes/nova_compute_rbd_spec.rb index 2628e2151..2c8003bf2 100644 --- a/spec/classes/nova_compute_rbd_spec.rb +++ b/spec/classes/nova_compute_rbd_spec.rb @@ -26,7 +26,7 @@ describe 'nova::compute::rbd' do { :libvirt_rbd_user => 'nova' } end - shared_examples_for 'nova compute rbd' do + shared_examples_for 'nova::compute::rbd' do it { is_expected.to contain_class('nova::params') } @@ -168,6 +168,21 @@ describe 'nova::compute::rbd' do end end + shared_examples_for 'nova::compute::rbd in Debian' do + it 'should install the qemu-block-extra package' do + is_expected.to contain_package('qemu-block-extra').with( + :ensure => 'present', + :tag => ['openstack', 'nova-support-package'], + ) + end + end + + shared_examples_for 'nova::compute::rbd in RedHat' do + it 'should not install the qemu-block-extra package' do + is_expected.to_not contain_package('qemu-block-extra') + end + end + on_supported_os({ :supported_os => OSDefaults.get_supported_os }).each do |os,facts| @@ -184,7 +199,10 @@ describe 'nova::compute::rbd' do { :ceph_client_package => 'ceph-common' } end end - it_configures 'nova compute rbd' + it_configures 'nova::compute::rbd' + if facts[:osfamily] == 'Debian' + it_configures "nova::compute::rbd in #{facts[:osfamily]}" + end end end