NetApp: Avoid hard-coding defaults

This change replaces hard-coded defaults by $::os_service_default, so
that the service default values are used. This allows us to avoid
maintaining our own defaults and saves us from updating these values
according to any change in cinder itself.

Also, setting value => undef leaves the parameters unmanaged. This can
leave old parameter definitions if the parameters are removed from
manifest/hieradata. This change replaces undef by $::os_service_default
to ensure the parameters are cleared by default.

Change-Id: I89311e8c6cad89090c1b6612af425cb229cb71c7
This commit is contained in:
Takashi Kajinami 2022-03-22 12:00:25 +09:00
parent 6f10863bc4
commit accab30c06
2 changed files with 45 additions and 43 deletions

View File

@ -5,16 +5,6 @@
# #
# === Parameters # === Parameters
# #
# [*volume_backend_name*]
# (optional) The name of the cinder::backend::netapp ressource
# Defaults to $name.
#
# [*backend_availability_zone*]
# (Optional) Availability zone for this volume backend.
# If not set, the storage_availability_zone option value
# is used as the default for all backends.
# Defaults to $::os_service_default.
#
# [*netapp_login*] # [*netapp_login*]
# (required) Administrative user account name used to access the storage # (required) Administrative user account name used to access the storage
# system or proxy server. # system or proxy server.
@ -27,22 +17,32 @@
# (required) The hostname (or IP address) for the storage system or proxy # (required) The hostname (or IP address) for the storage system or proxy
# server. # server.
# #
# [*volume_backend_name*]
# (optional) The name of the cinder::backend::netapp ressource
# Defaults to $name.
#
# [*backend_availability_zone*]
# (Optional) Availability zone for this volume backend.
# If not set, the storage_availability_zone option value
# is used as the default for all backends.
# Defaults to $::os_service_default.
#
# [*netapp_server_port*] # [*netapp_server_port*]
# (optional) The TCP port to use for communication with the storage # (optional) The TCP port to use for communication with the storage
# system or proxy. If not specified, Data ONTAP drivers will use 80 # system or proxy. If not specified, Data ONTAP drivers will use 80
# for HTTP and 443 for HTTPS; # for HTTP and 443 for HTTPS;
# Defaults to 80 # Defaults to $::os_service_default.
# #
# [*netapp_size_multiplier*] # [*netapp_size_multiplier*]
# (optional) The quantity to be multiplied by the requested volume size to # (optional) The quantity to be multiplied by the requested volume size to
# ensure enough space is available on the virtual storage server (Vserver) to # ensure enough space is available on the virtual storage server (Vserver) to
# fulfill the volume creation request. # fulfill the volume creation request.
# Defaults to 1.2 # Defaults to $::os_service_default.
# #
# [*netapp_storage_family*] # [*netapp_storage_family*]
# (optional) The storage family type used on the storage system; valid value # (optional) The storage family type used on the storage system; valid value
# is ontap_cluster for using clustered Data ONTAP. # is ontap_cluster for using clustered Data ONTAP.
# Defaults to ontap_cluster # Defaults to $::os_service_default.
# #
# [*netapp_storage_protocol*] # [*netapp_storage_protocol*]
# (optional) The storage protocol to be used on the data path with the storage # (optional) The storage protocol to be used on the data path with the storage
@ -52,13 +52,13 @@
# [*netapp_transport_type*] # [*netapp_transport_type*]
# (optional) The transport protocol used when communicating with the storage # (optional) The transport protocol used when communicating with the storage
# system or proxy server. Valid values are http or https. # system or proxy server. Valid values are http or https.
# Defaults to http # Defaults to $::os_service_default.
# #
# [*netapp_vserver*] # [*netapp_vserver*]
# (optional) This option specifies the virtual storage server (Vserver) # (optional) This option specifies the virtual storage server (Vserver)
# name on the storage cluster on which provisioning of block storage volumes # name on the storage cluster on which provisioning of block storage volumes
# should occur. # should occur.
# Defaults to undef # Defaults to $::os_service_default.
# #
# [*expiry_thres_minutes*] # [*expiry_thres_minutes*]
# (optional) This parameter specifies the threshold for last access time for # (optional) This parameter specifies the threshold for last access time for
@ -66,20 +66,20 @@
# in the cache that have not been accessed in the last M minutes, where M is # in the cache that have not been accessed in the last M minutes, where M is
# the value of this parameter, will be deleted from the cache to create free # the value of this parameter, will be deleted from the cache to create free
# space on the NFS share. # space on the NFS share.
# Defaults to 720 # Defaults to $::os_service_default.
# #
# [*thres_avl_size_perc_start*] # [*thres_avl_size_perc_start*]
# (optional) If the percentage of available space for an NFS share has # (optional) If the percentage of available space for an NFS share has
# dropped below the value specified by this parameter, the NFS image cache # dropped below the value specified by this parameter, the NFS image cache
# will be cleaned. # will be cleaned.
# Defaults to 20 # Defaults to $::os_service_default.
# #
# [*thres_avl_size_perc_stop*] # [*thres_avl_size_perc_stop*]
# (optional) When the percentage of available space on an NFS share has # (optional) When the percentage of available space on an NFS share has
# reached the percentage specified by this parameter, the driver will stop # reached the percentage specified by this parameter, the driver will stop
# clearing files from the NFS image cache that have not been accessed in the # clearing files from the NFS image cache that have not been accessed in the
# last M minutes, where M is the value of the expiry_thres_minutes parameter. # last M minutes, where M is the value of the expiry_thres_minutes parameter.
# Defaults to 60 # Defaults to $::os_service_default.
# #
# [*nfs_shares*] # [*nfs_shares*]
# (optional) Array of NFS exports in the form of host:/share; will be written into # (optional) Array of NFS exports in the form of host:/share; will be written into
@ -99,7 +99,7 @@
# (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
# effective user of the cinder-volume process to execute the file. # effective user of the cinder-volume process to execute the file.
# Defaults to undef # Defaults to $::os_service_default.
# #
# [*netapp_pool_name_search_pattern*] # [*netapp_pool_name_search_pattern*]
# (optional) This option is only utilized when the Cinder driver is # (optional) This option is only utilized when the Cinder driver is
@ -109,7 +109,7 @@
# FlexVol volumes from the storage backend which represent pools in Cinder. # FlexVol volumes from the storage backend which represent pools in Cinder.
# ^ (beginning of string) and $ (end of string) are implicitly wrapped around # ^ (beginning of string) and $ (end of string) are implicitly wrapped around
# the regular expression specified before filtering. # the regular expression specified before filtering.
# Defaults to (.+) # Defaults to $::os_service_default.
# #
# [*netapp_host_type*] # [*netapp_host_type*]
# (optional) This option is used to define how the controllers will work with # (optional) This option is used to define how the controllers will work with
@ -207,23 +207,23 @@ define cinder::backend::netapp (
$netapp_server_hostname, $netapp_server_hostname,
$volume_backend_name = $name, $volume_backend_name = $name,
$backend_availability_zone = $::os_service_default, $backend_availability_zone = $::os_service_default,
$netapp_server_port = '80', $netapp_server_port = $::os_service_default,
$netapp_size_multiplier = '1.2', $netapp_size_multiplier = $::os_service_default,
$netapp_storage_family = 'ontap_cluster', $netapp_storage_family = $::os_service_default,
$netapp_storage_protocol = 'nfs', $netapp_storage_protocol = 'nfs',
$netapp_transport_type = 'http', $netapp_transport_type = $::os_service_default,
$netapp_vserver = undef, $netapp_vserver = $::os_service_default,
$expiry_thres_minutes = '720', $expiry_thres_minutes = $::os_service_default,
$thres_avl_size_perc_start = '20', $thres_avl_size_perc_start = $::os_service_default,
$thres_avl_size_perc_stop = '60', $thres_avl_size_perc_stop = $::os_service_default,
$nfs_shares = undef, $nfs_shares = undef,
$nfs_shares_config = '/etc/cinder/shares.conf', $nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_mount_options = $::os_service_default, $nfs_mount_options = $::os_service_default,
$netapp_copyoffload_tool_path = undef, $netapp_copyoffload_tool_path = $::os_service_default,
$netapp_host_type = $::os_service_default, $netapp_host_type = $::os_service_default,
$manage_volume_type = false, $manage_volume_type = false,
$extra_options = {}, $extra_options = {},
$netapp_pool_name_search_pattern = '(.+)', $netapp_pool_name_search_pattern = $::os_service_default,
$nas_secure_file_operations = $::os_service_default, $nas_secure_file_operations = $::os_service_default,
$nas_secure_file_permissions = $::os_service_default, $nas_secure_file_permissions = $::os_service_default,
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS

View File

@ -17,19 +17,21 @@ describe 'cinder::backend::netapp' do
let :default_params do let :default_params do
{ {
:backend_availability_zone => '<SERVICE DEFAULT>', :backend_availability_zone => '<SERVICE DEFAULT>',
:netapp_server_port => '80', :netapp_server_port => '<SERVICE DEFAULT>',
:netapp_size_multiplier => '1.2', :netapp_size_multiplier => '<SERVICE DEFAULT>',
:netapp_storage_family => 'ontap_cluster', :netapp_storage_family => '<SERVICE DEFAULT>',
:netapp_storage_protocol => 'nfs', :netapp_storage_protocol => 'nfs',
:netapp_transport_type => 'http', :netapp_transport_type => '<SERVICE DEFAULT>',
:expiry_thres_minutes => '720', :netapp_vserver => '<SERVICE DEFAULT>',
:thres_avl_size_perc_start => '20', :expiry_thres_minutes => '<SERVICE DEFAULT>',
:thres_avl_size_perc_stop => '60', :thres_avl_size_perc_start => '<SERVICE DEFAULT>',
:nfs_shares_config => '/etc/cinder/shares.conf', :thres_avl_size_perc_stop => '<SERVICE DEFAULT>',
:nfs_mount_options => '<SERVICE DEFAULT>', :nfs_shares_config => '/etc/cinder/shares.conf',
:nas_secure_file_operations => '<SERVICE DEFAULT>', :netapp_copyoffload_tool_path => '<SERVICE DEFAULT>',
:nas_secure_file_permissions => '<SERVICE DEFAULT>', :nfs_mount_options => '<SERVICE DEFAULT>',
:nas_secure_file_operations => '<SERVICE DEFAULT>',
:nas_secure_file_permissions => '<SERVICE DEFAULT>',
} }
end end