Add nfs_mount_options variable when backend is NetApp

Bring the NetApp backend's options on par with the NFS backend mount options.

Change-Id: I619305890327ed09b0951582f34fe5eab7f8c427
Closes-Bug: #1445090
This commit is contained in:
AlexandreNo 2015-04-16 18:36:15 +02:00
parent cc7279832b
commit fae6f15f86
4 changed files with 33 additions and 0 deletions

View File

@ -105,6 +105,11 @@
# (optional) File with the list of available NFS shares # (optional) File with the list of available NFS shares
# Defaults to '/etc/cinder/shares.conf' # Defaults to '/etc/cinder/shares.conf'
# #
# [*nfs_mount_options*]
# (optional) Mount options passed to the nfs client. See section
# of the nfs man page for details.
# Defaults to undef
#
# [*netapp_copyoffload_tool_path*] # [*netapp_copyoffload_tool_path*]
# (optional) This option specifies the path of the NetApp Copy Offload tool # (optional) This option specifies the path of the NetApp Copy Offload tool
# binary. Ensure that the binary has execute permissions set which allow the # binary. Ensure that the binary has execute permissions set which allow the
@ -188,6 +193,7 @@ define cinder::backend::netapp (
$thres_avl_size_perc_stop = '60', $thres_avl_size_perc_stop = '60',
$nfs_shares = undef, $nfs_shares = undef,
$nfs_shares_config = '/etc/cinder/shares.conf', $nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_mount_options = undef,
$netapp_copyoffload_tool_path = undef, $netapp_copyoffload_tool_path = undef,
$netapp_controller_ips = undef, $netapp_controller_ips = undef,
$netapp_sa_password = undef, $netapp_sa_password = undef,
@ -206,6 +212,16 @@ define cinder::backend::netapp (
} }
} }
if $nfs_mount_options {
cinder_config {
"${volume_backend_name}/nfs_mount_options": value => $nfs_mount_options;
}
} else {
cinder_config {
"${volume_backend_name}/nfs_mount_options": ensure => absent;
}
}
cinder_config { cinder_config {
"${volume_backend_name}/volume_backend_name": value => $volume_backend_name; "${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}/volume_driver": value => 'cinder.volume.drivers.netapp.common.NetAppDriver';

View File

@ -104,6 +104,11 @@
# (optional) File with the list of available NFS shares # (optional) File with the list of available NFS shares
# Defaults to '/etc/cinder/shares.conf' # Defaults to '/etc/cinder/shares.conf'
# #
# [*nfs_mount_options*]
# (optional) Mount options passed to the nfs client. See section
# of the nfs man page for details.
# Defaults to undef
#
# [*netapp_copyoffload_tool_path*] # [*netapp_copyoffload_tool_path*]
# (optional) This option specifies the path of the NetApp Copy Offload tool # (optional) This option specifies the path of the NetApp Copy Offload tool
# binary. Ensure that the binary has execute permissions set which allow the # binary. Ensure that the binary has execute permissions set which allow the
@ -192,6 +197,7 @@ class cinder::volume::netapp (
$netapp_storage_pools = undef, $netapp_storage_pools = undef,
$netapp_eseries_host_type = 'linux_dm_mp', $netapp_eseries_host_type = 'linux_dm_mp',
$netapp_webservice_path = '/devmgr/v2', $netapp_webservice_path = '/devmgr/v2',
$nfs_mount_options = undef,
$extra_options = {}, $extra_options = {},
) { ) {
@ -219,6 +225,7 @@ class cinder::volume::netapp (
netapp_storage_pools => $netapp_storage_pools, netapp_storage_pools => $netapp_storage_pools,
netapp_eseries_host_type => $netapp_eseries_host_type, netapp_eseries_host_type => $netapp_eseries_host_type,
netapp_webservice_path => $netapp_webservice_path, netapp_webservice_path => $netapp_webservice_path,
nfs_mount_options => $nfs_mount_options,
extra_options => $extra_options, extra_options => $extra_options,
} }
} }

View File

@ -30,6 +30,7 @@ describe 'cinder::volume::netapp' do
:thres_avl_size_perc_stop => '60', :thres_avl_size_perc_stop => '60',
:nfs_shares_config => '/etc/cinder/shares.conf', :nfs_shares_config => '/etc/cinder/shares.conf',
:netapp_eseries_host_type => 'linux_dm_mp', :netapp_eseries_host_type => 'linux_dm_mp',
:nfs_mount_options => nil,
:netapp_webservice_path => '/devmgr/v2', :netapp_webservice_path => '/devmgr/v2',
} }
end end

View File

@ -33,6 +33,7 @@ describe 'cinder::backend::netapp' do
:thres_avl_size_perc_stop => '60', :thres_avl_size_perc_stop => '60',
:nfs_shares_config => '/etc/cinder/shares.conf', :nfs_shares_config => '/etc/cinder/shares.conf',
:netapp_eseries_host_type => 'linux_dm_mp', :netapp_eseries_host_type => 'linux_dm_mp',
:nfs_mount_options => nil,
:netapp_webservice_path => '/devmgr/v2', :netapp_webservice_path => '/devmgr/v2',
} }
end end
@ -80,6 +81,14 @@ describe 'cinder::backend::netapp' do
it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/use_multipath_for_image_xfer").with_value('true') } it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/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',
}) }
it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/nfs_mount_options").with_value('rw,proto=tcp,sec=sys') }
end
context 'netapp backend with additional configuration' do context 'netapp backend with additional configuration' do
before do before do
params.merge!({:extra_options => {'hippo/param1' => { 'value' => 'value1' }}}) params.merge!({:extra_options => {'hippo/param1' => { 'value' => 'value1' }}})