Glance: bring Swift backend support

This patch adds the Swift backend support in Glance service.

* Add the backend in cloud::image::api without new parameter.
* Add new unit tests to validate the backend support with a new context.
* Document the new backend in README.

Change-Id: I685978161e51baa47c897fe0824401615e8c4387
This commit is contained in:
Emilien Macchi
2014-11-20 18:06:32 -05:00
parent 8f83e1bf66
commit 0035caea35
3 changed files with 29 additions and 1 deletions

View File

@@ -41,6 +41,11 @@ Cinder has multi-backend support:
* iSCSI
* EMC VNX direct
* NFS
Glance supports different backends:
* RBD (default)
* file
* NFS (mount a NFS share by using file backend)
* Swift
Neutron supports:
* ML2 plugin with OVS agent (GRE + VXLAN supported)
* Cisco plugin with N1KV agent (non-ML2)

View File

@@ -69,7 +69,7 @@
#
# [*backend*]
# (optionnal) Backend to use to store images
# Can be 'rbd', 'file' or 'nfs'.
# Can be 'rbd', 'file', 'nfs' or 'swift'
# Defaults to 'rbd' to maintain backward compatibility
#
# [*filesystem_store_datadir*]
@@ -200,6 +200,13 @@ class cloud::image::api(
class { 'glance::backend::file':
filesystem_store_datadir => $filesystem_store_datadir
}
} elsif ($backend == 'swift') {
class { 'glance::backend::swift':
swift_store_user => 'services:glance',
swift_store_key => $ks_glance_password,
swift_store_auth_address => "${ks_keystone_internal_proto}://${ks_keystone_internal_host}:35357/v2.0/",
swift_store_create_container_on_put => true,
}
} elsif ($backend == 'nfs') {
# There is no NFS backend in Glance.
# We mount the NFS share in filesystem_store_datadir to fake the

View File

@@ -133,6 +133,22 @@ describe 'cloud::image::api' do
end
end
context 'with Swift backend' do
before :each do
params.merge!(:backend => 'swift')
end
it 'configure Glance with Glance backend' do
is_expected.not_to contain_class('glance::backend::file')
is_expected.not_to contain_class('glance::backend::rbd')
is_expected.to contain_glance_api_config('DEFAULT/default_store').with('value' => 'swift')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_user').with('value' => 'services:glance')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_key').with('value' => 'secrete')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_auth_address').with('value' => 'https://10.0.0.1:35357/v2.0/')
is_expected.to contain_glance_api_config('DEFAULT/swift_store_create_container_on_put').with('value' => true)
end
end
context 'with missing parameter when using Glance NFS backend' do
before :each do
params.merge!(:backend => 'nfs',