diff --git a/README.md b/README.md index 502a82e5..93bb0104 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ glance is a combination of Puppet manifest and ruby code to deliver configuratio Limitations ------------ -* Only supports configuring the file and swift storage backends. +* Only supports configuring the file, swift and rbd storage backends. Development ----------- diff --git a/manifests/backend/rbd.pp b/manifests/backend/rbd.pp new file mode 100644 index 00000000..dbbbc39f --- /dev/null +++ b/manifests/backend/rbd.pp @@ -0,0 +1,27 @@ +# +# configures the storage backend for glance +# as a rbd instance +# +# $rbd_store_user - Optional. +# +# $rbd_store_pool - Optional. Default:'images', +# + +class glance::backend::rbd( + $rbd_store_user = undef, + $rbd_store_pool = 'images', +) { + include glance::params + + glance_api_config { + 'DEFAULT/default_store': value => 'rbd'; + 'DEFAULT/rbd_store_user': value => $rbd_store_user; + 'DEFAULT/rbd_store_pool': value => $rbd_store_pool; + } + + package { 'python-ceph': + ensure => 'present', + name => $::glance::params::pyceph_package_name, + } + +} diff --git a/manifests/params.pp b/manifests/params.pp index 46efc983..5b6a6ec5 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -3,6 +3,7 @@ class glance::params { $client_package_name = 'python-glanceclient' + $pyceph_package_name = 'python-ceph' case $::osfamily { 'RedHat': { diff --git a/spec/classes/glance_backend_rbd_spec.rb b/spec/classes/glance_backend_rbd_spec.rb new file mode 100644 index 00000000..7db49543 --- /dev/null +++ b/spec/classes/glance_backend_rbd_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe 'glance::backend::rbd' do + let :facts do + { + :osfamily => 'Debian' + } + end + + let :params do + { + :rbd_store_user => 'user', + } + end + + it { should contain_glance_api_config('DEFAULT/default_store').with_value('rbd') } + it { should contain_glance_api_config('DEFAULT/rbd_store_user').with_value('user') } + it { should contain_glance_api_config('DEFAULT/rbd_store_pool').with_value('images') } + + it { should contain_package('python-ceph').with( + :name => 'python-ceph', + :ensure => 'present' + ) + } + +end