Add support for share manger options

This updates the manila::share class so that users can manage options
used by share manager.

Change-Id: I9d386e183bca3ea410d2deb491a85c992d7b5367
This commit is contained in:
Takashi Kajinami 2023-10-06 13:16:27 +09:00
parent 15c9eb40e6
commit f319ebb145
3 changed files with 149 additions and 16 deletions

View File

@ -14,11 +14,78 @@
# (Optional) Whether the service should be managed by Puppet
# Defaults to true.
#
# $share_name_template = share-%s
# [*delete_share_server_with_last_share*]
# (Optional) Wheather share servers will be deleted on deletion of the last
# share.
# Defaults to $facts['os_service_default'].
#
# [*unmanage_remove_access_rules*]
# (Optional) Deny access and remove all access rules on share unmanage.
# Defaults to $facts['os_service_default'].
#
# [*automatic_share_server_cleanup*]
# (Optional) Delete all share servers which were unused more than specified
# time.
# Defaults to $facts['os_service_default'].
#
# [*unused_share_server_cleanup_interval*]
# (Optional) Unallocated share servers reclamation time interval (minutes).
# Defaults to $facts['os_service_default'].
#
# [*replica_state_update_interval*]
# (Optional) Interval to poll for the health of each replica instance.
# Defaults to $facts['os_service_default'].
#
# [*migration_driver_continue_update_interval*]
# (Optional) Interval to poll the driver to perform the next step of
# migration in the storage backend, for a migration share.
# Defaults to $facts['os_service_default'].
#
# [*server_migration_driver_continue_update_interval*]
# (Optional) Interval to poll the driver to perform the next step of
# migration in the storage backend, for a migration share server.
# Defaults to $facts['os_service_default'].
#
# [*share_usage_size_update_interval*]
# (Optional) Interval to poll the driver to update the share usage size in
# the storage backend.
# Defaults to $facts['os_service_default'].
#
# [*enable_gathering_share_usage_size*]
# (Optional) Poll share usage size. Usage data can be consumed by telemetry
# integration.
# Defaults to $facts['os_service_default'].
#
# [*share_service_inithost_offload*]
# (Optional) Offload pending share ensure during share service startup.
# Defaults to $facts['os_service_default'].
#
# [*check_for_expired_shares_in_recycle_bin_interval*]
# (Optional) Interval to check for expired shares and delete them from
# the Recycle bin.
# Defaults to $facts['os_service_default'].
#
# [*check_for_expired_transfers*]
# (Optional) Interval to check for expired transfers and destroy them and
# roll back share state.
# Defaults to $facts['os_service_default'].
#
class manila::share (
$package_ensure = 'present',
Boolean $enabled = true,
Boolean $manage_service = true
$package_ensure = 'present',
Boolean $enabled = true,
Boolean $manage_service = true,
$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'],
$unused_share_server_cleanup_interval = $facts['os_service_default'],
$replica_state_update_interval = $facts['os_service_default'],
$migration_driver_continue_update_interval = $facts['os_service_default'],
$server_migration_driver_continue_update_interval = $facts['os_service_default'],
$share_usage_size_update_interval = $facts['os_service_default'],
$enable_gathering_share_usage_size = $facts['os_service_default'],
$share_service_inithost_offload = $facts['os_service_default'],
$check_for_expired_shares_in_recycle_bin_interval = $facts['os_service_default'],
$check_for_expired_transfers = $facts['os_service_default'],
) {
include manila::deps
@ -32,6 +99,21 @@ class manila::share (
}
}
manila_config {
'DEFAULT/delete_share_server_with_last_share': value => $delete_share_server_with_last_share;
'DEFAULT/unmanage_remove_access_rules': value => $unmanage_remove_access_rules;
'DEFAULT/automatic_share_server_cleanup': value => $automatic_share_server_cleanup;
'DEFAULT/unused_share_server_cleanup_interval': value => $unused_share_server_cleanup_interval;
'DEFAULT/replica_state_update_interval': value => $replica_state_update_interval;
'DEFAULT/migration_driver_continue_update_interval': value => $migration_driver_continue_update_interval;
'DEFAULT/server_migration_driver_continue_update_interval': value => $server_migration_driver_continue_update_interval;
'DEFAULT/share_usage_size_update_interval': value => $share_usage_size_update_interval;
'DEFAULT/enable_gathering_share_usage_size': value => $enable_gathering_share_usage_size;
'DEFAULT/share_service_inithost_offload': value => $share_service_inithost_offload;
'DEFAULT/check_for_expired_shares_in_recycle_bin_interval': value => $check_for_expired_shares_in_recycle_bin_interval;
'DEFAULT/check_for_expired_transfers': value => $check_for_expired_transfers;
}
if $manage_service {
if $enabled {
$ensure = 'running'

View File

@ -0,0 +1,4 @@
---
features:
- |
The ``manila::share`` class now supports share manager options.

View File

@ -3,21 +3,68 @@ require 'spec_helper'
describe 'manila::share' do
shared_examples_for 'manila-share' do
let :pre_condition do
'class { "manila": }'
context 'with default parameters' do
it { is_expected.to contain_package('manila-share').with(
:name => platform_params[:package_name],
:ensure => 'present',
:tag => ['openstack', 'manila-package'],
) }
it { is_expected.to contain_service('manila-share').with(
'hasstatus' => true,
'tag' => 'manila-service',
)}
it 'should configure share options' do
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>')
is_expected.to contain_manila_config('DEFAULT/unused_share_server_cleanup_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/replica_state_update_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/migration_driver_continue_update_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/server_migration_driver_continue_update_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/share_usage_size_update_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/enable_gathering_share_usage_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/share_service_inithost_offload').with_value('<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/check_for_expired_shares_in_recycle_bin_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/check_for_expired_transfers').with_value('<SERVICE DEFAULT>')
end
end
it { is_expected.to contain_package('manila-share').with(
:name => platform_params[:package_name],
:ensure => 'present',
:tag => ['openstack', 'manila-package'],
) }
it { is_expected.to contain_service('manila-share').with(
'hasstatus' => true,
'tag' => 'manila-service',
)}
context 'with parameters' do
let :params do
{
:delete_share_server_with_last_share => false,
:unmanage_remove_access_rules => false,
:automatic_share_server_cleanup => true,
:unused_share_server_cleanup_interval => 10,
:replica_state_update_interval => 300,
:migration_driver_continue_update_interval => 60,
:server_migration_driver_continue_update_interval => 900,
:share_usage_size_update_interval => 300,
:enable_gathering_share_usage_size => false,
:share_service_inithost_offload => false,
:check_for_expired_shares_in_recycle_bin_interval => 3600,
:check_for_expired_transfers => 300,
}
end
describe 'with manage_service false' do
it 'should configure share options' do
is_expected.to contain_manila_config('DEFAULT/delete_share_server_with_last_share').with_value(false)
is_expected.to contain_manila_config('DEFAULT/unmanage_remove_access_rules').with_value(false)
is_expected.to contain_manila_config('DEFAULT/automatic_share_server_cleanup').with_value(true)
is_expected.to contain_manila_config('DEFAULT/unused_share_server_cleanup_interval').with_value(10)
is_expected.to contain_manila_config('DEFAULT/replica_state_update_interval').with_value(300)
is_expected.to contain_manila_config('DEFAULT/migration_driver_continue_update_interval').with_value(60)
is_expected.to contain_manila_config('DEFAULT/server_migration_driver_continue_update_interval').with_value(900)
is_expected.to contain_manila_config('DEFAULT/share_usage_size_update_interval').with_value(300)
is_expected.to contain_manila_config('DEFAULT/enable_gathering_share_usage_size').with_value(false)
is_expected.to contain_manila_config('DEFAULT/share_service_inithost_offload').with_value(false)
is_expected.to contain_manila_config('DEFAULT/check_for_expired_shares_in_recycle_bin_interval').with_value(3600)
is_expected.to contain_manila_config('DEFAULT/check_for_expired_transfers').with_value(300)
end
end
context 'with manage_service false' do
let :params do
{ 'manage_service' => false }
end