Skip to content

Commit 4ee7b74

Browse files
committed
Add support for DLO configuration.
New class swift::proxy::dlo for DLO configuration. Add acceptance tests Add docs to README Change-Id: Ie209e494d7affd72c3fea3f2cc3459b91d7c6765
1 parent 4e20b73 commit 4ee7b74

File tree

5 files changed

+124
-2
lines changed

5 files changed

+124
-2
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,28 @@ This is the ip that the proxy service will bind to when it starts.
126126
####`port`
127127
The port for which the proxy service will bind to when it starts.
128128

129+
### Class swift::proxy::dlo
130+
131+
Configures [DLO middleware](http://docs.openstack.org/developer/swift/middleware.html#module-swift.common.middleware.dlo) for swift proxy.
132+
133+
```puppet
134+
class { '::swift::proxy::dlo':
135+
rate_limit_after_segment => '10',
136+
rate_limit_segments_per_sec => '1',
137+
max_get_time => '86400'
138+
}
139+
```
140+
141+
####`rate_limit_after_segment`
142+
Start rate-limiting DLO segment serving after the Nth segment of a segmented object.
143+
144+
####`rate_limit_segments_per_sec`
145+
Once segment rate-limiting kicks in for an object, limit segments served to N per second.
146+
0 means no rate-limiting.
147+
148+
####`max_get_time`
149+
Time limit on GET requests (seconds).
150+
129151
### Class: swift::storage
130152

131153
Class that sets up all of the configuration and dependencies for swift storage server instances.

manifests/proxy/dlo.pp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Configure swift dlo.
3+
#
4+
# == Examples
5+
#
6+
# include ::swift::proxy::dlo
7+
#
8+
# == Parameters
9+
#
10+
# [*rate_limit_after_segment*]
11+
# Start rate-limiting DLO segment serving after the Nth segment of a segmented object.
12+
# Default to 10.
13+
#
14+
# [*rate_limit_segments_per_sec*]
15+
# Once segment rate-limiting kicks in for an object, limit segments served to N per second.
16+
# 0 means no rate-limiting.
17+
# Default to 1.
18+
#
19+
# [*max_get_time*]
20+
# Time limit on GET requests (seconds).
21+
# Default to 86400.
22+
#
23+
# == Authors
24+
#
25+
# Aleksandr Didenko adidenko@mirantis.com
26+
#
27+
# == Copyright
28+
#
29+
# Copyright 2015 Mirantis Inc, unless otherwise noted.
30+
#
31+
class swift::proxy::dlo (
32+
$rate_limit_after_segment = '10',
33+
$rate_limit_segments_per_sec = '1',
34+
$max_get_time = '86400'
35+
) {
36+
37+
concat::fragment { 'swift_dlo':
38+
target => '/etc/swift/proxy-server.conf',
39+
content => template('swift/proxy/dlo.conf.erb'),
40+
order => '36',
41+
}
42+
43+
}

spec/acceptance/basic_swift_spec.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,17 @@ class { '::swift::ringbuilder':
105105
}
106106
class { '::swift::proxy':
107107
proxy_local_net_ip => '127.0.0.1',
108-
pipeline => ['healthcheck', 'cache', 'tempauth', 'proxy-server'],
108+
pipeline => ['healthcheck', 'cache', 'tempauth', 'dlo', 'proxy-server'],
109109
account_autocreate => true,
110110
require => Class['swift::ringbuilder'],
111111
}
112112
class { '::swift::proxy::authtoken':
113113
admin_password => 'a_big_secret',
114114
}
115-
class { ['::swift::proxy::healthcheck', '::swift::proxy::cache', '::swift::proxy::tempauth']: }
115+
class {
116+
[ '::swift::proxy::healthcheck', '::swift::proxy::cache',
117+
'::swift::proxy::tempauth', '::swift::proxy::dlo' ]:
118+
}
116119
EOS
117120

118121

spec/classes/swift_proxy_dlo_spec.rb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
require 'spec_helper'
2+
3+
describe 'swift::proxy::dlo' do
4+
5+
let :facts do
6+
{}
7+
end
8+
9+
let :fragment_file do
10+
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/36_swift_dlo"
11+
end
12+
13+
describe "when using default parameters" do
14+
it 'should build the fragment with correct parameters' do
15+
verify_contents(catalogue, fragment_file,
16+
[
17+
'[filter:dlo]',
18+
'use = egg:swift#dlo',
19+
'rate_limit_after_segment = 10',
20+
'rate_limit_segments_per_sec = 1',
21+
'max_get_time = 86400',
22+
]
23+
)
24+
end
25+
end
26+
27+
describe "when overriding default parameters" do
28+
let :params do
29+
{
30+
:rate_limit_after_segment => '30',
31+
:rate_limit_segments_per_sec => '5',
32+
:max_get_time => '6400',
33+
}
34+
end
35+
it 'should build the fragment with correct parameters' do
36+
verify_contents(catalogue, fragment_file,
37+
[
38+
'[filter:dlo]',
39+
'use = egg:swift#dlo',
40+
'rate_limit_after_segment = 30',
41+
'rate_limit_segments_per_sec = 5',
42+
'max_get_time = 6400',
43+
]
44+
)
45+
end
46+
end
47+
48+
end

templates/proxy/dlo.conf.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[filter:dlo]
3+
use = egg:swift#dlo
4+
rate_limit_after_segment = <%= @rate_limit_after_segment %>
5+
rate_limit_segments_per_sec = <%= @rate_limit_segments_per_sec %>
6+
max_get_time = <%= @max_get_time %>

0 commit comments

Comments
 (0)