diff --git a/manifests/glance.pp b/manifests/glance.pp index 2786518..7a52954 100644 --- a/manifests/glance.pp +++ b/manifests/glance.pp @@ -21,6 +21,8 @@ # [db_user] Name of glance DB user. Optional. Defaults to 'glance' # [db_name] Name of glance DB. Optional. Defaults to 'glance' # [backend] Backends used to store images. Defaults to file. +# [rbd_store_user] The RBD store user name. +# [rbd_store_pool] The RBD pool name to store images. # [swift_store_user] The Swift service user account. Defaults to false. # [swift_store_key] The Swift service user password Defaults to false. # [swift_store_auth_addres] The URL where the Swift auth service lives. Defaults to "http://${keystone_host}:5000/v2.0/" @@ -52,6 +54,8 @@ class openstack::glance ( $swift_store_user = false, $swift_store_key = false, $swift_store_auth_address = 'http://127.0.0.1:5000/v2.0/', + $rbd_store_user = undef, + $rbd_store_pool = 'images', $verbose = false, $debug = false, $enabled = true @@ -115,6 +119,11 @@ class openstack::glance ( } elsif($backend == 'file') { # Configure file storage backend class { 'glance::backend::file': } + } elsif($backend == 'rbd') { + class { 'glance::backend::rbd': + rbd_store_user => $rbd_store_user, + rbd_store_pool => $rbd_store_pool, + } } else { fail("Unsupported backend ${backend}") } diff --git a/spec/classes/openstack_glance_spec.rb b/spec/classes/openstack_glance_spec.rb index 007ff01..0ac6711 100644 --- a/spec/classes/openstack_glance_spec.rb +++ b/spec/classes/openstack_glance_spec.rb @@ -111,4 +111,27 @@ describe 'openstack::glance' do end end end + + describe 'when configuring rbd as the backend' do + + before do + params.merge!({ + :backend => 'rbd', + :rbd_store_user => 'don', + :rbd_store_pool => 'images' + }) + end + + it 'should configure rbd as the backend' do + should_not contain_class('glance::backend::file') + + should_not contain_class('glance::backend::swift') + + should contain_class('glance::backend::rbd').with( + :rbd_store_user => 'don', + :rbd_store_pool => 'images' + ) + end + end + end