Add rsync parameters for object server

Change-Id: I752dc30755febcfa94cb266c2faf3b7aedc35ca9
This commit is contained in:
Rocky 2020-05-26 22:07:30 +10:00
parent 1ef0107008
commit 54c75b9f1f
6 changed files with 61 additions and 12 deletions

View File

@ -106,6 +106,14 @@
# (optional) Number of MB allocated for the cache.
# Defaults to 512, which is the swift default value.
#
# [*rsync_timeout*]
# (optional) Max duration of a partition rsync.
# Default to 900.
#
# [*rsync_bwlimit*]
# (optional) Bandwidth limit for rsync in kB/s. 0 means unlimited.
# Default to 0.
#
# [*splice*]
# (optional) Use splice for zero-copy object GETs. This requires Linux Kernel
# version 3.0 or greater.
@ -152,6 +160,8 @@ class swift::storage::all(
$container_server_workers = $::os_workers,
$object_server_workers = $::os_workers,
$object_server_mb_per_sync = 512,
$rsync_timeout = 900,
$rsync_bwlimit = 0,
$splice = false,
$max_connections = 25,
$rsync_use_xinetd = $::swift::params::xinetd_available,
@ -239,5 +249,7 @@ from 6002 to 6202 and will be changed in a later release')
workers => $object_server_workers,
splice => $splice,
object_server_mb_per_sync => $object_server_mb_per_sync,
rsync_timeout => $rsync_timeout,
rsync_bwlimit => $rsync_bwlimit,
}
}

View File

@ -160,6 +160,14 @@
# external services.
# Defaults to 60.
#
# [*rsync_timeout*]
# (optional) Max duration of a partition rsync.
# Default to 900.
#
# [*rsync_bwlimit*]
# (optional) Bandwidth limit for rsync in kB/s. 0 means unlimited.
# Default to 0.
#
# [*splice*]
# (optional) Use splice for zero-copy object GETs. This requires Linux Kernel
# version 3.0 or greater.
@ -212,6 +220,8 @@ define swift::storage::server(
$disk_chunk_size = 65536,
$client_timeout = 60,
$auditor_disk_chunk_size = undef,
$rsync_timeout = 900,
$rsync_bwlimit = 0,
$splice = false,
$object_server_mb_per_sync = 512,
# DEPRECATED PARAMETERS

View File

@ -0,0 +1,3 @@
---
features:
- Add object-replicator rsync_timeout and rsync_bwlimit parameters.

View File

@ -18,7 +18,9 @@ describe 'swift::storage::all' do
:incoming_chmod => 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
:outgoing_chmod => 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
:log_requests => true,
:max_connections => 25
:max_connections => 25,
:rsync_timeout => 900,
:rsync_bwlimit => 0
}
end
@ -46,7 +48,9 @@ describe 'swift::storage::all' do
:incoming_chmod => '0644',
:outgoing_chmod => '0644',
:log_requests => false,
:max_connections => 20
:max_connections => 20,
:rsync_timeout => 3600,
:rsync_bwlimit => 1024
}
].each do |param_set|
@ -92,24 +96,26 @@ describe 'swift::storage::all' do
it { is_expected.to contain_swift__storage__server(param_hash[:account_port]).with(
{:type => 'account',
:config_file_path => 'account-server.conf',
:incoming_chmod => param_hash[:incoming_chmod],
:outgoing_chmod => param_hash[:outgoing_chmod],
:pipeline => param_hash[:account_pipeline] || ['account-server'] }.merge(storage_server_defaults)
:incoming_chmod => param_hash[:incoming_chmod],
:outgoing_chmod => param_hash[:outgoing_chmod],
:pipeline => param_hash[:account_pipeline] || ['account-server'] }.merge(storage_server_defaults)
)}
it { is_expected.to contain_swift__storage__server(param_hash[:object_port]).with(
{:type => 'object',
:config_file_path => 'object-server.conf',
:incoming_chmod => param_hash[:incoming_chmod],
:outgoing_chmod => param_hash[:outgoing_chmod],
:pipeline => param_hash[:object_pipeline] || ['object-server'],
:splice => param_hash[:splice] || false }.merge(storage_server_defaults)
:incoming_chmod => param_hash[:incoming_chmod],
:outgoing_chmod => param_hash[:outgoing_chmod],
:pipeline => param_hash[:object_pipeline] || ['object-server'],
:splice => param_hash[:splice] || false }.merge(storage_server_defaults),
:rsync_timeout => param_hash[:rsync_timeout],
:rsync_bwlimit => param_hash[:rsync_bwlimit],
)}
it { is_expected.to contain_swift__storage__server(param_hash[:container_port]).with(
{:type => 'container',
:config_file_path => 'container-server.conf',
:incoming_chmod => param_hash[:incoming_chmod],
:outgoing_chmod => param_hash[:outgoing_chmod],
:pipeline => param_hash[:container_pipeline] || ['container-server'] }.merge(storage_server_defaults)
:incoming_chmod => param_hash[:incoming_chmod],
:outgoing_chmod => param_hash[:outgoing_chmod],
:pipeline => param_hash[:container_pipeline] || ['container-server'] }.merge(storage_server_defaults)
)}
it { is_expected.to contain_class('rsync::server').with(

View File

@ -137,6 +137,22 @@ describe 'swift::storage::server' do
let :params do req_params.merge({ :client_timeout => 30, }) end
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^client_timeout\s*=\s*30\s*$/) }
end
describe "when rsync_timeout is not set" do
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^rsync_timeout\s*=\s*900\s*$/) }
end
describe "when rsync_timeout is set" do
let :params do req_params.merge({ :rsync_timeout => 600, }) end
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^rsync_timeout\s*=\s*600\s*$/) }
end
describe "when rsync_bwlimit is not set" do
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^rsync_bwlimit\s*=\s*0\s*$/) }
end
describe "when rsync_bwlimit is set" do
let :params do req_params.merge({ :rsync_bwlimit => 2048, }) end
it { is_expected.to contain_concat_fragment("swift-#{t}-#{title}").with_content(/^rsync_bwlimit\s*=\s*2048\s*$/) }
end
end
describe "when log_udp_port is set" do

View File

@ -43,6 +43,8 @@ mb_per_sync = <%= @object_server_mb_per_sync %>
[object-replicator]
concurrency = <%= @replicator_concurrency %>
rsync_timeout = <%= @rsync_timeout%>
rsync_bwlimit = <%= @rsync_bwlimit%>
[object-updater]
concurrency = <%= @updater_concurrency %>