diff --git a/manifests/backend/cephfs.pp b/manifests/backend/cephfs.pp new file mode 100644 index 00000000..ae981489 --- /dev/null +++ b/manifests/backend/cephfs.pp @@ -0,0 +1,66 @@ +# ==define manila::backend::cephfsnative +# +# === Parameters +# +# [*driver_handles_share_servers*] +# (optional) Denotes whether the driver should handle the responsibility of +# managing share servers. This must be set to false if the driver is to +# operate without managing share servers. +# Defaults to: False +# +# [*share_backend_name*] +# (optional) Name of the backend in manila.conf that +# these settings will reside in +# Defaults to: cephfsnative +# +# [*cephfs_conf_path*] +# (optional) Path to cephfs config. +# Defaults to: $state_path/ceph.conf +# +# [*cephfs_auth_id*] +# (optional) cephx user id for Manila +# Defaults to: manila +# +# [*cephfs_cluster_name*] +# (optional) Name of the cephfs cluster the driver will connect to. +# Defaults to: ceph +# +# [*cephfs_enable_snapshots*] +# (optional) If set to True, then Manila will utilize ceph snapshots. +# Defaults to: False +# +# [*cephfs_ganesha_server_ip*] +# (optional) IP of a server where Ganesha service runs on. +# Defaults to: undef +# +# [*cephfs_protocol_helper_type*] +# (optional) Sets helper type for CephFS driver, can be CEPHFS or NFS +# Defaults to: CEPHFS +# +define manila::backend::cephfs ( + $driver_handles_share_servers = false, + $share_backend_name = $name, + $cephfs_conf_path = '$state_path/ceph.conf', + $cephfs_auth_id = 'manila', + $cephfs_cluster_name = 'ceph', + $cephfs_enable_snapshots = false, + $cephfs_protocol_helper_type = 'CEPHFS', + $cephfs_ganesha_server_ip = undef, +) { + + include ::manila::deps + + $share_driver = 'manila.share.drivers.cephfs.driver.CephFSDriver' + + manila_config { + "${name}/driver_handles_share_servers": value => $driver_handles_share_servers; + "${name}/share_backend_name": value => $share_backend_name; + "${name}/share_driver": value => $share_driver; + "${name}/cephfs_conf_path": value => $cephfs_conf_path; + "${name}/cephfs_auth_id": value => $cephfs_auth_id; + "${name}/cephfs_cluster_name": value => $cephfs_cluster_name; + "${name}/cephfs_enable_snapshots": value => $cephfs_enable_snapshots; + "${name}/cephfs_protocol_helper_type": value => $cephfs_protocol_helper_type; + "${name}/cephfs_ganesha_server_ip": value => $cephfs_ganesha_server_ip; + } +} diff --git a/manifests/backend/cephfsnative.pp b/manifests/backend/cephfsnative.pp index 38151133..7e5d223f 100644 --- a/manifests/backend/cephfsnative.pp +++ b/manifests/backend/cephfsnative.pp @@ -40,6 +40,8 @@ define manila::backend::cephfsnative ( include ::manila::deps + warning('manila::cephfsnative class is deprecated and will be removed in next release. You can use cephfs backend.') + $share_driver = 'manila.share.drivers.cephfs.cephfs_native.CephFSNativeDriver' manila_config { diff --git a/releasenotes/notes/deprecate-cephfsnative-add-cephfs-8ea802ec233c7618.yaml b/releasenotes/notes/deprecate-cephfsnative-add-cephfs-8ea802ec233c7618.yaml new file mode 100644 index 00000000..87ab0527 --- /dev/null +++ b/releasenotes/notes/deprecate-cephfsnative-add-cephfs-8ea802ec233c7618.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Added new cephfs class which supports both direct cephfs access or through + ganesha-nfs server. +deprecations: + - | + Deprecated cephfsnative class in favor of the new cephfs class. diff --git a/spec/defines/manila_backend_cephfs_spec.rb b/spec/defines/manila_backend_cephfs_spec.rb new file mode 100644 index 00000000..7693876b --- /dev/null +++ b/spec/defines/manila_backend_cephfs_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' + +describe 'manila::backend::cephfs' do + + shared_examples_for 'cephfs driver' do + let(:title) {'cephfs'} + let :params do + { + :driver_handles_share_servers => false, + :share_backend_name => 'cephfs', + :cephfs_conf_path => '$state_path/ceph.conf', + :cephfs_auth_id => 'manila', + :cephfs_cluster_name => 'ceph', + :cephfs_enable_snapshots => true, + :cephfs_protocol_helper_type => 'NFS', + :cephfs_ganesha_server_ip => '10.0.0.1', + } + end + + it 'configures cephfs driver' do + is_expected.to contain_manila_config('cephfs/share_driver').with_value( + 'manila.share.drivers.cephfs.driver.CephFSDriver') + is_expected.to contain_manila_config('cephfs/share_backend_name').with_value( + 'cephfs') + is_expected.to contain_manila_config('cephfs/cephfs_conf_path').with_value( + '$state_path/ceph.conf') + is_expected.to contain_manila_config('cephfs/cephfs_auth_id').with_value( + 'manila') + is_expected.to contain_manila_config('cephfs/cephfs_cluster_name').with_value( + 'ceph') + is_expected.to contain_manila_config('cephfs/cephfs_enable_snapshots').with_value( + true) + is_expected.to contain_manila_config('cephfs/cephfs_protocol_helper_type').with_value( + 'NFS') + is_expected.to contain_manila_config('cephfs/cephfs_ganesha_server_ip').with_value( + '10.0.0.1') + end + + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge(OSDefaults.get_facts({ :osfamily => "#{os}" })) + end + + it_configures 'cephfs driver' + end + end + +end