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 <mjeanson@gmail.com>.

Change-Id: I0908cde951994db6aba74d2ce3415126c429a76e
This commit is contained in:
Marc Koderer 2013-07-05 08:19:29 +02:00
parent 3a0003f9bb
commit bf19533072
4 changed files with 55 additions and 1 deletions

View File

@ -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
-----------

27
manifests/backend/rbd.pp Normal file
View File

@ -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,
}
}

View File

@ -3,6 +3,7 @@
class glance::params {
$client_package_name = 'python-glanceclient'
$pyceph_package_name = 'python-ceph'
case $::osfamily {
'RedHat': {

View File

@ -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