From 630d6feca990b71e469da892eb6d931b3df715f1 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 5 Oct 2024 20:35:51 +0900 Subject: [PATCH] Simplify logic for *_availability_zone options Cinder uses storage_availability_zone as default availability zone when default_availability_zone is not set, so we don't have to copy the value between these two options. Also 'nova' is the default value of storage_availability_zone option in cinder so can be replaced by service default handling. Change-Id: I244fcb5645a28909cf6f77f3f6e3758c3c84ee4d --- manifests/init.pp | 16 +++------------- spec/classes/cinder_init_spec.rb | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index c9bc4775..797f0f12 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -267,8 +267,8 @@ class cinder ( $amqp_durable_queues = $facts['os_service_default'], $package_ensure = 'present', $api_paste_config = '/etc/cinder/api-paste.ini', - $storage_availability_zone = 'nova', - $default_availability_zone = undef, + $storage_availability_zone = $facts['os_service_default'], + $default_availability_zone = $facts['os_service_default'], $allow_availability_zone_fallback = $facts['os_service_default'], $lock_path = $::cinder::params::lock_path, $image_conversion_dir = $facts['os_service_default'], @@ -334,22 +334,12 @@ class cinder ( retry => $notification_retry, } - if ! $default_availability_zone { - if $default_availability_zone != undef { - warning("Usage of a false value for the default_availability_zone parameter \ -is deprecated. Use undef instead.") - } - $default_availability_zone_real = $storage_availability_zone - } else { - $default_availability_zone_real = $default_availability_zone - } - cinder_config { 'DEFAULT/report_interval': value => $report_interval; 'DEFAULT/service_down_time': value => $service_down_time; 'DEFAULT/api_paste_config': value => $api_paste_config; 'DEFAULT/storage_availability_zone': value => $storage_availability_zone; - 'DEFAULT/default_availability_zone': value => $default_availability_zone_real; + 'DEFAULT/default_availability_zone': value => $default_availability_zone; 'DEFAULT/allow_availability_zone_fallback': value => $allow_availability_zone_fallback; 'DEFAULT/image_conversion_dir': value => $image_conversion_dir; 'DEFAULT/image_compress_on_upload': value => $image_compress_on_upload; diff --git a/spec/classes/cinder_init_spec.rb b/spec/classes/cinder_init_spec.rb index 79d519b0..895924f9 100644 --- a/spec/classes/cinder_init_spec.rb +++ b/spec/classes/cinder_init_spec.rb @@ -58,8 +58,8 @@ describe 'cinder' do it { is_expected.to contain_cinder_config('DEFAULT/report_interval').with(:value => '') is_expected.to contain_cinder_config('DEFAULT/service_down_time').with(:value => '') - is_expected.to contain_cinder_config('DEFAULT/storage_availability_zone').with(:value => 'nova') - is_expected.to contain_cinder_config('DEFAULT/default_availability_zone').with(:value => 'nova') + is_expected.to contain_cinder_config('DEFAULT/storage_availability_zone').with(:value => '') + is_expected.to contain_cinder_config('DEFAULT/default_availability_zone').with(:value => '') is_expected.to contain_cinder_config('DEFAULT/allow_availability_zone_fallback').with(:value => '') is_expected.to contain_cinder_config('DEFAULT/api_paste_config').with(:value => '/etc/cinder/api-paste.ini') is_expected.to contain_oslo__concurrency('cinder_config').with(