volume: add volume_clear options
Implement 3 new options for cinder::volume class: * volume_clear * volume_clear_size * volume_clear_ionice Those 3 options can be used to configure the method of volume wiping. Change-Id: I7302b89da5a995e779ec349ab0c0f519c69a3a98
This commit is contained in:
@@ -14,10 +14,28 @@
|
|||||||
# (Optional) Whether to start/stop the service.
|
# (Optional) Whether to start/stop the service.
|
||||||
# Defaults to 'true'.
|
# Defaults to 'true'.
|
||||||
#
|
#
|
||||||
|
# [*volume_clear*]
|
||||||
|
# (Optional) Method used to wipe old volumes.
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*volume_clear_size*]
|
||||||
|
# (Optional) Size in MiB to wipe at start of old volumes.
|
||||||
|
# Set to '0' means all.
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*volume_clear_ionice*]
|
||||||
|
# (Optional) The flag to pass to ionice to alter the i/o priority
|
||||||
|
# of the process used to zero a volume after deletion,
|
||||||
|
# for example "-c3" for idle only priority.
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
class cinder::volume (
|
class cinder::volume (
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$enabled = true,
|
$enabled = true,
|
||||||
$manage_service = true
|
$manage_service = true,
|
||||||
|
$volume_clear = $::os_service_default,
|
||||||
|
$volume_clear_size = $::os_service_default,
|
||||||
|
$volume_clear_ionice = $::os_service_default,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include ::cinder::params
|
include ::cinder::params
|
||||||
@@ -52,4 +70,10 @@ class cinder::volume (
|
|||||||
require => Package['cinder'],
|
require => Package['cinder'],
|
||||||
tag => 'cinder-service',
|
tag => 'cinder-service',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cinder_config {
|
||||||
|
'DEFAULT/volume_clear': value => $volume_clear;
|
||||||
|
'DEFAULT/volume_clear_size': value => $volume_clear_size;
|
||||||
|
'DEFAULT/volume_clear_ionice': value => $volume_clear_ionice;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ describe 'cinder::volume' do
|
|||||||
'hasstatus' => true,
|
'hasstatus' => true,
|
||||||
'tag' => 'cinder-service',
|
'tag' => 'cinder-service',
|
||||||
)}
|
)}
|
||||||
|
it { is_expected.to contain_cinder_config('DEFAULT/volume_clear').with_value('<SERVICE DEFAULT>') }
|
||||||
|
it { is_expected.to contain_cinder_config('DEFAULT/volume_clear_size').with_value('<SERVICE DEFAULT>') }
|
||||||
|
it { is_expected.to contain_cinder_config('DEFAULT/volume_clear_ionice').with_value('<SERVICE DEFAULT>') }
|
||||||
|
|
||||||
describe 'with manage_service false' do
|
describe 'with manage_service false' do
|
||||||
let :params do
|
let :params do
|
||||||
@@ -24,4 +27,19 @@ describe 'cinder::volume' do
|
|||||||
is_expected.to contain_service('cinder-volume').without_ensure
|
is_expected.to contain_service('cinder-volume').without_ensure
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'with volume_clear parameters' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
'volume_clear' => 'none',
|
||||||
|
'volume_clear_size' => '10',
|
||||||
|
'volume_clear_ionice' => '-c3',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
it 'should set volume_clear parameters' do
|
||||||
|
is_expected.to contain_cinder_config('DEFAULT/volume_clear').with_value('none')
|
||||||
|
is_expected.to contain_cinder_config('DEFAULT/volume_clear_size').with_value('10')
|
||||||
|
is_expected.to contain_cinder_config('DEFAULT/volume_clear_ionice').with_value('-c3')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user