From 38c233271aec8c6047df230218e1a042674fd173 Mon Sep 17 00:00:00 2001 From: Oliver Walsh Date: Wed, 21 Oct 2020 16:33:29 +0100 Subject: [PATCH] Expose nova config option [workaround]/never_download_image_if_on_rbd This exposes the nova workaround to disable downloading images from glance to rbd (vs a cheap COW clone) when nova-compute and glance are not backed by the same ceph cluster. Related nova change: I069b6b1d28eaf1eee5c7fb8d0fdef9c0c229a1bf Change-Id: I8329810d6c047c0d94e7b123e7cdc1263a7856cd (cherry picked from commit 9f260451977b850ba3b4375434512c227b2749f0) --- manifests/compute.pp | 1 + manifests/workarounds.pp | 12 +++++++++++- spec/classes/nova_workarounds_spec.rb | 9 +++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/manifests/compute.pp b/manifests/compute.pp index 4f7d4bb16..fc2ddadab 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -261,6 +261,7 @@ class nova::compute ( include nova::deps include nova::params + include nova::workarounds $cpu_shared_set_real = pick(join(any2array($cpu_shared_set), ','), $::os_service_default) $cpu_dedicated_set_real = pick(join(any2array($cpu_dedicated_set), ','), $::os_service_default) diff --git a/manifests/workarounds.pp b/manifests/workarounds.pp index 5ec9ffbc1..1ed8e2a5d 100644 --- a/manifests/workarounds.pp +++ b/manifests/workarounds.pp @@ -4,6 +4,11 @@ # # === Parameters: # +# [*never_download_image_if_on_rbd*] +# (optional) refuse to boot an instance if it would require downloading from +# glance and uploading to ceph instead of a COW clone +# Defaults to $::os_service_default +# # DEPRECATED # # [*enable_numa_live_migration*] @@ -11,8 +16,9 @@ # Defaults to undef # class nova::workarounds ( + $never_download_image_if_on_rbd = $::os_service_default, # DEPRECATED PARAMETER - $enable_numa_live_migration = undef, + $enable_numa_live_migration = undef, ) { if $enable_numa_live_migration != undef { @@ -22,4 +28,8 @@ class nova::workarounds ( } } + nova_config { + 'workarounds/never_download_image_if_on_rbd': value => $never_download_image_if_on_rbd; + } + } diff --git a/spec/classes/nova_workarounds_spec.rb b/spec/classes/nova_workarounds_spec.rb index 4ec74657b..911831bca 100644 --- a/spec/classes/nova_workarounds_spec.rb +++ b/spec/classes/nova_workarounds_spec.rb @@ -9,15 +9,20 @@ describe 'nova::workarounds' do shared_examples 'nova::workarounds' do context 'with default parameters' do - it { is_expected.not_to contain_resources('nova_config') } + it { is_expected.not_to contain_nova_config('workarounds/enable_numa_live_migration') } + it { is_expected.to contain_nova_config('workarounds/never_download_image_if_on_rbd').with_value('') } end context 'with overridden parameters' do let :params do - { :enable_numa_live_migration => true,} + { + :enable_numa_live_migration => true, + :never_download_image_if_on_rbd => true + } end it { is_expected.to contain_nova_config('workarounds/enable_numa_live_migration').with_value('true') } + it { is_expected.to contain_nova_config('workarounds/never_download_image_if_on_rbd').with_value('true') } end end