From dcb5d932ece5c1631ca5f3b3e1a1b035d73ec8a8 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 16 Jun 2022 00:18:52 +0900 Subject: [PATCH] Purge [libvirt] rbd_secret_uuid when unused ... instead of leaving it unmanaged. Change-Id: I40f5186a3a6694dcd309570249573a85a0b0b259 --- manifests/compute/rbd.pp | 4 ++++ spec/classes/nova_compute_rbd_spec.rb | 1 + 2 files changed, 5 insertions(+) diff --git a/manifests/compute/rbd.pp b/manifests/compute/rbd.pp index 90273929f..8d4fa2b61 100644 --- a/manifests/compute/rbd.pp +++ b/manifests/compute/rbd.pp @@ -143,6 +143,10 @@ class nova::compute::rbd ( unless => "/usr/bin/virsh secret-get-value ${libvirt_rbd_secret_uuid} | grep ${libvirt_key}", require => Exec['get-or-set virsh secret'], } + } else { + nova_config { + 'libvirt/rbd_secret_uuid': ensure => absent; + } } if $ephemeral_storage { diff --git a/spec/classes/nova_compute_rbd_spec.rb b/spec/classes/nova_compute_rbd_spec.rb index 3dc2edeb0..2628e2151 100644 --- a/spec/classes/nova_compute_rbd_spec.rb +++ b/spec/classes/nova_compute_rbd_spec.rb @@ -31,6 +31,7 @@ describe 'nova::compute::rbd' do it { is_expected.to contain_class('nova::params') } it 'configure nova.conf with default parameters' do + is_expected.to contain_nova_config('libvirt/rbd_secret_uuid').with_ensure('absent') is_expected.to contain_nova_config('libvirt/images_rbd_pool').with_value('rbd') is_expected.to contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/etc/ceph/ceph.conf') is_expected.to contain_nova_config('libvirt/rbd_user').with_value('nova')