Add support for image_format/disk_fomats configuration
This is useful to avoid callers use glance::config for the sole reason of configuring the allowed disk_formats, which can be customized to filter out values when using particular backends, like RBD, which perform suboptimally with certain image formats. Change-Id: I0f343321d43efa5e4a4274f01a4592a8fcd92417
This commit is contained in:
parent
301435b063
commit
9222da4bbb
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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.
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue