From a2cacecd11dfe2d764771777a50a626af1c22c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Charlier?= Date: Fri, 16 Sep 2016 16:50:33 +0200 Subject: [PATCH] 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 --- manifests/api.pp | 44 +++++++++++++++++++ ..._executor-conversion-716730936a03a062.yaml | 5 +++ spec/classes/glance_api_spec.rb | 38 ++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 releasenotes/notes/tasks-taskflow_executor-conversion-716730936a03a062.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 4db8cf7a..0d7711af 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -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') diff --git a/releasenotes/notes/tasks-taskflow_executor-conversion-716730936a03a062.yaml b/releasenotes/notes/tasks-taskflow_executor-conversion-716730936a03a062.yaml new file mode 100644 index 00000000..f8961ba2 --- /dev/null +++ b/releasenotes/notes/tasks-taskflow_executor-conversion-716730936a03a062.yaml @@ -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. diff --git a/spec/classes/glance_api_spec.rb b/spec/classes/glance_api_spec.rb index b29d9636..22577dc2 100644 --- a/spec/classes/glance_api_spec.rb +++ b/spec/classes/glance_api_spec.rb @@ -32,6 +32,12 @@ describe 'glance::api' do :image_cache_max_size => '', :os_region_name => 'RegionOne', :pipeline => 'keystone', + :task_time_to_live => '', + :task_executor => '', + :task_work_dir => '', + :taskflow_engine_mode => '', + :taskflow_max_workers => '', + :conversion_format => '', } 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('') is_expected.to contain_glance_api_config('DEFAULT/cert_file').with_value('') @@ -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({