Support customizing fallocate options

This change introduces the new parameters for the following options so
that users can customize fallocate calls in storage server processes.

 - [DEFAULT] disable_fallocate
 - [DEFAULT] fallocate_reserve
 - [app:<type>-server] fallocate_reserve

Change-Id: I37164a2fda28e63604545db46fc925ecf04f9204
This commit is contained in:
Takashi Kajinami 2022-12-08 15:01:37 +09:00
parent c17989e647
commit 7a05cf5840
3 changed files with 56 additions and 18 deletions

View File

@ -56,6 +56,20 @@
# writing to the root device.
# Defaults to true.
#
# [*disable_fallocate*]
# (optional) Disable pre-allocating the required disk space.
# Defaults to $::os_service_default.
#
# [*fallocate_reserve*]
# (optional) The number of bytes or percentage of disk space kept free at
# all times.
# Defaults to $::os_service_default.
#
# [*server_fallocate_reserve*]
# (optional) The number of bytes or percentage of disk space kept free at
# all times. This option affects only <type>-server processes.
# Defaults to $::os_service_default.
#
# [*servers_per_port*]
# (optional) Spawn multiple servers per device on different ports.
# Make object-server run this many worker processes per unique port of
@ -213,6 +227,9 @@ define swift::storage::server(
$max_connections = 25,
$pipeline = ["${type}-server"],
$mount_check = true,
$disable_fallocate = $::os_service_default,
$fallocate_reserve = $::os_service_default,
$server_fallocate_reserve = $::os_service_default,
$servers_per_port = $::os_service_default,
$user = undef,
$workers = $::os_workers,
@ -336,28 +353,31 @@ define swift::storage::server(
# common settings
$common_opts = {
'DEFAULT/devices' => {'value' => $devices},
'DEFAULT/bind_ip' => {'value' => $storage_local_net_ip},
'DEFAULT/bind_port' => {'value' => $bind_port},
'DEFAULT/mount_check' => {'value' => $mount_check},
'DEFAULT/user' => {'value' => $user_real},
'DEFAULT/workers' => {'value' => $workers},
'DEFAULT/log_name' => {'value' => $log_name},
'DEFAULT/log_facility' => {'value' => $log_facility},
'DEFAULT/log_level' => {'value' => $log_level},
'DEFAULT/log_address' => {'value' => $log_address},
'DEFAULT/devices' => {'value' => $devices},
'DEFAULT/bind_ip' => {'value' => $storage_local_net_ip},
'DEFAULT/bind_port' => {'value' => $bind_port},
'DEFAULT/mount_check' => {'value' => $mount_check},
'DEFAULT/disable_fallocate' => {'value' => $disable_fallocate},
'DEFAULT/fallocate_reserve' => {'value' => $fallocate_reserve},
'DEFAULT/user' => {'value' => $user_real},
'DEFAULT/workers' => {'value' => $workers},
'DEFAULT/log_name' => {'value' => $log_name},
'DEFAULT/log_facility' => {'value' => $log_facility},
'DEFAULT/log_level' => {'value' => $log_level},
'DEFAULT/log_address' => {'value' => $log_address},
# pipeline
'pipeline:main/pipeline' => {'value' => join($pipeline, ' ')},
'pipeline:main/pipeline' => {'value' => join($pipeline, ' ')},
# server
"app:${type}-server/use" => {'value' => "egg:swift#${type}"},
"app:${type}-server/set log_name" => {'value' => $log_name},
"app:${type}-server/set log_facility" => {'value' => $log_facility},
"app:${type}-server/set log_level" => {'value' => $log_level},
"app:${type}-server/set log_requests" => {'value' => $log_requests},
"app:${type}-server/set log_address" => {'value' => $log_address},
"app:${type}-server/use" => {'value' => "egg:swift#${type}"},
"app:${type}-server/set log_name" => {'value' => $log_name},
"app:${type}-server/set log_facility" => {'value' => $log_facility},
"app:${type}-server/set log_level" => {'value' => $log_level},
"app:${type}-server/set log_requests" => {'value' => $log_requests},
"app:${type}-server/set log_address" => {'value' => $log_address},
"app:${type}-server/fallocate_reserve" => {'value' => $server_fallocate_reserve},
# auditor
# replicator
"${type}-replicator/rsync_module" => {'value' => $rsync_module},
"${type}-replicator/rsync_module" => {'value' => $rsync_module},
}
file_line { "${type}-auditor":

View File

@ -0,0 +1,9 @@
---
features:
- |
The following new parameters have been added to
the ``swift::storage::server`` defined resource type.
- ``disable_fallocate``
- ``fallocate_reserve``
- ``server_fallocate_reserve``

View File

@ -74,6 +74,8 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_account_config('DEFAULT/bind_ip').with_value('10.0.0.1')
is_expected.to contain_swift_account_config('DEFAULT/bind_port').with_value('6002')
is_expected.to contain_swift_account_config('DEFAULT/mount_check').with_value(true)
is_expected.to contain_swift_account_config('DEFAULT/disable_fallocate').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('DEFAULT/fallocate_reserve').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('DEFAULT/user').with_value('swift')
is_expected.to contain_swift_account_config('DEFAULT/workers').with_value(4)
is_expected.to contain_swift_account_config('DEFAULT/log_name').with_value('account-server')
@ -87,6 +89,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_account_config('app:account-server/set log_level').with_value('INFO')
is_expected.to contain_swift_account_config('app:account-server/set log_requests').with_value(true)
is_expected.to contain_swift_account_config('app:account-server/set log_address').with_value('/dev/log')
is_expected.to contain_swift_account_config('app:account-server/fallocate_reserve').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('DEFAULT/log_statsd_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('DEFAULT/log_statsd_port').with_value('<SERVICE DEFAULT>')
@ -191,6 +194,8 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_container_config('DEFAULT/bind_ip').with_value('10.0.0.1')
is_expected.to contain_swift_container_config('DEFAULT/bind_port').with_value('6001')
is_expected.to contain_swift_container_config('DEFAULT/mount_check').with_value(true)
is_expected.to contain_swift_container_config('DEFAULT/disable_fallocate').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/fallocate_reserve').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/user').with_value('swift')
is_expected.to contain_swift_container_config('DEFAULT/workers').with_value(4)
is_expected.to contain_swift_container_config('DEFAULT/log_name').with_value('container-server')
@ -204,6 +209,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_container_config('app:container-server/set log_level').with_value('INFO')
is_expected.to contain_swift_container_config('app:container-server/set log_requests').with_value(true)
is_expected.to contain_swift_container_config('app:container-server/set log_address').with_value('/dev/log')
is_expected.to contain_swift_container_config('app:container-server/fallocate_reserve').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/log_statsd_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/log_statsd_port').with_value('<SERVICE DEFAULT>')
@ -312,6 +318,8 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_object_config('DEFAULT/bind_ip').with_value('10.0.0.1')
is_expected.to contain_swift_object_config('DEFAULT/bind_port').with_value('6000')
is_expected.to contain_swift_object_config('DEFAULT/mount_check').with_value(true)
is_expected.to contain_swift_object_config('DEFAULT/disable_fallocate').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_config('DEFAULT/fallocate_reserve').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_config('DEFAULT/user').with_value('swift')
is_expected.to contain_swift_object_config('DEFAULT/workers').with_value(4)
is_expected.to contain_swift_object_config('DEFAULT/log_name').with_value('object-server')
@ -325,6 +333,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_object_config('app:object-server/set log_level').with_value('INFO')
is_expected.to contain_swift_object_config('app:object-server/set log_requests').with_value(true)
is_expected.to contain_swift_object_config('app:object-server/set log_address').with_value('/dev/log')
is_expected.to contain_swift_object_config('app:object-server/fallocate_reserve').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_config('DEFAULT/log_statsd_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_object_config('DEFAULT/log_statsd_port').with_value('<SERVICE DEFAULT>')