Cleaned up gluster driver
This commit is contained in:
parent
0d85fba2e3
commit
178b80449d
@ -4,47 +4,37 @@
|
||||
# Configures Manila to use GlusterFS as a share driver
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*glusterfs_shares*]
|
||||
# (required) An array of GlusterFS share locations.
|
||||
# Must be an array even if there is only one share.
|
||||
#
|
||||
# [*share_backend_name*]
|
||||
# (optional) Allows for the share_backend_name to be separate of $name.
|
||||
# Defaults to: $name
|
||||
# (optional) Name of the backend in manila.conf that
|
||||
# these settings will reside in
|
||||
#
|
||||
# [*glusterfs_disk_util*]
|
||||
# Removed in Icehouse.
|
||||
#
|
||||
# [*glusterfs_sparsed_shares*]
|
||||
# (optional) Whether or not to use sparse (thin) shares.
|
||||
# Defaults to undef which uses the driver's default of "true".
|
||||
# [*glusterfs_volumes_config*]
|
||||
# (required) File with the list of Gluster volumes that can be used to
|
||||
# create shares
|
||||
# Default to: /etc/manila/glusterfs_volumes
|
||||
#
|
||||
# [*glusterfs_mount_point_base*]
|
||||
# (optional) Where to mount the Gluster shares.
|
||||
# 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/manila/shares.conf'
|
||||
# (optional) Base dir containing mount points for Gluster volumes.
|
||||
# Defaults to: $state_path/mnt
|
||||
#
|
||||
# === Examples
|
||||
#
|
||||
# #NTAP: check example
|
||||
# manila::backend::glusterfs { 'myGluster':
|
||||
# glusterfs_shares = ['192.168.1.1:/shares'],
|
||||
# }
|
||||
#
|
||||
define manila::backend::glusterfs (
|
||||
$glusterfs_volumes_config = '/etc/manila/glusterfs_volumes',
|
||||
$share_backend_name = $name,
|
||||
$glusterfs_mount_point_base = undef,
|
||||
$glusterfs_volumes_config = '/etc/manila/glusterfs_volumes',
|
||||
$glusterfs_mount_point_base = '$state_path/mnt',
|
||||
) {
|
||||
|
||||
$share_driver = 'manila.share.drivers.glusterfs.GlusterfsShareDriver'
|
||||
|
||||
manila_config {
|
||||
"${name}/share_backend_name": value => $share_backend_name;
|
||||
"${name}/share_driver": value =>
|
||||
'manila.share.drivers.glusterfs.GlusterfsDriver';
|
||||
"${name}/share_backend_name": value => $share_backend_name;
|
||||
"${name}/share_driver": value => $share_driver;
|
||||
"${name}/glusterfs_volumes_config": value => $glusterfs_volumes_config;
|
||||
"${name}/glusterfs_mount_point_base": value => $glusterfs_mount_point_base;
|
||||
"${name}/glusterfs_mount_point_base": value => $glusterfs_mount_point_base;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
#
|
||||
class manila::share::glusterfs (
|
||||
$glusterfs_volumes_config = '/etc/manila/glusterfs_volumes',
|
||||
$glusterfs_mount_point_base = undef,
|
||||
$glusterfs_mount_point_base = '$state_path/mnt',
|
||||
) {
|
||||
|
||||
manila::backend::glusterfs { 'DEFAULT':
|
||||
|
@ -5,27 +5,18 @@ describe 'manila::share::glusterfs' do
|
||||
shared_examples_for 'glusterfs share driver' do
|
||||
let :params do
|
||||
{
|
||||
:glusterfs_shares => ['10.10.10.10:/shares', '10.10.10.11:/shares'],
|
||||
:glusterfs_shares_config => '/etc/manila/other_shares.conf',
|
||||
:glusterfs_sparsed_shares => true,
|
||||
:glusterfs_mount_point_base => '/manila_mount_point',
|
||||
:glusterfs_volumes_config => '/etc/manila/glusterfs_volumes',
|
||||
:glusterfs_mount_point_base => '$state_path/mnt',
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures glusterfs share driver' do
|
||||
should contain_manila_config('DEFAULT/share_driver').with_value(
|
||||
'manila.share.drivers.glusterfs.GlusterfsDriver')
|
||||
should contain_manila_config('DEFAULT/glusterfs_shares_config').with_value(
|
||||
'/etc/manila/other_shares.conf')
|
||||
should contain_manila_config('DEFAULT/glusterfs_sparsed_shares').with_value(
|
||||
true)
|
||||
'manila.share.drivers.glusterfs.GlusterfsShareDriver')
|
||||
should contain_manila_config('DEFAULT/glusterfs_volumes_config').with_value(
|
||||
'/etc/manila/glusterfs_volumes')
|
||||
should contain_manila_config('DEFAULT/glusterfs_mount_point_base').with_value(
|
||||
'/manila_mount_point')
|
||||
should contain_file('/etc/manila/other_shares.conf').with(
|
||||
:content => "10.10.10.10:/shares\n10.10.10.11:/shares\n",
|
||||
:require => 'Package[manila]',
|
||||
:notify => 'Service[manila-share]'
|
||||
)
|
||||
'$state_path/mnt')
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,38 +7,20 @@ describe 'manila::backend::glusterfs' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:glusterfs_shares => ['10.10.10.10:/shares', '10.10.10.11:/shares'],
|
||||
:glusterfs_shares_config => '/etc/manila/other_shares.conf',
|
||||
:glusterfs_sparsed_shares => true,
|
||||
:glusterfs_mount_point_base => '/manila_mount_point',
|
||||
:glusterfs_volumes_config => '/etc/manila/glusterfs_volumes',
|
||||
:glusterfs_mount_point_base => '$state_path/mnt',
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures glusterfs share driver' do
|
||||
should contain_manila_config('mygluster/share_backend_name').with_value(
|
||||
'mygluster')
|
||||
should contain_manila_config('mygluster/share_driver').with_value(
|
||||
'manila.share.drivers.glusterfs.GlusterfsDriver')
|
||||
should contain_manila_config('mygluster/glusterfs_shares_config').with_value(
|
||||
'/etc/manila/other_shares.conf')
|
||||
should contain_manila_config('mygluster/glusterfs_sparsed_shares').with_value(
|
||||
true)
|
||||
'manila.share.drivers.glusterfs.GlusterfsShareDriver')
|
||||
should contain_manila_config('mygluster/glusterfs_volumes_config').with_value(
|
||||
'/etc/manila/glusterfs_volumes')
|
||||
should contain_manila_config('mygluster/glusterfs_mount_point_base').with_value(
|
||||
'/manila_mount_point')
|
||||
should contain_file('/etc/manila/other_shares.conf').with(
|
||||
:content => "10.10.10.10:/shares\n10.10.10.11:/shares\n",
|
||||
:require => 'Package[manila]',
|
||||
:notify => 'Service[manila-share]'
|
||||
)
|
||||
end
|
||||
|
||||
context "with an parameter which has been removed" do
|
||||
before do
|
||||
params.merge!({
|
||||
:glusterfs_disk_util => 'foo',
|
||||
})
|
||||
end
|
||||
it 'should fails' do
|
||||
expect { subject }.to raise_error(Puppet::Error, /glusterfs_disk_util is removed in Icehouse./)
|
||||
end
|
||||
'$state_path/mnt')
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user