add rbd backend support to glance

Change-Id: I03b59e627b66e744a6efe45db24b8929e75f5e2e
This commit is contained in:
dotalton
2013-07-25 12:38:59 -07:00
parent 8d5cb7fb02
commit 08fbeae766
2 changed files with 32 additions and 0 deletions

View File

@@ -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}")
}

View File

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