Add options for taskflow_executor & conversion

Add parameters to configure tasks & taskflow executor. Allows mainly to
allow enabling automatic image conversion at import using the
'conversion_format' parameter.

Change-Id: Ice376ca219ee36ddc97a8317fac20bf8f157b7db
This commit is contained in:
François Charlier 2016-09-16 16:50:33 +02:00
parent ffa154c77a
commit a2cacecd11
3 changed files with 87 additions and 0 deletions

View File

@ -190,6 +190,34 @@
# (optional) Base directory that the Image Cache uses.
# Defaults to '/var/lib/glance/image-cache'.
#
# [*task_time_to_live*]
# (optional) Time in hours for which a task lives after.
# Defaults to $::os_service_default
#
# [*task_executor*]
# (optional) Task executor to be used t orun task scripts.
# Defaults to $::os_service_default
#
# [*task_work_dir*]
# (optional) Absolute path to the work directory to use for asynchronous
# task operations.
# Defaults to $::os_service_default
#
# [*taskflow_engine_mode*]
# (optional) Set the taskflow engine mode.
# Allowed values: 'parallel', 'serial'.
# Defaults to $::os_service_default
#
# [*taskflow_max_workers*]
# (optional) Integer value to limit the number of taskflow workers. Only
# relevant if taskflow_engine_mode is 'parallel'.
# Defaults to $::os_service_default
#
# [*conversion_format*]
# (optional) Allow automatic image conversion.
# Allowed values: 'qcow2', 'raw', 'vmdk', false.
# Defaults to $::os_service_default (disabled)
#
# [*os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to 'RegionOne'.
@ -330,6 +358,12 @@ class glance::api(
$image_cache_max_size = $::os_service_default,
$image_cache_stall_time = $::os_service_default,
$image_cache_dir = '/var/lib/glance/image-cache',
$task_time_to_live = $::os_service_default,
$task_executor = $::os_service_default,
$task_work_dir = $::os_service_default,
$taskflow_engine_mode = $::os_service_default,
$taskflow_max_workers = $::os_service_default,
$conversion_format = $::os_service_default,
$os_region_name = 'RegionOne',
$enable_proxy_headers_parsing = $::os_service_default,
$validate = false,
@ -426,6 +460,16 @@ class glance::api(
'glance_store/os_region_name': value => $os_region_name;
}
# task/taskflow_executor config.
glance_api_config {
'task/task_time_to_live': value => $task_time_to_live;
'task/task_executor': value => $task_executor;
'task/work_dir': value => $task_work_dir;
'taskflow_executor/engine_mode': value => $taskflow_engine_mode;
'taskflow_executor/max_workers': value => $taskflow_max_workers;
'taskflow_executor/conversion_format': value => $conversion_format,
}
# stores config
if $stores and $known_stores {
fail('known_stores and stores cannot both be assigned values')

View File

@ -0,0 +1,5 @@
---
features:
- Add parameters to configure tasks & taskflow executor. Allows mainly to
allow enabling automatic image conversion at import with the
'conversion_format' parameter.

View File

@ -32,6 +32,12 @@ describe 'glance::api' do
:image_cache_max_size => '<SERVICE DEFAULT>',
:os_region_name => 'RegionOne',
:pipeline => 'keystone',
:task_time_to_live => '<SERVICE DEFAULT>',
:task_executor => '<SERVICE DEFAULT>',
:task_work_dir => '<SERVICE DEFAULT>',
:taskflow_engine_mode => '<SERVICE DEFAULT>',
:taskflow_max_workers => '<SERVICE DEFAULT>',
:conversion_format => '<SERVICE DEFAULT>',
}
end
@ -128,6 +134,15 @@ describe 'glance::api' do
end
end
it 'is_expected.to lay down default task & taskflow_executor config' do
is_expected.to contain_glance_api_config('task/task_time_to_live').with_value(param_hash[:task_time_to_live])
is_expected.to contain_glance_api_config('task/task_executor').with_value(param_hash[:task_executor])
is_expected.to contain_glance_api_config('task/work_dir').with_value(param_hash[:task_work_dir])
is_expected.to contain_glance_api_config('taskflow_executor/engine_mode').with_value(param_hash[:taskflow_engine_mode])
is_expected.to contain_glance_api_config('taskflow_executor/max_workers').with_value(param_hash[:taskflow_max_workers])
is_expected.to contain_glance_api_config('taskflow_executor/conversion_format').with_value(param_hash[:conversion_format])
end
it 'is_expected.to have no ssl options' do
is_expected.to contain_glance_api_config('DEFAULT/ca_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('DEFAULT/cert_file').with_value('<SERVICE DEFAULT>')
@ -234,6 +249,7 @@ describe 'glance::api' do
it { is_expected.to contain_glance_api_config('DEFAULT/registry_client_cert_file').with_value('/tmp/registry_cert_file') }
end
end
describe 'with stores by default' do
let :params do
default_params
@ -302,6 +318,28 @@ describe 'glance::api' do
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value('file') }
end
describe 'with task & taskflow configuration' do
let :params do
default_params.merge({
:task_time_to_live => 72,
:task_executor => 'taskflow-next-gen',
:task_work_dir => '/tmp/large',
:taskflow_engine_mode => 'serial',
:taskflow_max_workers => 1,
:conversion_format => 'raw',
})
end
it 'is_expected.to lay down default task & taskflow_executor config' do
is_expected.to contain_glance_api_config('task/task_time_to_live').with_value(72)
is_expected.to contain_glance_api_config('task/task_executor').with_value('taskflow-next-gen')
is_expected.to contain_glance_api_config('task/work_dir').with_value('/tmp/large')
is_expected.to contain_glance_api_config('taskflow_executor/engine_mode').with_value('serial')
is_expected.to contain_glance_api_config('taskflow_executor/max_workers').with_value(1)
is_expected.to contain_glance_api_config('taskflow_executor/conversion_format').with_value('raw')
end
end
describe 'while validating the service with default command' do
let :params do
default_params.merge({