3 describe 'cinder::backend::netapp' do
9 :volume_backend_name => 'netapp-cdot-nfs',
10 :netapp_login => 'netapp',
11 :netapp_password => 'password',
12 :netapp_server_hostname => '127.0.0.2',
16 let :default_params do
18 :netapp_server_port => '80',
19 :netapp_size_multiplier => '1.2',
20 :netapp_storage_family => 'ontap_cluster',
21 :netapp_storage_protocol => 'nfs',
22 :netapp_transport_type => 'http',
24 :netapp_volume_list => '',
25 :netapp_vserver => '',
26 :expiry_thres_minutes => '720',
27 :thres_avl_size_perc_start => '20',
28 :thres_avl_size_perc_stop => '60',
29 :nfs_shares_config => '/etc/cinder/shares.conf',
30 :netapp_copyoffload_tool_path => '',
31 :netapp_controller_ips => '',
32 :netapp_sa_password => '',
33 :netapp_storage_pools => '',
34 :nfs_mount_options => nil,
35 :netapp_webservice_path => '/devmgr/v2',
39 shared_examples_for 'netapp volume driver' do
41 default_params.merge(params)
44 it 'configures netapp volume driver' do
45 should contain_cinder_config("#{params_hash[:volume_backend_name]}/volume_driver").with_value(
46 'cinder.volume.drivers.netapp.common.NetAppDriver')
47 params_hash.each_pair do |config,value|
48 should contain_cinder_config("#{params_hash[:volume_backend_name]}/#{config}").with_value( value )
52 it 'marks netapp_password as secret' do
53 should contain_cinder_config("#{params_hash[:volume_backend_name]}/netapp_password").with_secret( true )
56 it 'marks netapp_sa_password as secret' do
57 should contain_cinder_config("#{params_hash[:volume_backend_name]}/netapp_sa_password").with_secret( true )
62 context 'with default parameters' do
67 it_configures 'netapp volume driver'
70 context 'with provided parameters' do
71 it_configures 'netapp volume driver'
74 context 'with netapp_storage_family eseries' do
75 let (:req_params) { params.merge!({
76 :netapp_storage_family => 'eseries',
79 it { should contain_cinder_config("#{req_params[:volume_backend_name]}/use_multipath_for_image_xfer").with_value('true') }
82 context 'with NFS mount options' do
83 let (:req_params) { params.merge!({
84 :nfs_mount_options => 'rw,proto=tcp,sec=sys',
87 it { should contain_cinder_config("#{req_params[:volume_backend_name]}/nfs_mount_options").with_value('rw,proto=tcp,sec=sys') }
90 context 'with NFS shares provided' do
91 let (:req_params) { params.merge!({
92 :nfs_shares => ['10.0.0.1:/test1', '10.0.0.2:/test2'],
93 :nfs_shares_config => '/etc/cinder/shares.conf',
96 it 'writes NFS shares to file' do
97 should contain_file("#{req_params[:nfs_shares_config]}") \
98 .with_content("10.0.0.1:/test1\n10.0.0.2:/test2")
102 context 'with invalid NFS shares provided' do
105 :nfs_shares => "not an array",
106 :nfs_shares_config => '/etc/cinder/shares.conf',
111 expect {subject}.to raise_error(Puppet::Error, /"not an array" is not an Array. It looks to be a String/)