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 | ||||
| #  [*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', | ||||
|     } | ||||
|   | ||||
| @@ -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}": | ||||
|   | ||||
| @@ -0,0 +1,5 @@ | ||||
| --- | ||||
| features: | ||||
|   - | | ||||
|     Add rsync max_connections config and add rsync_use_xinetd | ||||
|     parameter to support to not use xinetd for rsync | ||||
| @@ -17,7 +17,8 @@ describe 'swift::storage::all' do | ||||
|       :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 | ||||
|       :log_requests    => true, | ||||
|       :max_connections => 25 | ||||
|     } | ||||
|   end | ||||
|  | ||||
| @@ -45,7 +46,8 @@ describe 'swift::storage::all' do | ||||
|        :log_facility         => ['LOG_LOCAL2', 'LOG_LOCAL3'], | ||||
|        :incoming_chmod       => '0644', | ||||
|        :outgoing_chmod       => '0644', | ||||
|        :log_requests => false | ||||
|        :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 | ||||
|  | ||||
|   | ||||
| @@ -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'/ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Shi Yan
					Shi Yan