diff --git a/manifests/backend/glusterfs.pp b/manifests/backend/glusterfs.pp index 70205348..882e3c55 100644 --- a/manifests/backend/glusterfs.pp +++ b/manifests/backend/glusterfs.pp @@ -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; } } diff --git a/manifests/share/glusterfs.pp b/manifests/share/glusterfs.pp index 2fb42914..309db4a6 100644 --- a/manifests/share/glusterfs.pp +++ b/manifests/share/glusterfs.pp @@ -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': diff --git a/spec/classes/manila_share_glusterfs_spec.rb b/spec/classes/manila_share_glusterfs_spec.rb index 384f1f85..8e1ed9f7 100644 --- a/spec/classes/manila_share_glusterfs_spec.rb +++ b/spec/classes/manila_share_glusterfs_spec.rb @@ -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 diff --git a/spec/defines/manila_backend_glusterfs_spec.rb b/spec/defines/manila_backend_glusterfs_spec.rb index fe1c4509..129c24bf 100644 --- a/spec/defines/manila_backend_glusterfs_spec.rb +++ b/spec/defines/manila_backend_glusterfs_spec.rb @@ -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