diff --git a/manifests/storage.pp b/manifests/storage.pp index 4c2c89ea..beab2b65 100644 --- a/manifests/storage.pp +++ b/manifests/storage.pp @@ -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', } diff --git a/manifests/storage/all.pp b/manifests/storage/all.pp index 198c4072..a6b63a83 100644 --- a/manifests/storage/all.pp +++ b/manifests/storage/all.pp @@ -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}": diff --git a/releasenotes/notes/add_rsync_use_xinetd_and_max_connections-48c6b86b1bfed6f8.yaml b/releasenotes/notes/add_rsync_use_xinetd_and_max_connections-48c6b86b1bfed6f8.yaml new file mode 100644 index 00000000..8d1b3562 --- /dev/null +++ b/releasenotes/notes/add_rsync_use_xinetd_and_max_connections-48c6b86b1bfed6f8.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add rsync max_connections config and add rsync_use_xinetd + parameter to support to not use xinetd for rsync diff --git a/spec/classes/swift_storage_all_spec.rb b/spec/classes/swift_storage_all_spec.rb index c5c8f6a8..8e60a6cc 100644 --- a/spec/classes/swift_storage_all_spec.rb +++ b/spec/classes/swift_storage_all_spec.rb @@ -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 diff --git a/spec/classes/swift_storage_spec.rb b/spec/classes/swift_storage_spec.rb index 227a5416..69fb3a40 100644 --- a/spec/classes/swift_storage_spec.rb +++ b/spec/classes/swift_storage_spec.rb @@ -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'/