Support to configure rsync max_connections and not use xinetd for rsync
Change-Id: I40f4e7f2c81cebf8213057a341ef81f7f3d09d1e
This commit is contained in:
		@@ -7,6 +7,10 @@
 | 
				
			|||||||
# == Parameters
 | 
					# == Parameters
 | 
				
			||||||
#  [*storage_local_net_ip*] ip address that the swift servers should
 | 
					#  [*storage_local_net_ip*] ip address that the swift servers should
 | 
				
			||||||
#    bind to. Required.
 | 
					#    bind to. Required.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  [*rsync_use_xinetd*] indicate if xinetd should be used to manage
 | 
				
			||||||
 | 
					#  rsync service, Default to True.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
# == Dependencies
 | 
					# == Dependencies
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# == Examples
 | 
					# == Examples
 | 
				
			||||||
@@ -20,14 +24,15 @@
 | 
				
			|||||||
# Copyright 2011 Puppetlabs Inc, unless otherwise noted.
 | 
					# Copyright 2011 Puppetlabs Inc, unless otherwise noted.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
class swift::storage(
 | 
					class swift::storage(
 | 
				
			||||||
  $storage_local_net_ip
 | 
					  $storage_local_net_ip,
 | 
				
			||||||
 | 
					  $rsync_use_xinetd = true,
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  include swift::deps
 | 
					  include swift::deps
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if !defined(Class['rsync::server']){
 | 
					  if !defined(Class['rsync::server']){
 | 
				
			||||||
    class{ '::rsync::server':
 | 
					    class{ '::rsync::server':
 | 
				
			||||||
      use_xinetd => true,
 | 
					      use_xinetd => $rsync_use_xinetd,
 | 
				
			||||||
      address    => $storage_local_net_ip,
 | 
					      address    => $storage_local_net_ip,
 | 
				
			||||||
      use_chroot => 'no',
 | 
					      use_chroot => 'no',
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -118,6 +118,10 @@
 | 
				
			|||||||
#   version 3.0 or greater.
 | 
					#   version 3.0 or greater.
 | 
				
			||||||
#   Defaults to false.
 | 
					#   Defaults to false.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					# [*max_connections*]
 | 
				
			||||||
 | 
					#   (optional) maximum number of simultaneous connections allowed for rsync.
 | 
				
			||||||
 | 
					#   Defaults to 25.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
class swift::storage::all(
 | 
					class swift::storage::all(
 | 
				
			||||||
  $storage_local_net_ip,
 | 
					  $storage_local_net_ip,
 | 
				
			||||||
  $devices                        = '/srv/node',
 | 
					  $devices                        = '/srv/node',
 | 
				
			||||||
@@ -147,6 +151,7 @@ class swift::storage::all(
 | 
				
			|||||||
  $object_server_workers          = $::os_workers,
 | 
					  $object_server_workers          = $::os_workers,
 | 
				
			||||||
  $object_server_mb_per_sync      = 512,
 | 
					  $object_server_mb_per_sync      = 512,
 | 
				
			||||||
  $splice                         = false,
 | 
					  $splice                         = false,
 | 
				
			||||||
 | 
					  $max_connections                = 25,
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  include swift::deps
 | 
					  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_default_sample_rate => $log_statsd_default_sample_rate,
 | 
				
			||||||
    log_statsd_sample_rate_factor  => $log_statsd_sample_rate_factor,
 | 
					    log_statsd_sample_rate_factor  => $log_statsd_sample_rate_factor,
 | 
				
			||||||
    log_statsd_metric_prefix       => $log_statsd_metric_prefix,
 | 
					    log_statsd_metric_prefix       => $log_statsd_metric_prefix,
 | 
				
			||||||
 | 
					    max_connections                => $max_connections,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  swift::storage::server { "${account_port}":
 | 
					  swift::storage::server { "${account_port}":
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					features:
 | 
				
			||||||
 | 
					  - |
 | 
				
			||||||
 | 
					    Add rsync max_connections config and add rsync_use_xinetd
 | 
				
			||||||
 | 
					    parameter to support to not use xinetd for rsync
 | 
				
			||||||
@@ -10,14 +10,15 @@ describe 'swift::storage::all' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  let :default_params do
 | 
					  let :default_params do
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      :devices => '/srv/node',
 | 
					      :devices         => '/srv/node',
 | 
				
			||||||
      :object_port => 6000,
 | 
					      :object_port     => 6000,
 | 
				
			||||||
      :container_port => 6001,
 | 
					      :container_port  => 6001,
 | 
				
			||||||
      :account_port => 6002,
 | 
					      :account_port    => 6002,
 | 
				
			||||||
      :log_facility => 'LOG_LOCAL2',
 | 
					      :log_facility    => 'LOG_LOCAL2',
 | 
				
			||||||
      :incoming_chmod => 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
 | 
					      :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',
 | 
					      :outgoing_chmod  => 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
 | 
				
			||||||
      :log_requests => true
 | 
					      :log_requests    => true,
 | 
				
			||||||
 | 
					      :max_connections => 25
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -32,20 +33,21 @@ describe 'swift::storage::all' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    [{ :storage_local_net_ip => '127.0.0.1' },
 | 
					    [{ :storage_local_net_ip => '127.0.0.1' },
 | 
				
			||||||
     {
 | 
					     {
 | 
				
			||||||
       :devices => '/tmp/node',
 | 
					       :devices              => '/tmp/node',
 | 
				
			||||||
       :storage_local_net_ip => '10.0.0.1',
 | 
					       :storage_local_net_ip => '10.0.0.1',
 | 
				
			||||||
       :object_port => "7000",
 | 
					       :object_port          => "7000",
 | 
				
			||||||
       :container_port => "7001",
 | 
					       :container_port       => "7001",
 | 
				
			||||||
       :account_port => "7002",
 | 
					       :account_port         => "7002",
 | 
				
			||||||
       :object_pipeline => ["healthcheck"],
 | 
					       :object_pipeline      => ["healthcheck"],
 | 
				
			||||||
       :container_pipeline => ["healthcheck"],
 | 
					       :container_pipeline   => ["healthcheck"],
 | 
				
			||||||
       :account_pipeline => ["healthcheck"],
 | 
					       :account_pipeline     => ["healthcheck"],
 | 
				
			||||||
       :allow_versions => true,
 | 
					       :allow_versions       => true,
 | 
				
			||||||
       :splice => true,
 | 
					       :splice               => true,
 | 
				
			||||||
       :log_facility => ['LOG_LOCAL2', 'LOG_LOCAL3'],
 | 
					       :log_facility         => ['LOG_LOCAL2', 'LOG_LOCAL3'],
 | 
				
			||||||
       :incoming_chmod => '0644',
 | 
					       :incoming_chmod       => '0644',
 | 
				
			||||||
       :outgoing_chmod => '0644',
 | 
					       :outgoing_chmod       => '0644',
 | 
				
			||||||
       :log_requests => false
 | 
					       :log_requests         => false,
 | 
				
			||||||
 | 
					       :max_connections      => 20
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
    ].each do |param_set|
 | 
					    ].each do |param_set|
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -83,7 +85,8 @@ describe 'swift::storage::all' do
 | 
				
			|||||||
           :storage_local_net_ip => param_hash[:storage_local_net_ip],
 | 
					           :storage_local_net_ip => param_hash[:storage_local_net_ip],
 | 
				
			||||||
           :incoming_chmod       => param_hash[:incoming_chmod],
 | 
					           :incoming_chmod       => param_hash[:incoming_chmod],
 | 
				
			||||||
           :outgoing_chmod       => param_hash[:outgoing_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
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,22 @@ describe 'swift::storage' do
 | 
				
			|||||||
        )}
 | 
					        )}
 | 
				
			||||||
      end
 | 
					      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
 | 
					      describe 'when local net ip is not specified' do
 | 
				
			||||||
        if Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0
 | 
					        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'/
 | 
					          it_raises 'a Puppet::Error', /expects a value for parameter 'storage_local_net_ip'/
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user