From 5f1ef40ab1731e2122734302667106f733865545 Mon Sep 17 00:00:00 2001 From: Sam Morrison Date: Tue, 16 Jun 2020 09:56:00 +1000 Subject: [PATCH] Add swift buffer-on-upload options for swift multibackend Adds ability to set swift_buffer_on_upload and swift_upload_buffer_dir for swift multi backend Change-Id: Ic29448860f5c7a8b743abd6f343985e65d8c5693 (cherry picked from commit 9d340581b15c9b3c20d7f37f820041881177dd77) (cherry picked from commit d7282093228591f29b52717f05d8e6eeb419abbf) --- manifests/backend/multistore/swift.pp | 10 ++++++++++ .../add_swift_buffer_options-30716d70fc42b749.yaml | 7 +++++++ spec/defines/glance_backend_multistore_swift_spec.rb | 6 ++++++ 3 files changed, 23 insertions(+) create mode 100644 releasenotes/notes/add_swift_buffer_options-30716d70fc42b749.yaml diff --git a/manifests/backend/multistore/swift.pp b/manifests/backend/multistore/swift.pp index 8e3bb57f..0aeed921 100644 --- a/manifests/backend/multistore/swift.pp +++ b/manifests/backend/multistore/swift.pp @@ -70,6 +70,12 @@ # new images. String value. # Default to 'ref1'. # +# [*swift_buffer_on_upload*] +# Optional. Default: $::os_service_default. +# +# [*swift_upload_buffer_dir*] +# Optional. Default: $::os_service_default. +# # [*store_description*] # (optional) Provides constructive information about the store backend to # end users. @@ -90,6 +96,8 @@ define glance::backend::multistore::swift( $swift_store_region = $::os_service_default, $swift_store_config_file = '/etc/glance/glance-swift.conf', $default_swift_reference = 'ref1', + $swift_buffer_on_upload = $::os_service_default, + $swift_upload_buffer_dir = $::os_service_default, $store_description = $::os_service_default, ) { @@ -108,6 +116,8 @@ define glance::backend::multistore::swift( "${name}/swift_store_endpoint_type": value => $swift_store_endpoint_type; "${name}/swift_store_config_file": value => $swift_store_config_file; "${name}/default_swift_reference": value => $default_swift_reference; + "${name}/swift_buffer_on_upload": value => $swift_buffer_on_upload; + "${name}/swift_upload_buffer_dir": value => $swift_upload_buffer_dir; "${name}/store_description": value => $store_description; } diff --git a/releasenotes/notes/add_swift_buffer_options-30716d70fc42b749.yaml b/releasenotes/notes/add_swift_buffer_options-30716d70fc42b749.yaml new file mode 100644 index 00000000..f999ccdc --- /dev/null +++ b/releasenotes/notes/add_swift_buffer_options-30716d70fc42b749.yaml @@ -0,0 +1,7 @@ +--- +features: + - Add new options + glance::backend::multibackend::swift::swift_buffer_on_upload and + glance::backend::multibackend::swift::swift_upload_buffer_dir + Indicate whether or not Glance should buffer image data to disk while + uploading to swift. This enables Glance to resume uploads on error. diff --git a/spec/defines/glance_backend_multistore_swift_spec.rb b/spec/defines/glance_backend_multistore_swift_spec.rb index 9b0a014d..98fb2233 100644 --- a/spec/defines/glance_backend_multistore_swift_spec.rb +++ b/spec/defines/glance_backend_multistore_swift_spec.rb @@ -48,6 +48,8 @@ describe 'glance::backend::multistore::swift' do is_expected.to contain_glance_api_config('swift/swift_store_region').with_value('') is_expected.to contain_glance_api_config('swift/swift_store_config_file').with_value('/etc/glance/glance-swift.conf') is_expected.to contain_glance_api_config('swift/default_swift_reference').with_value('ref1') + is_expected.to contain_glance_api_config('swift/swift_buffer_on_upload').with_value('') + is_expected.to contain_glance_api_config('swift/swift_upload_buffer_dir').with_value('') is_expected.to contain_glance_swift_config('ref1/key').with_value('key') is_expected.to contain_glance_swift_config('ref1/user').with_value('user') is_expected.to contain_glance_swift_config('ref1/auth_version').with_value('2') @@ -75,6 +77,8 @@ describe 'glance::backend::multistore::swift' do :swift_store_region => 'RegionTwo', :swift_store_config_file => '/etc/glance/glance-swift2.conf', :default_swift_reference => 'swift_creds', + :swift_buffer_on_upload => true, + :swift_upload_buffer_dir => '/var/glance/swift', } end @@ -88,6 +92,8 @@ describe 'glance::backend::multistore::swift' do is_expected.to contain_glance_api_config('swift/swift_store_region').with_value('RegionTwo') is_expected.to contain_glance_api_config('swift/swift_store_config_file').with_value('/etc/glance/glance-swift2.conf') is_expected.to contain_glance_api_config('swift/default_swift_reference').with_value('swift_creds') + is_expected.to contain_glance_api_config('swift/swift_buffer_on_upload').with_value(true) + is_expected.to contain_glance_api_config('swift/swift_upload_buffer_dir').with_value('/var/glance/swift') is_expected.to contain_glance_swift_config('swift_creds/key').with_value('key2') is_expected.to contain_glance_swift_config('swift_creds/user').with_value('user2') is_expected.to contain_glance_swift_config('swift_creds/auth_version').with_value('1')