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
This commit is contained in:
Takashi Kajinami 2024-10-05 20:35:51 +09:00
parent 8744e3daa2
commit 630d6feca9
2 changed files with 5 additions and 15 deletions

View File

@ -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;

View File

@ -58,8 +58,8 @@ describe 'cinder' do
it {
is_expected.to contain_cinder_config('DEFAULT/report_interval').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/service_down_time').with(:value => '<SERVICE DEFAULT>')
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 => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/default_availability_zone').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/allow_availability_zone_fallback').with(:value => '<SERVICE DEFAULT>')
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(