From bf195330726434c18456e9d6e975d54afac0eb6a Mon Sep 17 00:00:00 2001 From: Marc Koderer Date: Fri, 5 Jul 2013 08:19:29 +0200 Subject: [PATCH] Add support for rbd in glance Add support for Ceph/rbd in glance. Unit test added to spec. Add package dependency "python-ceph" accordingly to a patch from Michael Jeanson . Change-Id: I0908cde951994db6aba74d2ce3415126c429a76e --- README.md | 2 +- manifests/backend/rbd.pp | 27 +++++++++++++++++++++++++ manifests/params.pp | 1 + spec/classes/glance_backend_rbd_spec.rb | 26 ++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 manifests/backend/rbd.pp create mode 100644 spec/classes/glance_backend_rbd_spec.rb 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