Support to configure rsync max_connections and not use xinetd for rsync

Change-Id: I40f4e7f2c81cebf8213057a341ef81f7f3d09d1e
This commit is contained in:
Shi Yan 2020-05-19 01:22:25 +10:00 committed by Rocky
parent f847dae469
commit ff9608a8c1
5 changed files with 59 additions and 24 deletions

View File

@ -7,6 +7,10 @@
# == Parameters
# [*storage_local_net_ip*] ip address that the swift servers should
# bind to. Required.
#
# [*rsync_use_xinetd*] indicate if xinetd should be used to manage
# rsync service, Default to True.
#
# == Dependencies
#
# == Examples
@ -20,14 +24,15 @@
# Copyright 2011 Puppetlabs Inc, unless otherwise noted.
#
class swift::storage(
$storage_local_net_ip
$storage_local_net_ip,
$rsync_use_xinetd = true,
) {
include swift::deps
if !defined(Class['rsync::server']){
class{ '::rsync::server':
use_xinetd => true,
use_xinetd => $rsync_use_xinetd,
address => $storage_local_net_ip,
use_chroot => 'no',
}

View File

@ -118,6 +118,10 @@
# version 3.0 or greater.
# Defaults to false.
#
# [*max_connections*]
# (optional) maximum number of simultaneous connections allowed for rsync.
# Defaults to 25.
#
class swift::storage::all(
$storage_local_net_ip,
$devices = '/srv/node',
@ -147,6 +151,7 @@ class swift::storage::all(
$object_server_workers = $::os_workers,
$object_server_mb_per_sync = 512,
$splice = false,
$max_connections = 25,
) {
include swift::deps
@ -183,6 +188,7 @@ from 6002 to 6202 and will be changed in a later release')
log_statsd_default_sample_rate => $log_statsd_default_sample_rate,
log_statsd_sample_rate_factor => $log_statsd_sample_rate_factor,
log_statsd_metric_prefix => $log_statsd_metric_prefix,
max_connections => $max_connections,
}
swift::storage::server { "${account_port}":

View File

@ -0,0 +1,5 @@
---
features:
- |
Add rsync max_connections config and add rsync_use_xinetd
parameter to support to not use xinetd for rsync

View File

@ -10,14 +10,15 @@ describe 'swift::storage::all' do
let :default_params do
{
:devices => '/srv/node',
:object_port => 6000,
:container_port => 6001,
:account_port => 6002,
:log_facility => 'LOG_LOCAL2',
: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
:devices => '/srv/node',
:object_port => 6000,
:container_port => 6001,
:account_port => 6002,
:log_facility => 'LOG_LOCAL2',
: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
}
end
@ -32,20 +33,21 @@ describe 'swift::storage::all' do
[{ :storage_local_net_ip => '127.0.0.1' },
{
:devices => '/tmp/node',
:devices => '/tmp/node',
:storage_local_net_ip => '10.0.0.1',
:object_port => "7000",
:container_port => "7001",
:account_port => "7002",
:object_pipeline => ["healthcheck"],
:container_pipeline => ["healthcheck"],
:account_pipeline => ["healthcheck"],
:allow_versions => true,
:splice => true,
:log_facility => ['LOG_LOCAL2', 'LOG_LOCAL3'],
:incoming_chmod => '0644',
:outgoing_chmod => '0644',
:log_requests => false
:object_port => "7000",
:container_port => "7001",
:account_port => "7002",
:object_pipeline => ["healthcheck"],
:container_pipeline => ["healthcheck"],
:account_pipeline => ["healthcheck"],
:allow_versions => true,
:splice => true,
:log_facility => ['LOG_LOCAL2', 'LOG_LOCAL3'],
:incoming_chmod => '0644',
:outgoing_chmod => '0644',
:log_requests => false,
:max_connections => 20
}
].each do |param_set|
@ -83,7 +85,8 @@ describe 'swift::storage::all' do
:storage_local_net_ip => param_hash[:storage_local_net_ip],
:incoming_chmod => param_hash[:incoming_chmod],
:outgoing_chmod => param_hash[:outgoing_chmod],
:log_facility => param_hash[:log_facility]
:log_facility => param_hash[:log_facility],
:max_connections => param_hash[:max_connections]
}
end

View File

@ -22,6 +22,22 @@ describe 'swift::storage' do
)}
end
describe 'when the rsync_use_xinetd is specified' do
let :params do
{
:storage_local_net_ip => '127.0.0.1',
:rsync_use_xinetd => false,
}
end
it { is_expected.to contain_class('rsync::server').with(
{:use_xinetd => false,
:address => params[:storage_local_net_ip],
:use_chroot => 'no'
}
)}
end
describe 'when local net ip is not specified' do
if Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0
it_raises 'a Puppet::Error', /expects a value for parameter 'storage_local_net_ip'/