Add GlusterFS Cinder Backend
Add the support for GlusterFS Cinder Backend in the multi-volume configuration. Change-Id: I386d090215c1c58e452a7188d30a2325144dfcbb
This commit is contained in:
parent
3846a044a3
commit
d0c5b14047
60
manifests/volume/backend/glusterfs.pp
Normal file
60
manifests/volume/backend/glusterfs.pp
Normal file
@ -0,0 +1,60 @@
|
||||
#
|
||||
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Configure GlusterFS backend for Cinder
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*glusterfs_shares*]
|
||||
# (required) An array of GlusterFS volume locations.
|
||||
# Must be an array even if there is only one volume.
|
||||
#
|
||||
# [*volume_backend_name*]
|
||||
# (optional) Allows for the volume_backend_name to be separate of $name.
|
||||
# Defaults to: $name
|
||||
#
|
||||
# [*glusterfs_sparsed_volumes*]
|
||||
# (optional) Whether or not to use sparse (thin) volumes.
|
||||
# Defaults to undef which uses the driver's default of "true".
|
||||
#
|
||||
# [*glusterfs_mount_point_base*]
|
||||
# (optional) Where to mount the Gluster volumes.
|
||||
# Defaults to undef which uses the driver's default of "$state_path/mnt".
|
||||
#
|
||||
# [*glusterfs_shares_config*]
|
||||
# (optional) The config file to store the given $glusterfs_shares.
|
||||
# Defaults to '/etc/cinder/shares.conf'
|
||||
#
|
||||
define cloud::volume::backend::glusterfs (
|
||||
$glusterfs_shares,
|
||||
$volume_backend_name = $name,
|
||||
$glusterfs_sparsed_volumes = undef,
|
||||
$glusterfs_mount_point_base = undef,
|
||||
$glusterfs_shares_config = '/etc/cinder/shares.conf'
|
||||
) {
|
||||
|
||||
cinder::backend::glusterfs { $name:
|
||||
glusterfs_shares => $glusterfs_shares,
|
||||
glusterfs_sparsed_volumes => $glusterfs_sparsed_volumes,
|
||||
glusterfs_mount_point_base => $glusterfs_mount_point_base,
|
||||
glusterfs_shares_config => $glusterfs_shares_config,
|
||||
}
|
||||
|
||||
@cinder::type { $volume_backend_name:
|
||||
set_key => 'volume_backend_name',
|
||||
set_value => $volume_backend_name,
|
||||
notify => Service['cinder-volume']
|
||||
}
|
||||
}
|
@ -105,6 +105,14 @@ class cloud::volume::storage(
|
||||
$eqlx_backends = { }
|
||||
}
|
||||
|
||||
if has_key($cinder_backends, 'glusterfs') {
|
||||
$glusterfs_backends = $cinder_backends['glusterfs']
|
||||
create_resources('cloud::volume::backend::glusterfs', $glusterfs_backends)
|
||||
}
|
||||
else {
|
||||
$glusterfs_backends = { }
|
||||
}
|
||||
|
||||
if has_key($cinder_backends, 'nfs') {
|
||||
$nfs_backends = $cinder_backends['nfs']
|
||||
create_resources('cloud::volume::backend::nfs', $nfs_backends)
|
||||
@ -114,7 +122,7 @@ class cloud::volume::storage(
|
||||
}
|
||||
|
||||
class { 'cinder::backends':
|
||||
enabled_backends => keys(merge($rbd_backends, $netapp_backends, $iscsi_backends, $emc_vnx_backends, $eqlx_backends, $nfs_backends))
|
||||
enabled_backends => keys(merge($rbd_backends, $netapp_backends, $iscsi_backends, $emc_vnx_backends, $eqlx_backends, $nfs_backends, $glusterfs_backends))
|
||||
}
|
||||
|
||||
# Manage Volume types.
|
||||
|
@ -78,6 +78,12 @@ describe 'cloud::volume::storage' do
|
||||
'eqlx_group_name' => 'dell-volumes',
|
||||
}
|
||||
},
|
||||
'glusterfs' => {
|
||||
'gluster' => {
|
||||
'glusterfs_shares' => ['/mnt/share'],
|
||||
'glusterfs_shares_config' => '/etc/cinder/shares-gluster.conf',
|
||||
}
|
||||
},
|
||||
'nfs' => {
|
||||
'freenas' => {
|
||||
'nfs_servers' => ['10.0.0.1:/myshare'],
|
||||
@ -208,6 +214,18 @@ describe 'cloud::volume::storage' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with GlusterFS backend' do
|
||||
it 'configures GlusterFS volume driver' do
|
||||
should contain_cinder_config('gluster/volume_backend_name').with_value('gluster')
|
||||
should contain_cinder_config('gluster/glusterfs_shares_config').with_value('/etc/cinder/shares-gluster.conf')
|
||||
should contain_cinder__type('gluster').with(
|
||||
:set_key => 'volume_backend_name',
|
||||
:set_value => 'gluster',
|
||||
:notify => 'Service[cinder-volume]'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with NFS backend' do
|
||||
it 'configures NFS volume driver' do
|
||||
is_expected.to contain_cinder_config('freenas/volume_backend_name').with_value('freenas')
|
||||
@ -279,7 +297,7 @@ describe 'cloud::volume::storage' do
|
||||
context 'with all backends enabled' do
|
||||
it 'configure all cinder backends' do
|
||||
is_expected.to contain_class('cinder::backends').with(
|
||||
:enabled_backends => ['lowcost', 'premium', 'fast', 'very-fast', 'dell', 'freenas']
|
||||
:enabled_backends => ['lowcost', 'premium', 'fast', 'very-fast', 'dell', 'freenas', 'gluster']
|
||||
)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user