Merge "Add support for image_format/disk_fomats configuration"

This commit is contained in:
Zuul 2020-09-10 19:18:56 +00:00 committed by Gerrit Code Review
commit 99de3903d1
3 changed files with 41 additions and 0 deletions

View File

@ -75,6 +75,10 @@
# (optional) If set, use this value for max_overflow with sqlalchemy.
# Defaults to undef.
#
# [*disk_formats*]
# (optional) (Array) List of allowed values for an image disk_format attribute.
# Defaults to $::os_service_default.
#
# [*cache_prefetcher_interval*]
# (optional) The interval in seconds to run periodic job 'cache_images'
# Defaults to $::os_service_default.
@ -336,6 +340,7 @@ class glance::api(
$database_max_retries = undef,
$database_retry_interval = undef,
$database_max_overflow = undef,
$disk_formats = $::os_service_default,
$cache_prefetcher_interval = $::os_service_default,
$image_cache_max_size = $::os_service_default,
$image_cache_stall_time = $::os_service_default,
@ -550,6 +555,16 @@ enabled_backends instead.')
'glance_store/filesystem_store_file_perm': value => $filesystem_store_file_perm;
}
# disk_formats handling
if $disk_formats != $::os_service_default {
$disk_formats_real = join(any2array($disk_formats), ',')
} else {
$disk_formats_real = $disk_formats
}
glance_api_config {
'image_format/disk_formats': value => $disk_formats_real;
}
resources { 'glance_api_config':
purge => $purge_config,
}

View File

@ -0,0 +1,9 @@
---
features:
- |
Added disk_formats option which allows configuration of
the image_format/disk_formats config setting; some backends
perform poorly with specific disk formats, for example
Ceph with QCOW2 images and in these scenarios it might
be useful to filter out of the allowed disk formats those
which are unwanted.

View File

@ -34,6 +34,7 @@ describe 'glance::api' do
:image_cache_stall_time => '<SERVICE DEFAULT>',
:image_cache_max_size => '<SERVICE DEFAULT>',
:cache_prefetcher_interval => '<SERVICE DEFAULT>',
:disk_formats => '<SERVICE DEFAULT>',
:pipeline => 'keystone',
:task_time_to_live => '<SERVICE DEFAULT>',
:task_executor => '<SERVICE DEFAULT>',
@ -188,6 +189,10 @@ describe 'glance::api' do
is_expected.to contain_glance_api_config('DEFAULT/key_file').with_value('<SERVICE DEFAULT>')
end
it 'is_expected.to have no disk_formats set' do
is_expected.to contain_glance_api_config('image_format/disk_formats').with_value('<SERVICE DEFAULT>')
end
it 'passes purge to resource' do
is_expected.to contain_resources('glance_api_config').with({
:purge => false
@ -289,6 +294,18 @@ describe 'glance::api' do
end
end
describe 'with disk_formats option' do
let :params do
default_params.merge({
:disk_formats => 'raw,iso',
})
end
context 'with disk_formats option' do
it { is_expected.to contain_glance_api_config('image_format/disk_formats').with_value('raw,iso') }
end
end
describe 'with enabled_backends and stores by default' do
let :params do
default_params