From 54c75b9f1f72f927d10edbaab7ddde4934b5e7e5 Mon Sep 17 00:00:00 2001 From: Rocky Date: Tue, 26 May 2020 22:07:30 +1000 Subject: [PATCH] Add rsync parameters for object server Change-Id: I752dc30755febcfa94cb266c2faf3b7aedc35ca9 --- manifests/storage/all.pp | 12 ++++++++ manifests/storage/server.pp | 10 +++++++ ...tor_rsync_parameters-15936a0bfc76b670.yaml | 3 ++ spec/classes/swift_storage_all_spec.rb | 30 +++++++++++-------- spec/defines/swift_storage_server_spec.rb | 16 ++++++++++ templates/object-server.conf.erb | 2 ++ 6 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 releasenotes/notes/add_object-replicator_rsync_parameters-15936a0bfc76b670.yaml diff --git a/manifests/storage/all.pp b/manifests/storage/all.pp index c66b90f2..8e4ad0b3 100644 --- a/manifests/storage/all.pp +++ b/manifests/storage/all.pp @@ -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, } } diff --git a/manifests/storage/server.pp b/manifests/storage/server.pp index 09bc2c89..06acb65e 100644 --- a/manifests/storage/server.pp +++ b/manifests/storage/server.pp @@ -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 diff --git a/releasenotes/notes/add_object-replicator_rsync_parameters-15936a0bfc76b670.yaml b/releasenotes/notes/add_object-replicator_rsync_parameters-15936a0bfc76b670.yaml new file mode 100644 index 00000000..9717a2cd --- /dev/null +++ b/releasenotes/notes/add_object-replicator_rsync_parameters-15936a0bfc76b670.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add object-replicator rsync_timeout and rsync_bwlimit parameters. diff --git a/spec/classes/swift_storage_all_spec.rb b/spec/classes/swift_storage_all_spec.rb index a79f0806..9d33d6c5 100644 --- a/spec/classes/swift_storage_all_spec.rb +++ b/spec/classes/swift_storage_all_spec.rb @@ -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( diff --git a/spec/defines/swift_storage_server_spec.rb b/spec/defines/swift_storage_server_spec.rb index 8103232c..5261865c 100644 --- a/spec/defines/swift_storage_server_spec.rb +++ b/spec/defines/swift_storage_server_spec.rb @@ -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 diff --git a/templates/object-server.conf.erb b/templates/object-server.conf.erb index 4229306a..6b1b979f 100644 --- a/templates/object-server.conf.erb +++ b/templates/object-server.conf.erb @@ -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 %>