generic: Drop redundant hard-coded defaults
These default values exactly match service defaults. Change-Id: Ic9ff40a5739b5c4c1083f60f119cb6d9fd328ce3
This commit is contained in:
parent
0433ff3886
commit
411adb7093
@ -19,95 +19,93 @@
|
||||
#
|
||||
# [*smb_template_config_path*]
|
||||
# (optional) Path to smb config.
|
||||
# Defaults to: $state_path/smb.conf
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*volume_name_template*]
|
||||
# (optional) Volume name template.
|
||||
# Defaults to: manila-share-%s
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*volume_snapshot_name_template*]
|
||||
# (optional) Volume snapshot name template.
|
||||
# Defaults to: manila-snapshot-%s
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*share_mount_path*]
|
||||
# (optional) Parent path in service instance where shares will be mounted.
|
||||
# Defaults to: /shares
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*max_time_to_create_volume*]
|
||||
# (optional) Maximum time to wait for creating cinder volume.
|
||||
# Defaults to: 180
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*max_time_to_attach*]
|
||||
# (optional) Maximum time to wait for attaching cinder volume.
|
||||
# Defaults to: 120
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*service_instance_smb_config_path*]
|
||||
# (optional) Path to smb config in service instance.
|
||||
# Defaults to: $share_mount_path/smb.conf
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*share_volume_fstype*]
|
||||
# (optional) Filesystem type of the share volume.
|
||||
# Choices: 'ext4', 'ext3'
|
||||
# Defaults to: ext4
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*share_helpers*]
|
||||
# (optional) Specify list of share export helpers.
|
||||
# Defaults to: ['CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess',
|
||||
# 'NFS=manila.share.drivers.helpers.NFSHelper']
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*cinder_volume_type*]
|
||||
# (optional) Name or id of cinder volume type which will be used for all
|
||||
# volumes created by driver.
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*delete_share_server_with_last_share*]
|
||||
# (optional) With this option is set to True share server will be deleted
|
||||
# on deletion of last share.
|
||||
# Defaults to: False
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*unmanage_remove_access_rules*]
|
||||
# (optional) If set to True, then manila will deny access and remove all
|
||||
# access rules on share unmanage. If set to False - nothing will be changed.
|
||||
# Defaults to: False
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*automatic_share_server_cleanup*]
|
||||
# (optional) If set to True, then Manila will delete all share servers which
|
||||
# were unused more than specified time. If set to False, automatic deletion
|
||||
# of share servers will be disabled.
|
||||
# Defaults to: True
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*reserved_share_percentage*]
|
||||
# (optional) The percentage of backend capacity reserved.
|
||||
# Defaults to: $facts['os_service_default']
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*reserved_share_from_snapshot_percentage*]
|
||||
# (optional) The percentage of backend capacity reserved. Used for shares
|
||||
# created from the snapshot.
|
||||
# Defaults to: $facts['os_service_default']
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*reserved_share_extend_percentage*]
|
||||
# (optional) The percentage of backend capacity reserved for share extend
|
||||
# operation.
|
||||
# Defaults to: $facts['os_service_default']
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
define manila::backend::generic (
|
||||
$driver_handles_share_servers,
|
||||
$share_backend_name = $name,
|
||||
$backend_availability_zone = $facts['os_service_default'],
|
||||
$smb_template_config_path = '$state_path/smb.conf',
|
||||
$volume_name_template = 'manila-share-%s',
|
||||
$volume_snapshot_name_template = 'manila-snapshot-%s',
|
||||
$share_mount_path = '/shares',
|
||||
$max_time_to_create_volume = 180,
|
||||
$max_time_to_attach = 120,
|
||||
$service_instance_smb_config_path = '$share_mount_path/smb.conf',
|
||||
$share_volume_fstype = 'ext4',
|
||||
$share_helpers = [
|
||||
'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess',
|
||||
'NFS=manila.share.drivers.helpers.NFSHelper'],
|
||||
$cinder_volume_type = undef,
|
||||
$delete_share_server_with_last_share = 'False',
|
||||
$unmanage_remove_access_rules = 'False',
|
||||
$automatic_share_server_cleanup = 'True',
|
||||
$smb_template_config_path = $facts['os_service_default'],
|
||||
$volume_name_template = $facts['os_service_default'],
|
||||
$volume_snapshot_name_template = $facts['os_service_default'],
|
||||
$share_mount_path = $facts['os_service_default'],
|
||||
$max_time_to_create_volume = $facts['os_service_default'],
|
||||
$max_time_to_attach = $facts['os_service_default'],
|
||||
$service_instance_smb_config_path = $facts['os_service_default'],
|
||||
$share_volume_fstype = $facts['os_service_default'],
|
||||
$share_helpers = $facts['os_service_default'],
|
||||
$cinder_volume_type = $facts['os_service_default'],
|
||||
$delete_share_server_with_last_share = $facts['os_service_default'],
|
||||
$unmanage_remove_access_rules = $facts['os_service_default'],
|
||||
$automatic_share_server_cleanup = $facts['os_service_default'],
|
||||
$reserved_share_percentage = $facts['os_service_default'],
|
||||
$reserved_share_from_snapshot_percentage = $facts['os_service_default'],
|
||||
$reserved_share_extend_percentage = $facts['os_service_default'],
|
||||
@ -130,7 +128,7 @@ define manila::backend::generic (
|
||||
"${name}/max_time_to_attach": value => $max_time_to_attach;
|
||||
"${name}/service_instance_smb_config_path": value => $service_instance_smb_config_path;
|
||||
"${name}/share_volume_fstype": value => $share_volume_fstype;
|
||||
"${name}/share_helpers": value => join($share_helpers, ',');
|
||||
"${name}/share_helpers": value => join(any2array($share_helpers), ',');
|
||||
"${name}/cinder_volume_type": value => $cinder_volume_type;
|
||||
"${name}/delete_share_server_with_last_share": value => $delete_share_server_with_last_share;
|
||||
"${name}/unmanage_remove_access_rules": value => $unmanage_remove_access_rules;
|
||||
|
@ -4,84 +4,83 @@
|
||||
#
|
||||
# ===Parameters
|
||||
# [*driver_handles_share_servers*]
|
||||
# (required) Denotes whether the driver should handle the responsibility of
|
||||
# managing share servers. This must be set to false if the driver is to
|
||||
# operate without managing share servers.
|
||||
# (required) Denotes whether the driver should handle the responsibility of
|
||||
# managing share servers. This must be set to false if the driver is to
|
||||
# operate without managing share servers.
|
||||
#
|
||||
# [*smb_template_config_path*]
|
||||
# (optional) Path to smb config.
|
||||
# Defaults to: $state_path/smb.conf
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*volume_name_template*]
|
||||
# (optional) Volume name template.
|
||||
# Defaults to: manila-share-%s
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*volume_snapshot_name_template*]
|
||||
# (optional) Volume snapshot name template.
|
||||
# Defaults to: manila-snapshot-%s
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*share_mount_path*]
|
||||
# (optional) Parent path in service instance where shares will be mounted.
|
||||
# Defaults to: /shares
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*max_time_to_create_volume*]
|
||||
# (optional) Maximum time to wait for creating cinder volume.
|
||||
# Defaults to: 180
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*max_time_to_attach*]
|
||||
# (optional) Maximum time to wait for attaching cinder volume.
|
||||
# Defaults to: 120
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*service_instance_smb_config_path*]
|
||||
# (optional) Path to smb config in service instance.
|
||||
# Defaults to: $share_mount_path/smb.conf
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*share_volume_fstype*]
|
||||
# (optional) Filesystem type of the share volume.
|
||||
# Choices: 'ext4', 'ext3'
|
||||
# Defaults to: ext4
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*share_helpers*]
|
||||
# (optional) Specify list of share export helpers.
|
||||
# Defaults to: ['CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess',
|
||||
# 'NFS=manila.share.drivers.helpers.NFSHelper']
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*cinder_volume_type*]
|
||||
# (optional) Name or id of cinder volume type which will be used for all
|
||||
# volumes created by driver.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*delete_share_server_with_last_share*]
|
||||
# (optional) With this option is set to True share server will be deleted
|
||||
# on deletion of last share.
|
||||
# Defaults to: False
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*unmanage_remove_access_rules*]
|
||||
# (optional) If set to True, then manila will deny access and remove all
|
||||
# access rules on share unmanage. If set to False - nothing will be changed.
|
||||
# Defaults to: False
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*automatic_share_server_cleanup*]
|
||||
# (optional) If set to True, then Manila will delete all share servers which
|
||||
# were unused more than specified time. If set to False, automatic deletion
|
||||
# of share servers will be disabled.
|
||||
# Defaults to: True
|
||||
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
class manila::share::generic (
|
||||
$driver_handles_share_servers,
|
||||
$smb_template_config_path = '$state_path/smb.conf',
|
||||
$volume_name_template = 'manila-share-%s',
|
||||
$volume_snapshot_name_template = 'manila-snapshot-%s',
|
||||
$share_mount_path = '/shares',
|
||||
$max_time_to_create_volume = 180,
|
||||
$max_time_to_attach = 120,
|
||||
$service_instance_smb_config_path = '$share_mount_path/smb.conf',
|
||||
$share_volume_fstype = 'ext4',
|
||||
$share_helpers = ['CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess',
|
||||
'NFS=manila.share.drivers.helpers.NFSHelper'],
|
||||
$cinder_volume_type = undef,
|
||||
$delete_share_server_with_last_share = 'False',
|
||||
$unmanage_remove_access_rules = 'False',
|
||||
$automatic_share_server_cleanup = 'True',
|
||||
$smb_template_config_path = $facts['os_service_default'],
|
||||
$volume_name_template = $facts['os_service_default'],
|
||||
$volume_snapshot_name_template = $facts['os_service_default'],
|
||||
$share_mount_path = $facts['os_service_default'],
|
||||
$max_time_to_create_volume = $facts['os_service_default'],
|
||||
$max_time_to_attach = $facts['os_service_default'],
|
||||
$service_instance_smb_config_path = $facts['os_service_default'],
|
||||
$share_volume_fstype = $facts['os_service_default'],
|
||||
$share_helpers = $facts['os_service_default'],
|
||||
$cinder_volume_type = $facts['os_service_default'],
|
||||
$delete_share_server_with_last_share = $facts['os_service_default'],
|
||||
$unmanage_remove_access_rules = $facts['os_service_default'],
|
||||
$automatic_share_server_cleanup = $facts['os_service_default'],
|
||||
) {
|
||||
|
||||
manila::backend::generic { 'DEFAULT':
|
||||
|
@ -1,38 +1,75 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'manila::share::generic' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:driver_handles_share_servers => true,
|
||||
:smb_template_config_path => '$state_path/smb.conf',
|
||||
:volume_name_template => 'manila-share-%s',
|
||||
:volume_snapshot_name_template => 'manila-snapshot-%s',
|
||||
:share_mount_path => '/shares',
|
||||
:max_time_to_create_volume => 180,
|
||||
:max_time_to_attach => 120,
|
||||
:service_instance_smb_config_path => '$share_mount_path/smb.conf',
|
||||
:share_volume_fstype => 'ext4',
|
||||
:cinder_volume_type => 'gold',
|
||||
:delete_share_server_with_last_share => 'True',
|
||||
:unmanage_remove_access_rules => 'True',
|
||||
:automatic_share_server_cleanup => 'False',
|
||||
:driver_handles_share_servers => true,
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples_for 'manila::share::generic' do
|
||||
context 'generic share driver' do
|
||||
context 'with default value' do
|
||||
it 'configures generic share driver' do
|
||||
is_expected.to contain_manila_config('DEFAULT/share_driver').with_value(
|
||||
'manila.share.drivers.generic.GenericShareDriver')
|
||||
is_expected.to contain_manila_config('DEFAULT/share_helpers').with_value(
|
||||
'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess,'\
|
||||
'NFS=manila.share.drivers.helpers.NFSHelper')
|
||||
is_expected.to contain_manila_config('DEFAULT/share_helpers').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/smb_template_config_path').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/volume_name_template').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/volume_snapshot_name_template').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/share_mount_path').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/max_time_to_create_volume').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/max_time_to_attach').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/service_instance_smb_config_path').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/share_volume_fstype').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/share_helpers').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/cinder_volume_type').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/delete_share_server_with_last_share').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/unmanage_remove_access_rules').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/automatic_share_server_cleanup').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:smb_template_config_path => '$state_path/smb.conf',
|
||||
:volume_name_template => 'manila-share-%s',
|
||||
:volume_snapshot_name_template => 'manila-snapshot-%s',
|
||||
:share_mount_path => '/shares',
|
||||
:max_time_to_create_volume => 180,
|
||||
:max_time_to_attach => 120,
|
||||
:service_instance_smb_config_path => '$share_mount_path/smb.conf',
|
||||
:share_volume_fstype => 'ext4',
|
||||
:share_helpers => 'NFS=manila.share.drivers.helpers.NFSHelper',
|
||||
:cinder_volume_type => 'gold',
|
||||
:delete_share_server_with_last_share => 'True',
|
||||
:unmanage_remove_access_rules => 'True',
|
||||
:automatic_share_server_cleanup => 'False',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures generic share driver' do
|
||||
params.each_pair do |config,value|
|
||||
is_expected.to contain_manila_config("DEFAULT/#{config}").with_value( value )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with array value' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:share_helpers => [
|
||||
'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess',
|
||||
'NFS=manila.share.drivers.helpers.NFSHelper'
|
||||
]
|
||||
})
|
||||
end
|
||||
it 'configures generic share driver' do
|
||||
is_expected.to contain_manila_config('DEFAULT/share_helpers').with_value(
|
||||
'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess,'\
|
||||
'NFS=manila.share.drivers.helpers.NFSHelper')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
@ -45,5 +82,4 @@ describe 'manila::share::generic' do
|
||||
it_behaves_like 'manila::share::generic'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,39 +6,74 @@ describe 'manila::backend::generic' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:driver_handles_share_servers => true,
|
||||
:smb_template_config_path => '$state_path/smb.conf',
|
||||
:volume_name_template => 'manila-share-%s',
|
||||
:volume_snapshot_name_template => 'manila-snapshot-%s',
|
||||
:share_mount_path => '/shares',
|
||||
:max_time_to_create_volume => 180,
|
||||
:max_time_to_attach => 120,
|
||||
:service_instance_smb_config_path => '$share_mount_path/smb.conf',
|
||||
:share_volume_fstype => 'ext4',
|
||||
:cinder_volume_type => 'gold',
|
||||
:backend_availability_zone => 'my_zone',
|
||||
:reserved_share_percentage => 10.0,
|
||||
:reserved_share_from_snapshot_percentage => 10.1,
|
||||
:reserved_share_extend_percentage => 10.2,
|
||||
:driver_handles_share_servers => true,
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'manila::backend::generic' do
|
||||
|
||||
context 'generic share driver' do
|
||||
shared_examples_for 'manila::backend::generic' do
|
||||
context 'with default value' do
|
||||
it 'configures generic share driver' do
|
||||
is_expected.to contain_manila_config('hippo/share_backend_name').with(
|
||||
:value => 'hippo')
|
||||
is_expected.to contain_manila_config('hippo/share_driver').with_value(
|
||||
'manila.share.drivers.generic.GenericShareDriver')
|
||||
is_expected.to contain_manila_config('hippo/share_helpers').with_value(
|
||||
'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess,'\
|
||||
'NFS=manila.share.drivers.helpers.NFSHelper')
|
||||
is_expected.to contain_manila_config('hippo/share_helpers').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/smb_template_config_path').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/volume_name_template').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/volume_snapshot_name_template').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/share_mount_path').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/max_time_to_create_volume').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/max_time_to_attach').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/service_instance_smb_config_path').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/share_volume_fstype').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/share_helpers').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/cinder_volume_type').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/delete_share_server_with_last_share').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/unmanage_remove_access_rules').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('hippo/automatic_share_server_cleanup').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:driver_handles_share_servers => true,
|
||||
:smb_template_config_path => '$state_path/smb.conf',
|
||||
:volume_name_template => 'manila-share-%s',
|
||||
:volume_snapshot_name_template => 'manila-snapshot-%s',
|
||||
:share_mount_path => '/shares',
|
||||
:max_time_to_create_volume => 180,
|
||||
:max_time_to_attach => 120,
|
||||
:service_instance_smb_config_path => '$share_mount_path/smb.conf',
|
||||
:share_volume_fstype => 'ext4',
|
||||
:share_helpers => 'NFS=manila.share.drivers.helpers.NFSHelper',
|
||||
:cinder_volume_type => 'gold',
|
||||
:delete_share_server_with_last_share => 'True',
|
||||
:unmanage_remove_access_rules => 'True',
|
||||
:automatic_share_server_cleanup => 'False',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures generic share driver' do
|
||||
params.each_pair do |config,value|
|
||||
is_expected.to contain_manila_config("hippo/#{config}").with_value( value )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with array value' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:share_helpers => [
|
||||
'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess',
|
||||
'NFS=manila.share.drivers.helpers.NFSHelper'
|
||||
]
|
||||
})
|
||||
end
|
||||
it 'configures generic share driver' do
|
||||
is_expected.to contain_manila_config('hippo/share_helpers').with_value(
|
||||
'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess,'\
|
||||
'NFS=manila.share.drivers.helpers.NFSHelper')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
Loading…
x
Reference in New Issue
Block a user