Merge "NetApp: use $name for configuration group name"

This commit is contained in:
Jenkins 2015-06-07 14:37:32 +00:00 committed by Gerrit Code Review
commit 4cbfb42ac6
2 changed files with 51 additions and 44 deletions

View File

@ -214,44 +214,44 @@ define cinder::backend::netapp (
if $nfs_mount_options {
cinder_config {
"${volume_backend_name}/nfs_mount_options": value => $nfs_mount_options;
"${name}/nfs_mount_options": value => $nfs_mount_options;
}
} else {
cinder_config {
"${volume_backend_name}/nfs_mount_options": ensure => absent;
"${name}/nfs_mount_options": ensure => absent;
}
}
cinder_config {
"${volume_backend_name}/volume_backend_name": value => $volume_backend_name;
"${volume_backend_name}/volume_driver": value => 'cinder.volume.drivers.netapp.common.NetAppDriver';
"${volume_backend_name}/netapp_login": value => $netapp_login;
"${volume_backend_name}/netapp_password": value => $netapp_password, secret => true;
"${volume_backend_name}/netapp_server_hostname": value => $netapp_server_hostname;
"${volume_backend_name}/netapp_server_port": value => $netapp_server_port;
"${volume_backend_name}/netapp_size_multiplier": value => $netapp_size_multiplier;
"${volume_backend_name}/netapp_storage_family": value => $netapp_storage_family;
"${volume_backend_name}/netapp_storage_protocol": value => $netapp_storage_protocol;
"${volume_backend_name}/netapp_transport_type": value => $netapp_transport_type;
"${volume_backend_name}/netapp_vfiler": value => $netapp_vfiler;
"${volume_backend_name}/netapp_volume_list": value => $netapp_volume_list;
"${volume_backend_name}/netapp_vserver": value => $netapp_vserver;
"${volume_backend_name}/netapp_partner_backend_name": value => $netapp_partner_backend_name;
"${volume_backend_name}/expiry_thres_minutes": value => $expiry_thres_minutes;
"${volume_backend_name}/thres_avl_size_perc_start": value => $thres_avl_size_perc_start;
"${volume_backend_name}/thres_avl_size_perc_stop": value => $thres_avl_size_perc_stop;
"${volume_backend_name}/nfs_shares_config": value => $nfs_shares_config;
"${volume_backend_name}/netapp_copyoffload_tool_path": value => $netapp_copyoffload_tool_path;
"${volume_backend_name}/netapp_controller_ips": value => $netapp_controller_ips;
"${volume_backend_name}/netapp_sa_password": value => $netapp_sa_password, secret => true;
"${volume_backend_name}/netapp_storage_pools": value => $netapp_storage_pools;
"${volume_backend_name}/netapp_eseries_host_type": value => $netapp_eseries_host_type;
"${volume_backend_name}/netapp_webservice_path": value => $netapp_webservice_path;
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => 'cinder.volume.drivers.netapp.common.NetAppDriver';
"${name}/netapp_login": value => $netapp_login;
"${name}/netapp_password": value => $netapp_password, secret => true;
"${name}/netapp_server_hostname": value => $netapp_server_hostname;
"${name}/netapp_server_port": value => $netapp_server_port;
"${name}/netapp_size_multiplier": value => $netapp_size_multiplier;
"${name}/netapp_storage_family": value => $netapp_storage_family;
"${name}/netapp_storage_protocol": value => $netapp_storage_protocol;
"${name}/netapp_transport_type": value => $netapp_transport_type;
"${name}/netapp_vfiler": value => $netapp_vfiler;
"${name}/netapp_volume_list": value => $netapp_volume_list;
"${name}/netapp_vserver": value => $netapp_vserver;
"${name}/netapp_partner_backend_name": value => $netapp_partner_backend_name;
"${name}/expiry_thres_minutes": value => $expiry_thres_minutes;
"${name}/thres_avl_size_perc_start": value => $thres_avl_size_perc_start;
"${name}/thres_avl_size_perc_stop": value => $thres_avl_size_perc_stop;
"${name}/nfs_shares_config": value => $nfs_shares_config;
"${name}/netapp_copyoffload_tool_path": value => $netapp_copyoffload_tool_path;
"${name}/netapp_controller_ips": value => $netapp_controller_ips;
"${name}/netapp_sa_password": value => $netapp_sa_password, secret => true;
"${name}/netapp_storage_pools": value => $netapp_storage_pools;
"${name}/netapp_eseries_host_type": value => $netapp_eseries_host_type;
"${name}/netapp_webservice_path": value => $netapp_webservice_path;
}
if $netapp_storage_family == 'eseries' {
cinder_config {
"${volume_backend_name}/use_multipath_for_image_xfer": value => true;
"${name}/use_multipath_for_image_xfer": value => true;
}
}

View File

@ -2,7 +2,7 @@ require 'spec_helper'
describe 'cinder::backend::netapp' do
let(:title) {'hippo'}
let(:title) {'netapp'}
let :params do
{
@ -44,23 +44,22 @@ describe 'cinder::backend::netapp' do
end
it 'configures netapp volume driver' do
is_expected.to contain_cinder_config("#{params_hash[:volume_backend_name]}/volume_driver").with_value(
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("#{params_hash[:volume_backend_name]}/#{config}").with_value( 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("#{params_hash[:volume_backend_name]}/netapp_password").with_secret( true )
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("#{params_hash[:volume_backend_name]}/netapp_sa_password").with_secret( true )
is_expected.to contain_cinder_config('netapp/netapp_sa_password').with_secret( true )
end
end
context 'with default parameters' do
before do
params = {}
@ -74,28 +73,36 @@ describe 'cinder::backend::netapp' do
end
context 'with netapp_storage_family eseries' do
let (:req_params) { params.merge!({
:netapp_storage_family => 'eseries',
}) }
before do
params.merge!(:netapp_storage_family => 'eseries')
end
it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/use_multipath_for_image_xfer").with_value('true') }
it 'sets use_multipath_for_image_xfer to true' do
should contain_cinder_config('netapp/use_multipath_for_image_xfer').with({
:value => 'true'
})
end
end
context 'with NFS mount options' do
let (:req_params) { params.merge!({
:nfs_mount_options => 'rw,proto=tcp,sec=sys',
}) }
context 'with nfs_mount_options' do
before do
params.merge!(:nfs_mount_options => 'rw,proto=tcp,sec=sys')
end
it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/nfs_mount_options").with_value('rw,proto=tcp,sec=sys') }
it 'sets the nfs mount options' do
should contain_cinder_config('netapp/nfs_mount_options').with({
:value => 'rw,proto=tcp,sec=sys'
})
end
end
context 'netapp backend with additional configuration' do
before do
params.merge!({:extra_options => {'hippo/param1' => { 'value' => 'value1' }}})
params.merge!({:extra_options => {'netapp/param1' => { 'value' => 'value1' }}})
end
it 'configure netapp backend with additional configuration' do
should contain_cinder_config('hippo/param1').with({
should contain_cinder_config('netapp/param1').with({
:value => 'value1'
})
end