From 7a05cf5840c9976c89e859af63e72e6eb94fca39 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 8 Dec 2022 15:01:37 +0900 Subject: [PATCH] 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:-server] fallocate_reserve Change-Id: I37164a2fda28e63604545db46fc925ecf04f9204 --- manifests/storage/server.pp | 56 +++++++++++++------ .../fallocate-opts-6a181c96d0a0cc31.yaml | 9 +++ spec/defines/swift_storage_server_spec.rb | 9 +++ 3 files changed, 56 insertions(+), 18 deletions(-) create mode 100644 releasenotes/notes/fallocate-opts-6a181c96d0a0cc31.yaml diff --git a/manifests/storage/server.pp b/manifests/storage/server.pp index a719ddfe..a1f52969 100644 --- a/manifests/storage/server.pp +++ b/manifests/storage/server.pp @@ -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 -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": diff --git a/releasenotes/notes/fallocate-opts-6a181c96d0a0cc31.yaml b/releasenotes/notes/fallocate-opts-6a181c96d0a0cc31.yaml new file mode 100644 index 00000000..6767b9a1 --- /dev/null +++ b/releasenotes/notes/fallocate-opts-6a181c96d0a0cc31.yaml @@ -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`` diff --git a/spec/defines/swift_storage_server_spec.rb b/spec/defines/swift_storage_server_spec.rb index 396492d6..85df174d 100644 --- a/spec/defines/swift_storage_server_spec.rb +++ b/spec/defines/swift_storage_server_spec.rb @@ -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('') + is_expected.to contain_swift_account_config('DEFAULT/fallocate_reserve').with_value('') 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('') is_expected.to contain_swift_account_config('DEFAULT/log_statsd_host').with_value('') is_expected.to contain_swift_account_config('DEFAULT/log_statsd_port').with_value('') @@ -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('') + is_expected.to contain_swift_container_config('DEFAULT/fallocate_reserve').with_value('') 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('') is_expected.to contain_swift_container_config('DEFAULT/log_statsd_host').with_value('') is_expected.to contain_swift_container_config('DEFAULT/log_statsd_port').with_value('') @@ -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('') + is_expected.to contain_swift_object_config('DEFAULT/fallocate_reserve').with_value('') 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('') is_expected.to contain_swift_object_config('DEFAULT/log_statsd_host').with_value('') is_expected.to contain_swift_object_config('DEFAULT/log_statsd_port').with_value('')