Add support for image_format/container_formats
Change-Id: Iaf082ce9d70ba3cc158f776ddde22fa923f2e4fd
This commit is contained in:
parent
97add646a1
commit
e49a829eca
|
@ -75,8 +75,12 @@
|
||||||
# (optional) If set, use this value for max_overflow with sqlalchemy.
|
# (optional) If set, use this value for max_overflow with sqlalchemy.
|
||||||
# Defaults to undef.
|
# Defaults to undef.
|
||||||
#
|
#
|
||||||
|
# [*container_formats*]
|
||||||
|
# (optional) List of allowed values for an image container_format attributes
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
# [*disk_formats*]
|
# [*disk_formats*]
|
||||||
# (optional) (Array) List of allowed values for an image disk_format attribute.
|
# (optional) List of allowed values for an image disk_format attribute.
|
||||||
# Defaults to $::os_service_default.
|
# Defaults to $::os_service_default.
|
||||||
#
|
#
|
||||||
# [*cache_prefetcher_interval*]
|
# [*cache_prefetcher_interval*]
|
||||||
|
@ -340,6 +344,7 @@ class glance::api(
|
||||||
$database_max_retries = undef,
|
$database_max_retries = undef,
|
||||||
$database_retry_interval = undef,
|
$database_retry_interval = undef,
|
||||||
$database_max_overflow = undef,
|
$database_max_overflow = undef,
|
||||||
|
$container_formats = $::os_service_default,
|
||||||
$disk_formats = $::os_service_default,
|
$disk_formats = $::os_service_default,
|
||||||
$cache_prefetcher_interval = $::os_service_default,
|
$cache_prefetcher_interval = $::os_service_default,
|
||||||
$image_cache_max_size = $::os_service_default,
|
$image_cache_max_size = $::os_service_default,
|
||||||
|
@ -555,14 +560,9 @@ enabled_backends instead.')
|
||||||
'glance_store/filesystem_store_file_perm': value => $filesystem_store_file_perm;
|
'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 {
|
glance_api_config {
|
||||||
'image_format/disk_formats': value => $disk_formats_real;
|
'image_format/container_formats': value => join(any2array($container_formats), ',');
|
||||||
|
'image_format/disk_formats': value => join(any2array($disk_formats), ',');
|
||||||
}
|
}
|
||||||
|
|
||||||
resources { 'glance_api_config':
|
resources { 'glance_api_config':
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The new ``glance::api::container_formats`` parameter has been added to
|
||||||
|
configure supported values for the container_format image attribute.
|
|
@ -189,7 +189,8 @@ describe 'glance::api' do
|
||||||
is_expected.to contain_glance_api_config('DEFAULT/key_file').with_value('<SERVICE DEFAULT>')
|
is_expected.to contain_glance_api_config('DEFAULT/key_file').with_value('<SERVICE DEFAULT>')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is_expected.to have no disk_formats set' do
|
it 'is_expected.to have no formats set' do
|
||||||
|
is_expected.to contain_glance_api_config('image_format/container_formats').with_value('<SERVICE DEFAULT>')
|
||||||
is_expected.to contain_glance_api_config('image_format/disk_formats').with_value('<SERVICE DEFAULT>')
|
is_expected.to contain_glance_api_config('image_format/disk_formats').with_value('<SERVICE DEFAULT>')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -294,14 +295,30 @@ describe 'glance::api' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with disk_formats option' do
|
describe 'with formats options with strings' do
|
||||||
let :params do
|
let :params do
|
||||||
default_params.merge({
|
default_params.merge({
|
||||||
:disk_formats => 'raw,iso',
|
:container_formats => 'ami,ari',
|
||||||
|
:disk_formats => 'raw,iso',
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with disk_formats option' do
|
context 'with disk_formats option' do
|
||||||
|
it { is_expected.to contain_glance_api_config('image_format/container_formats').with_value('ami,ari') }
|
||||||
|
it { is_expected.to contain_glance_api_config('image_format/disk_formats').with_value('raw,iso') }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with formats options with arrays' do
|
||||||
|
let :params do
|
||||||
|
default_params.merge({
|
||||||
|
:container_formats => ['ami', 'ari'],
|
||||||
|
:disk_formats => ['raw', 'iso'],
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with disk_formats option' do
|
||||||
|
it { is_expected.to contain_glance_api_config('image_format/container_formats').with_value('ami,ari') }
|
||||||
it { is_expected.to contain_glance_api_config('image_format/disk_formats').with_value('raw,iso') }
|
it { is_expected.to contain_glance_api_config('image_format/disk_formats').with_value('raw,iso') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue