diff --git a/manifests/api.pp b/manifests/api.pp index 86f41765..35356b17 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -62,6 +62,10 @@ # (optional) Factory to use for ratelimiting # Defaults to 'cinder.api.v1.limits:RateLimitingMiddleware.factory' # +# [*default_volume_type*] +# (optional) Specify the default volume type +# Defaults to undef. +# class cinder::api ( $keystone_password, $keystone_enabled = true, @@ -78,7 +82,8 @@ class cinder::api ( $enabled = true, $ratelimits = undef, $ratelimits_factory = - 'cinder.api.v1.limits:RateLimitingMiddleware.factory' + 'cinder.api.v1.limits:RateLimitingMiddleware.factory', + $default_volume_type = undef, ) { include cinder::params @@ -165,4 +170,13 @@ 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; + } + } } diff --git a/spec/classes/cinder_api_spec.rb b/spec/classes/cinder_api_spec.rb index 9f223f31..9b00328b 100644 --- a/spec/classes/cinder_api_spec.rb +++ b/spec/classes/cinder_api_spec.rb @@ -83,6 +83,7 @@ describe 'cinder::api' do should contain_cinder_config('DEFAULT/osapi_volume_listen').with( :value => '192.168.1.3' ) + should contain_cinder_config('DEFAULT/default_volume_type').with_ensure('absent') end end @@ -141,4 +142,14 @@ describe 'cinder::api' do )} end + describe 'with default volume type' do + let :params do + req_params.merge({ :default_volume_type => 'LVM_iSCSI' }) + end + + it { should contain_cinder_config('DEFAULT/default_volume_type').with( + :value => 'LVM_iSCSI' + )} + end + end