add backup compression variable

adding backup_compression_algorithm to the swift.pp file
to allow users to modify the setting via puppet

Change-Id: Ieb10bb97a3aa7fa502b31e0898fc538e9dee1cf7
This commit is contained in:
cdelatte 2015-05-08 10:54:13 -04:00
parent 1d752f201b
commit d6ccce6554
2 changed files with 28 additions and 17 deletions

View File

@ -29,6 +29,11 @@
# (optional) The backoff time in seconds between Swift retries. # (optional) The backoff time in seconds between Swift retries.
# Defaults to '2' # Defaults to '2'
# #
# [*backup_compression_algorithm*]
# (optional) The compression algorithm for the chunks sent to swift
# Defaults to 'zlib'
# set to None to disable compression
#
# === Author(s) # === Author(s)
# #
# Emilien Macchi <emilien.macchi@enovance.com> # Emilien Macchi <emilien.macchi@enovance.com>
@ -56,7 +61,8 @@ class cinder::backup::swift (
$backup_swift_container = 'volumes_backup', $backup_swift_container = 'volumes_backup',
$backup_swift_object_size = '52428800', $backup_swift_object_size = '52428800',
$backup_swift_retry_attempts = '3', $backup_swift_retry_attempts = '3',
$backup_swift_retry_backoff = '2' $backup_swift_retry_backoff = '2',
$backup_compression_algorithm = 'zlib',
) { ) {
cinder_config { cinder_config {
@ -66,6 +72,7 @@ class cinder::backup::swift (
'DEFAULT/backup_swift_object_size': value => $backup_swift_object_size; 'DEFAULT/backup_swift_object_size': value => $backup_swift_object_size;
'DEFAULT/backup_swift_retry_attempts': value => $backup_swift_retry_attempts; 'DEFAULT/backup_swift_retry_attempts': value => $backup_swift_retry_attempts;
'DEFAULT/backup_swift_retry_backoff': value => $backup_swift_retry_backoff; 'DEFAULT/backup_swift_retry_backoff': value => $backup_swift_retry_backoff;
'DEFAULT/backup_compression_algorithm': value => $backup_compression_algorithm;
} }
} }

View File

@ -27,7 +27,8 @@ describe 'cinder::backup::swift' do
:backup_swift_container => 'volumes_backup', :backup_swift_container => 'volumes_backup',
:backup_swift_object_size => '52428800', :backup_swift_object_size => '52428800',
:backup_swift_retry_attempts => '3', :backup_swift_retry_attempts => '3',
:backup_swift_retry_backoff => '2' } :backup_swift_retry_backoff => '2',
:backup_compression_algorithm => 'zlib' }
end end
let :params do let :params do
@ -46,6 +47,7 @@ describe 'cinder::backup::swift' do
is_expected.to contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff])
is_expected.to contain_cinder_config('DEFAULT/backup_compression_algorithm').with_value(p[:backup_compression_algorithm])
end end
context 'when overriding default parameters' do context 'when overriding default parameters' do
@ -55,6 +57,7 @@ describe 'cinder::backup::swift' do
params.merge!(:backup_swift_object_size => '123') params.merge!(:backup_swift_object_size => '123')
params.merge!(:backup_swift_retry_attempts => '99') params.merge!(:backup_swift_retry_attempts => '99')
params.merge!(:backup_swift_retry_backoff => '56') params.merge!(:backup_swift_retry_backoff => '56')
params.merge!(:backup_compression_algorithm => 'None')
end end
it 'should replace default parameters with new values' do it 'should replace default parameters with new values' do
is_expected.to contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url])
@ -62,6 +65,7 @@ describe 'cinder::backup::swift' do
is_expected.to contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff]) is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff])
is_expected.to contain_cinder_config('DEFAULT/backup_compression_algorithm').with_value(p[:backup_compression_algorithm])
end end
end end
end end