Update NetApp configuration parameters

Change-Id: If6498aaafaa5f3979d3162c8fd5b15f42980ce21
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
Sumit Kumar 2016-07-19 16:22:11 -04:00
parent b78e8eb173
commit 81461da6aa
5 changed files with 188 additions and 110 deletions

View File

@ -58,14 +58,6 @@
# storage system.
# Defaults to undef
#
# [*netapp_volume_list*]
# (optional) This parameter is only utilized when the storage protocol is
# configured to use iSCSI or FC. This parameter is used to restrict
# provisioning to the specified controller volumes. Specify the value of
# this parameter to be a comma separated list of NetApp controller volume
# names to be used for provisioning.
# Defaults to undef
#
# [*netapp_vserver*]
# (optional) This option specifies the virtual storage server (Vserver)
# name on the storage cluster on which provisioning of block storage volumes
@ -132,12 +124,15 @@
# (optional) Password for the NetApp E-Series storage array.
# Defaults to undef
#
# [*netapp_storage_pools*]
# (optional) This option is used to restrict provisioning to the specified
# storage pools. Only dynamic disk pools are currently supported. Specify the
# value of this option to be a comma separated list of disk pool names to be
# used for provisioning.
# Defaults to undef
# [*netapp_pool_name_search_pattern*]
# (optional) This option is only utilized when the Cinder driver is
# configured to use iSCSI or Fibre Channel. It is used to restrict
# provisioning to the specified FlexVol volumes. Specify the value of this
# option as a regular expression which will be applied to the names of
# FlexVol volumes from the storage backend which represent pools in Cinder.
# ^ (beginning of string) and $ (end of string) are implicitly wrapped around
# the regular expression specified before filtering.
# Defaults to (.+)
#
# [*netapp_host_type*]
# (optional) This option is used to define how the controllers will work with
@ -172,6 +167,21 @@
# the hosts that are connected to it.
# Defaults to undef
#
# [*netapp_storage_pools*]
# (optional) This option is used to restrict provisioning to the specified
# storage pools. Only dynamic disk pools are currently supported. Specify the
# value of this option to be a comma separated list of disk pool names to be
# used for provisioning.
# Defaults to undef
#
# [*netapp_volume_list*]
# (optional) This parameter is only utilized when the storage protocol is
# configured to use iSCSI or FC. This parameter is used to restrict
# provisioning to the specified controller volumes. Specify the value of
# this parameter to be a comma separated list of NetApp controller volume
# names to be used for provisioning.
# Defaults to undef
#
# === Examples
#
# cinder::backend::netapp { 'myBackend':
@ -195,32 +205,33 @@ define cinder::backend::netapp (
$netapp_login,
$netapp_password,
$netapp_server_hostname,
$volume_backend_name = $name,
$netapp_server_port = '80',
$netapp_size_multiplier = '1.2',
$netapp_storage_family = 'ontap_cluster',
$netapp_storage_protocol = 'nfs',
$netapp_transport_type = 'http',
$netapp_vfiler = undef,
$netapp_volume_list = undef,
$netapp_vserver = undef,
$netapp_partner_backend_name = undef,
$expiry_thres_minutes = '720',
$thres_avl_size_perc_start = '20',
$thres_avl_size_perc_stop = '60',
$nfs_shares = undef,
$nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_mount_options = $::os_service_default,
$netapp_copyoffload_tool_path = undef,
$netapp_controller_ips = undef,
$netapp_sa_password = undef,
$netapp_storage_pools = undef,
$netapp_host_type = $::os_service_default,
$netapp_webservice_path = '/devmgr/v2',
$manage_volume_type = false,
$extra_options = {},
$volume_backend_name = $name,
$netapp_server_port = '80',
$netapp_size_multiplier = '1.2',
$netapp_storage_family = 'ontap_cluster',
$netapp_storage_protocol = 'nfs',
$netapp_transport_type = 'http',
$netapp_vfiler = undef,
$netapp_vserver = undef,
$netapp_partner_backend_name = undef,
$expiry_thres_minutes = '720',
$thres_avl_size_perc_start = '20',
$thres_avl_size_perc_stop = '60',
$nfs_shares = undef,
$nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_mount_options = $::os_service_default,
$netapp_copyoffload_tool_path = undef,
$netapp_controller_ips = undef,
$netapp_sa_password = undef,
$netapp_host_type = $::os_service_default,
$netapp_webservice_path = '/devmgr/v2',
$manage_volume_type = false,
$extra_options = {},
$netapp_pool_name_search_pattern = '(.+)',
# DEPRECATED PARAMETERS
$netapp_eseries_host_type = undef,
$netapp_eseries_host_type = undef,
$netapp_storage_pools = undef,
$netapp_volume_list = undef,
) {
include ::cinder::deps
@ -232,6 +243,19 @@ define cinder::backend::netapp (
$netapp_host_type_real = $netapp_host_type
}
if $netapp_storage_pools or $netapp_volume_list{
if $netapp_storage_pools {
warning('The "netapp_storage_pools" parameter is deprecated. Use "netapp_pool_name_search_pattern" instead.')
}
if $netapp_volume_list {
warning('The "netapp_volume_list" parameter is deprecated. Use "netapp_pool_name_search_pattern" instead.')
}
$list = join(any2array(delete(delete_undef_values([$netapp_storage_pools, $netapp_volume_list]), '')), '|')
$netapp_pool_name_search_pattern_real = "(${list})"
} else {
$netapp_pool_name_search_pattern_real = $netapp_pool_name_search_pattern
}
if $nfs_shares {
validate_array($nfs_shares)
file {$nfs_shares_config:
@ -242,31 +266,30 @@ define cinder::backend::netapp (
}
cinder_config {
"${name}/nfs_mount_options": value => $nfs_mount_options;
"${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_host_type": value => $netapp_host_type_real;
"${name}/netapp_webservice_path": value => $netapp_webservice_path;
"${name}/nfs_mount_options": value => $nfs_mount_options;
"${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_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_pool_name_search_pattern": value => $netapp_pool_name_search_pattern_real;
"${name}/netapp_host_type": value => $netapp_host_type_real;
"${name}/netapp_webservice_path": value => $netapp_webservice_path;
}
if $manage_volume_type {

View File

@ -53,14 +53,6 @@
# storage system.
# Defaults to undef
#
# [*netapp_volume_list*]
# (optional) This parameter is only utilized when the storage protocol is
# configured to use iSCSI or FC. This parameter is used to restrict
# provisioning to the specified controller volumes. Specify the value of
# this parameter to be a comma separated list of NetApp controller volume
# names to be used for provisioning.
# Defaults to undef
#
# [*netapp_vserver*]
# (optional) This option specifies the virtual storage server (Vserver)
# name on the storage cluster on which provisioning of block storage volumes
@ -127,17 +119,20 @@
# (optional) Password for the NetApp E-Series storage array.
# Defaults to undef
#
# [*netapp_storage_pools*]
# (optional) This option is used to restrict provisioning to the specified
# storage pools. Only dynamic disk pools are currently supported. Specify the
# value of this option to be a comma separated list of disk pool names to be
# used for provisioning.
# Defaults to undef
# [*netapp_pool_name_search_pattern*]
# (optional) This option is only utilized when the Cinder driver is
# configured to use iSCSI or Fibre Channel. It is used to restrict
# provisioning to the specified FlexVol volumes. Specify the value of this
# option as a regular expression which will be applied to the names of
# FlexVol volumes from the storage backend which represent pools in Cinder.
# ^ (beginning of string) and $ (end of string) are implicitly wrapped around
# the regular expression specified before filtering.
# Defaults to (.+)
#
# [*netapp_host_type*]
# (optional) This option is used to define how the controllers will work with
# the particular operating system on the hosts that are connected to it.
# Defaults to $::os_service_default
# Defaults to $::os_service_default
#
# [*netapp_webservice_path*]
# (optional) This option is used to specify the path to the E-Series proxy
@ -161,6 +156,21 @@
# the hosts that are connected to it.
# Defaults to undef
#
# [*netapp_storage_pools*]
# (optional) This option is used to restrict provisioning to the specified
# storage pools. Only dynamic disk pools are currently supported. Specify the
# value of this option to be a comma separated list of disk pool names to be
# used for provisioning.
# Defaults to undef
#
# [*netapp_volume_list*]
# (optional) This parameter is only utilized when the storage protocol is
# configured to use iSCSI or FC. This parameter is used to restrict
# provisioning to the specified controller volumes. Specify the value of
# this parameter to be a comma separated list of NetApp controller volume
# names to be used for provisioning.
# Defaults to undef
#
# === Examples
#
# class { 'cinder::volume::netapp':
@ -190,7 +200,6 @@ class cinder::volume::netapp (
$netapp_storage_protocol = 'nfs',
$netapp_transport_type = 'http',
$netapp_vfiler = undef,
$netapp_volume_list = undef,
$netapp_vserver = undef,
$netapp_partner_backend_name = undef,
$expiry_thres_minutes = '720',
@ -201,13 +210,15 @@ class cinder::volume::netapp (
$netapp_copyoffload_tool_path = undef,
$netapp_controller_ips = undef,
$netapp_sa_password = undef,
$netapp_storage_pools = undef,
$netapp_host_type = $::os_service_default,
$netapp_webservice_path = '/devmgr/v2',
$nfs_mount_options = undef,
$extra_options = {},
$netapp_pool_name_search_pattern = '(.+)',
# DEPRECATED PARAMETERS
$netapp_eseries_host_type = undef,
$netapp_storage_pools = undef,
$netapp_volume_list = undef,
) {
include ::cinder::deps
@ -223,30 +234,31 @@ class cinder::volume::netapp (
cinder::backend::netapp instead.')
cinder::backend::netapp { 'DEFAULT':
netapp_login => $netapp_login,
netapp_password => $netapp_password,
netapp_server_hostname => $netapp_server_hostname,
netapp_server_port => $netapp_server_port,
netapp_size_multiplier => $netapp_size_multiplier,
netapp_storage_family => $netapp_storage_family,
netapp_storage_protocol => $netapp_storage_protocol,
netapp_transport_type => $netapp_transport_type,
netapp_vfiler => $netapp_vfiler,
netapp_volume_list => $netapp_volume_list,
netapp_vserver => $netapp_vserver,
netapp_partner_backend_name => $netapp_partner_backend_name,
expiry_thres_minutes => $expiry_thres_minutes,
thres_avl_size_perc_start => $thres_avl_size_perc_start,
thres_avl_size_perc_stop => $thres_avl_size_perc_stop,
nfs_shares => $nfs_shares,
nfs_shares_config => $nfs_shares_config,
netapp_copyoffload_tool_path => $netapp_copyoffload_tool_path,
netapp_controller_ips => $netapp_controller_ips,
netapp_sa_password => $netapp_sa_password,
netapp_storage_pools => $netapp_storage_pools,
netapp_host_type => $netapp_host_type_real,
netapp_webservice_path => $netapp_webservice_path,
nfs_mount_options => $nfs_mount_options,
extra_options => $extra_options,
netapp_login => $netapp_login,
netapp_password => $netapp_password,
netapp_server_hostname => $netapp_server_hostname,
netapp_server_port => $netapp_server_port,
netapp_size_multiplier => $netapp_size_multiplier,
netapp_storage_family => $netapp_storage_family,
netapp_storage_protocol => $netapp_storage_protocol,
netapp_transport_type => $netapp_transport_type,
netapp_vfiler => $netapp_vfiler,
netapp_volume_list => $netapp_volume_list,
netapp_vserver => $netapp_vserver,
netapp_partner_backend_name => $netapp_partner_backend_name,
expiry_thres_minutes => $expiry_thres_minutes,
thres_avl_size_perc_start => $thres_avl_size_perc_start,
thres_avl_size_perc_stop => $thres_avl_size_perc_stop,
nfs_shares => $nfs_shares,
nfs_shares_config => $nfs_shares_config,
netapp_copyoffload_tool_path => $netapp_copyoffload_tool_path,
netapp_controller_ips => $netapp_controller_ips,
netapp_sa_password => $netapp_sa_password,
netapp_storage_pools => $netapp_storage_pools,
netapp_pool_name_search_pattern => $netapp_pool_name_search_pattern,
netapp_host_type => $netapp_host_type_real,
netapp_webservice_path => $netapp_webservice_path,
nfs_mount_options => $nfs_mount_options,
extra_options => $extra_options,
}
}

View File

@ -0,0 +1,6 @@
---
deprecations:
- netapp_storage_pools parameter is deprecated in favor
of netapp_pool_name_search_pattern.
- netapp_volume_list parameter is deprecated in favor
of netapp_pool_name_search_pattern.

View File

@ -12,13 +12,11 @@ describe 'cinder::volume::netapp' do
:netapp_password => 'password',
:netapp_server_hostname => '127.0.0.2',
:netapp_vfiler => 'netapp_vfiler',
:netapp_volume_list => 'vol1,vol2',
: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',
:netapp_storage_pools => 'pool1,pool2',
}
end

View File

@ -15,13 +15,11 @@ describe 'cinder::backend::netapp' do
:netapp_password => 'password',
:netapp_server_hostname => '127.0.0.2',
:netapp_vfiler => 'netapp_vfiler',
:netapp_volume_list => 'vol1,vol2',
: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',
:netapp_storage_pools => 'pool1,pool2',
}
end
@ -143,4 +141,45 @@ describe 'cinder::backend::netapp' do
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