move default_volume_type to cinder::api
In a previous commit, this parameter has been introduced in cinder::backends, but it should be configured on Cinder API server. This patch deprecated the old parameter. Change-Id: Ic84c316dc80d8d778ce62df85a6b5bff4a18ead1 Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
parent
6dbafb7a8f
commit
eccaa59fb9
@ -72,6 +72,12 @@
|
||||
# (optional) Factory to use for ratelimiting
|
||||
# Defaults to 'cinder.api.v1.limits:RateLimitingMiddleware.factory'
|
||||
#
|
||||
# [*default_volume_type*]
|
||||
# (optional) default volume type to use.
|
||||
# This should contain the name of the default volume type to use.
|
||||
# If not configured, it produces an error when creating a volume
|
||||
# without specifying a type.
|
||||
# Defaults to 'false'.
|
||||
class cinder::api (
|
||||
$keystone_password,
|
||||
$keystone_enabled = true,
|
||||
@ -89,6 +95,7 @@ class cinder::api (
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
$ratelimits = undef,
|
||||
$default_volume_type = false,
|
||||
$ratelimits_factory =
|
||||
'cinder.api.v1.limits:RateLimitingMiddleware.factory'
|
||||
) {
|
||||
@ -187,4 +194,15 @@ class cinder::api (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if $default_volume_type {
|
||||
cinder_config {
|
||||
'DEFAULT/default_volume_type': value => $default_volume_type;
|
||||
}
|
||||
} else {
|
||||
cinder_config {
|
||||
'DEFAULT/default_volume_type': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,16 +9,10 @@
|
||||
# This should contain names used in ceph::backend::* resources.
|
||||
# Example: ['volume1', 'volume2', 'sata3']
|
||||
#
|
||||
# [*default_volume_type*]
|
||||
# (optional) default volume type to use.
|
||||
# This should contain the name of the default volume type to use.
|
||||
# If not configured, it produces an error when creating a volume
|
||||
# without specifying a type.
|
||||
# Defaults to 'false'.
|
||||
#
|
||||
# Author: Andrew Woodward <awoodward@mirantis.com>
|
||||
class cinder::backends (
|
||||
$enabled_backends = undef,
|
||||
# DEPRECATED
|
||||
$default_volume_type = false
|
||||
){
|
||||
|
||||
@ -28,13 +22,7 @@ class cinder::backends (
|
||||
}
|
||||
|
||||
if $default_volume_type {
|
||||
cinder_config {
|
||||
'DEFAULT/default_volume_type': value => $default_volume_type;
|
||||
}
|
||||
} else {
|
||||
cinder_config {
|
||||
'DEFAULT/default_volume_type': ensure => absent;
|
||||
}
|
||||
fail('The default_volume_type parameter is deprecated in this class, you should declare it in cinder::api.')
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ describe 'cinder::api' do
|
||||
should contain_cinder_config('DEFAULT/osapi_volume_listen').with(
|
||||
:value => '0.0.0.0'
|
||||
)
|
||||
should contain_cinder_config('DEFAULT/default_volume_type').with(
|
||||
:ensure => 'absent'
|
||||
)
|
||||
should contain_cinder_api_paste_ini('filter:authtoken/service_protocol').with(
|
||||
:value => 'http'
|
||||
)
|
||||
@ -77,6 +80,17 @@ describe 'cinder::api' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with a default volume type' do
|
||||
let :params do
|
||||
req_params.merge({'default_volume_type' => 'foo'})
|
||||
end
|
||||
it 'should configure the default volume type for cinder' do
|
||||
should contain_cinder_config('DEFAULT/default_volume_type').with(
|
||||
:value => 'foo'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with custom auth_uri' do
|
||||
let :params do
|
||||
req_params.merge({'keystone_auth_uri' => 'http://foo.bar:8080/v2.0/'})
|
||||
|
@ -46,20 +46,19 @@ describe 'cinder::backends' do
|
||||
|
||||
it 'configures cinder.conf with default params' do
|
||||
should contain_cinder_config('DEFAULT/enabled_backends').with_value(p[:enabled_backends].join(','))
|
||||
should contain_cinder_config('DEFAULT/default_volume_type').with_ensure('absent')
|
||||
end
|
||||
end
|
||||
|
||||
context 'configure cinder with a default volume type' do
|
||||
before :each do
|
||||
params.merge!(
|
||||
:enabled_backends => ['lowcost', 'regular', 'premium'],
|
||||
:enabled_backends => ['foo', 'bar'],
|
||||
:default_volume_type => 'regular'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures cinder.conf with default params' do
|
||||
should contain_cinder_config('DEFAULT/default_volume_type').with_value('regular')
|
||||
it 'should fail to configure default volume type' do
|
||||
expect { subject }.to raise_error(Puppet::Error, /The default_volume_type parameter is deprecated in this class, you should declare it in cinder::api./)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user