storage: Add support for db_preallocation

Change-Id: I6f9f46b2c00e29d108d9f943b54e2205844ef973
This commit is contained in:
Takashi Kajinami
2024-08-14 18:44:29 +09:00
parent ebc1224ee1
commit 5b6630e97b
3 changed files with 15 additions and 0 deletions

View File

@@ -79,6 +79,11 @@
# all times. This option affects only <type>-server processes. # all times. This option affects only <type>-server processes.
# Defaults to $facts['os_service_default']. # Defaults to $facts['os_service_default'].
# #
# [*db_preallocation*]
# (optional) Preallocate disk space with SQLite database to decrease
# fragmentation.
# Defaults to $facts['os_service_default'].
#
# [*servers_per_port*] # [*servers_per_port*]
# (optional) Spawn multiple servers per device on different ports. # (optional) Spawn multiple servers per device on different ports.
# Make object-server run this many worker processes per unique port of # Make object-server run this many worker processes per unique port of
@@ -296,6 +301,7 @@ define swift::storage::server(
$disable_fallocate = $facts['os_service_default'], $disable_fallocate = $facts['os_service_default'],
$fallocate_reserve = $facts['os_service_default'], $fallocate_reserve = $facts['os_service_default'],
$server_fallocate_reserve = $facts['os_service_default'], $server_fallocate_reserve = $facts['os_service_default'],
$db_preallocation = $facts['os_service_default'],
$servers_per_port = $facts['os_service_default'], $servers_per_port = $facts['os_service_default'],
$user = undef, $user = undef,
$workers = $facts['os_workers'], $workers = $facts['os_workers'],
@@ -480,6 +486,7 @@ define swift::storage::server(
case $type { case $type {
'account': { 'account': {
$type_opts = { $type_opts = {
'DEFAULT/db_preallocation' => {'value' => $db_preallocation},
# account-server # account-server
# account-auditor # account-auditor
# account-replicator # account-replicator
@@ -511,6 +518,7 @@ define swift::storage::server(
} }
'container': { 'container': {
$type_opts = { $type_opts = {
'DEFAULT/db_preallocation' => {'value' => $db_preallocation},
'DEFAULT/allowed_sync_hosts' => {'value' => join($::swift::storage::container::allowed_sync_hosts, ',')}, 'DEFAULT/allowed_sync_hosts' => {'value' => join($::swift::storage::container::allowed_sync_hosts, ',')},
# container-server # container-server
# container-auditor # container-auditor

View File

@@ -0,0 +1,5 @@
---
features:
- |
The new ``swift::storage::server::db_preallocation`` parameter has been
added.

View File

@@ -98,6 +98,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_account_config('DEFAULT/log_statsd_sample_rate_factor').with_value('<SERVICE DEFAULT>') is_expected.to contain_swift_account_config('DEFAULT/log_statsd_sample_rate_factor').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('DEFAULT/log_statsd_metric_prefix').with_value('<SERVICE DEFAULT>') is_expected.to contain_swift_account_config('DEFAULT/log_statsd_metric_prefix').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('DEFAULT/db_preallocation').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_account_config('account-auditor/').with_ensure('present') is_expected.to contain_swift_account_config('account-auditor/').with_ensure('present')
is_expected.to contain_swift_account_config('account-auditor/log_name').with_ensure('absent') is_expected.to contain_swift_account_config('account-auditor/log_name').with_ensure('absent')
is_expected.to contain_swift_account_config('account-replicator/').with_ensure('present') is_expected.to contain_swift_account_config('account-replicator/').with_ensure('present')
@@ -287,6 +288,7 @@ describe 'swift::storage::server' do
is_expected.to contain_swift_container_config('DEFAULT/log_statsd_sample_rate_factor').with_value('<SERVICE DEFAULT>') is_expected.to contain_swift_container_config('DEFAULT/log_statsd_sample_rate_factor').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/log_statsd_metric_prefix').with_value('<SERVICE DEFAULT>') is_expected.to contain_swift_container_config('DEFAULT/log_statsd_metric_prefix').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/db_preallocation').with_value('<SERVICE DEFAULT>')
is_expected.to contain_swift_container_config('DEFAULT/allowed_sync_hosts').with_value('127.0.0.1') is_expected.to contain_swift_container_config('DEFAULT/allowed_sync_hosts').with_value('127.0.0.1')
is_expected.to contain_swift_container_config('container-auditor/').with_ensure('present') is_expected.to contain_swift_container_config('container-auditor/').with_ensure('present')
is_expected.to contain_swift_container_config('container-auditor/log_name').with_ensure('absent') is_expected.to contain_swift_container_config('container-auditor/log_name').with_ensure('absent')