
Add ability to set Cinder's nas_secure_file_operations and nas_secure_file_permissions driver parameters. Two sets of identically named parameters are implemented by Cinder's NFS and NetApp back end drivers. The ability to control these parameters is crucial for supporting deployments that require non-default values. Partial-Bug: #1688332 Change-Id: Id92cfd4190de8687d4731cf301f2df0bde1ba7d9
188 lines
5.4 KiB
Ruby
188 lines
5.4 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'cinder::backend::netapp' do
|
|
|
|
let(:title) {'netapp'}
|
|
|
|
let :facts do
|
|
OSDefaults.get_facts({})
|
|
end
|
|
|
|
let :params do
|
|
{
|
|
:volume_backend_name => 'netapp-cdot-nfs',
|
|
:netapp_login => 'netapp',
|
|
:netapp_password => 'password',
|
|
:netapp_server_hostname => '127.0.0.2',
|
|
:netapp_vfiler => 'netapp_vfiler',
|
|
:netapp_vserver => 'netapp_vserver',
|
|
:netapp_partner_backend_name => 'fc2',
|
|
:netapp_copyoffload_tool_path => '/tmp/na_copyoffload_64',
|
|
:netapp_controller_ips => '10.0.0.2,10.0.0.3',
|
|
:netapp_sa_password => 'password',
|
|
}
|
|
end
|
|
|
|
let :default_params do
|
|
{
|
|
:netapp_server_port => '80',
|
|
:netapp_size_multiplier => '1.2',
|
|
:netapp_storage_family => 'ontap_cluster',
|
|
:netapp_storage_protocol => 'nfs',
|
|
:netapp_transport_type => 'http',
|
|
:expiry_thres_minutes => '720',
|
|
:thres_avl_size_perc_start => '20',
|
|
:thres_avl_size_perc_stop => '60',
|
|
:nfs_shares_config => '/etc/cinder/shares.conf',
|
|
:nfs_mount_options => '<SERVICE DEFAULT>',
|
|
:netapp_webservice_path => '/devmgr/v2',
|
|
:nas_secure_file_operations => '<SERVICE DEFAULT>',
|
|
:nas_secure_file_permissions => '<SERVICE DEFAULT>',
|
|
}
|
|
end
|
|
|
|
shared_examples_for 'netapp volume driver' do
|
|
let :params_hash do
|
|
default_params.merge(params)
|
|
end
|
|
|
|
it 'configures netapp volume driver' do
|
|
is_expected.to contain_cinder_config('netapp/volume_driver').with_value(
|
|
'cinder.volume.drivers.netapp.common.NetAppDriver')
|
|
params_hash.each_pair do |config,value|
|
|
is_expected.to contain_cinder_config("netapp/#{config}").with_value( value )
|
|
end
|
|
end
|
|
|
|
it 'marks netapp_password as secret' do
|
|
is_expected.to contain_cinder_config('netapp/netapp_password').with_secret( true )
|
|
end
|
|
|
|
it 'marks netapp_sa_password as secret' do
|
|
is_expected.to contain_cinder_config('netapp/netapp_sa_password').with_secret( true )
|
|
end
|
|
end
|
|
|
|
context 'with default parameters' do
|
|
before do
|
|
params = {}
|
|
end
|
|
|
|
it_configures 'netapp volume driver'
|
|
end
|
|
|
|
context 'with provided parameters' do
|
|
it_configures 'netapp volume driver'
|
|
end
|
|
|
|
context 'with netapp_storage_family eseries' do
|
|
before do
|
|
params.merge!(:netapp_storage_family => 'eseries')
|
|
end
|
|
|
|
it 'sets use_multipath_for_image_xfer to true' do
|
|
is_expected.to contain_cinder_config('netapp/use_multipath_for_image_xfer').with({
|
|
:value => 'true'
|
|
})
|
|
end
|
|
end
|
|
|
|
context 'with nfs_mount_options' do
|
|
before do
|
|
params.merge!(:nfs_mount_options => 'rw,proto=tcp,sec=sys')
|
|
end
|
|
|
|
it 'sets the nfs mount options' do
|
|
is_expected.to contain_cinder_config('netapp/nfs_mount_options').with({
|
|
:value => 'rw,proto=tcp,sec=sys'
|
|
})
|
|
end
|
|
end
|
|
|
|
context 'netapp backend with cinder type' do
|
|
before do
|
|
params.merge!({:manage_volume_type => true})
|
|
end
|
|
it 'should create type with properties' do
|
|
should contain_cinder_type('netapp').with(:ensure => :present, :properties => ['volume_backend_name=netapp'])
|
|
end
|
|
end
|
|
|
|
context 'netapp backend with additional configuration' do
|
|
before do
|
|
params.merge!({:extra_options => {'netapp/param1' => { 'value' => 'value1' }}})
|
|
end
|
|
|
|
it 'configure netapp backend with additional configuration' do
|
|
is_expected.to contain_cinder_config('netapp/param1').with({
|
|
:value => 'value1'
|
|
})
|
|
end
|
|
end
|
|
|
|
context 'with NFS shares provided' do
|
|
let (:req_params) { params.merge!({
|
|
:nfs_shares => ['10.0.0.1:/test1', '10.0.0.2:/test2'],
|
|
:nfs_shares_config => '/etc/cinder/shares.conf',
|
|
}) }
|
|
|
|
it 'writes NFS shares to file' do
|
|
is_expected.to contain_file("#{req_params[:nfs_shares_config]}") \
|
|
.with_content("10.0.0.1:/test1\n10.0.0.2:/test2")
|
|
end
|
|
end
|
|
|
|
context 'with invalid NFS shares provided' do
|
|
before do
|
|
params.merge!({
|
|
:nfs_shares => "not an array",
|
|
:nfs_shares_config => '/etc/cinder/shares.conf',
|
|
})
|
|
end
|
|
|
|
it_raises 'a Puppet::Error', /"not an array" is not an Array. It looks to be a String/
|
|
end
|
|
|
|
context 'with storage pools' do
|
|
before do
|
|
params.merge!({ :netapp_storage_pools => 'foo' })
|
|
end
|
|
|
|
it 'configures name seach pattern' do
|
|
is_expected.to contain_cinder_config('netapp/netapp_pool_name_search_pattern').with_value('(foo)')
|
|
end
|
|
end
|
|
|
|
context 'with volume list' do
|
|
before do
|
|
params.merge!({ :netapp_volume_list=> 'bar' })
|
|
end
|
|
|
|
it 'configures name seach pattern' do
|
|
is_expected.to contain_cinder_config('netapp/netapp_pool_name_search_pattern').with_value('(bar)')
|
|
end
|
|
end
|
|
|
|
context 'with storage pools and volume list' do
|
|
before do
|
|
params.merge!({
|
|
:netapp_storage_pools => 'foo',
|
|
:netapp_volume_list=> 'bar' })
|
|
end
|
|
|
|
it 'configures name seach pattern' do
|
|
is_expected.to contain_cinder_config('netapp/netapp_pool_name_search_pattern').with_value('(foo|bar)')
|
|
end
|
|
end
|
|
|
|
context 'with name search pattern' do
|
|
before do
|
|
params.merge!({ :netapp_pool_name_search_pattern => '(something)' })
|
|
end
|
|
|
|
it 'configures name seach pattern' do
|
|
is_expected.to contain_cinder_config('netapp/netapp_pool_name_search_pattern').with_value('(something)')
|
|
end
|
|
end
|
|
end
|