Allow customizing sorting_method
Add a new option to customize sorting_method. This allows usage of the 'timing' sorting method. Change-Id: I9589b420b8d1c6fcbd29d83945dbdcc2da2e22ef
This commit is contained in:
parent
d9eda0394f
commit
2f38c2923b
@ -20,6 +20,10 @@
|
||||
# (optional) Chunk size to read from clients.
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*sorting_method*]
|
||||
# (optional) Method to chose storage nodes during GET and HEAD requests.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*read_affinity*]
|
||||
# (optional) Configures the read affinity of internal client.
|
||||
# Defaults to undef.
|
||||
@ -55,6 +59,7 @@ class swift::internal_client (
|
||||
Swift::Pipeline $pipeline = ['catch_errors', 'proxy-logging', 'cache', 'proxy-server'],
|
||||
$object_chunk_size = $facts['os_service_default'],
|
||||
$client_chunk_size = $facts['os_service_default'],
|
||||
Optional[Swift::SortingMethod] $sorting_method = undef,
|
||||
$read_affinity = undef,
|
||||
$write_affinity = $facts['os_service_default'],
|
||||
$write_affinity_node_count = $facts['os_service_default'],
|
||||
@ -100,13 +105,17 @@ class swift::internal_client (
|
||||
}
|
||||
|
||||
if $read_affinity {
|
||||
if $sorting_method and $sorting_method != 'affinity' {
|
||||
fail('sorting_method should be \'affinity\' to use read affinity')
|
||||
}
|
||||
|
||||
swift_internal_client_config {
|
||||
'app:proxy-server/sorting_method': value => 'affinity';
|
||||
'app:proxy-server/read_affinity': value => $read_affinity;
|
||||
}
|
||||
} else {
|
||||
swift_internal_client_config {
|
||||
'app:proxy-server/sorting_method': value => $facts['os_service_default'];
|
||||
'app:proxy-server/sorting_method': value => pick($sorting_method, $facts['os_service_default']);
|
||||
'app:proxy-server/read_affinity': value => $facts['os_service_default'];
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +78,10 @@
|
||||
# (optional) This is a comma separated list of account hashes that ignore the max_containers_per_account cap.
|
||||
# Default to $facts['os_service_default'].
|
||||
#
|
||||
# [*sorting_method*]
|
||||
# (optional) Method to chose storage nodes during GET and HEAD requests.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*read_affinity*]
|
||||
# (optional) Configures the read affinity of proxy-server.
|
||||
# Defaults to undef.
|
||||
@ -188,6 +192,7 @@ class swift::proxy(
|
||||
$client_chunk_size = $facts['os_service_default'],
|
||||
$max_containers_per_account = $facts['os_service_default'],
|
||||
$max_containers_whitelist = $facts['os_service_default'],
|
||||
Optional[Swift::SortingMethod] $sorting_method = undef,
|
||||
$read_affinity = undef,
|
||||
$write_affinity = undef,
|
||||
$write_affinity_node_count = $facts['os_service_default'],
|
||||
@ -298,13 +303,17 @@ class swift::proxy(
|
||||
}
|
||||
|
||||
if $read_affinity {
|
||||
if $sorting_method and $sorting_method != 'affinity' {
|
||||
fail('sorting_method should be \'affinity\' to use read affinity')
|
||||
}
|
||||
|
||||
swift_proxy_config {
|
||||
'app:proxy-server/sorting_method': value => 'affinity';
|
||||
'app:proxy-server/read_affinity': value => $read_affinity;
|
||||
}
|
||||
} else {
|
||||
swift_proxy_config {
|
||||
'app:proxy-server/sorting_method': value => $facts['os_service_default'];
|
||||
'app:proxy-server/sorting_method': value => pick($sorting_method, $facts['os_service_default']);
|
||||
'app:proxy-server/read_affinity': value => $facts['os_service_default'];
|
||||
}
|
||||
}
|
||||
|
8
releasenotes/notes/sorting_method-671d31caec09044d.yaml
Normal file
8
releasenotes/notes/sorting_method-671d31caec09044d.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``sorting_method`` parameter has been added to the following
|
||||
classes.
|
||||
|
||||
- ``swift::proxy``
|
||||
- ``swift::internal_client``
|
@ -64,6 +64,18 @@ describe 'swift::internal_client' do
|
||||
should contain_swift_internal_client_config('app:proxy-server/recoverable_node_timeout').with_value('15')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with sorting_method' do
|
||||
let :params do
|
||||
{
|
||||
:sorting_method => 'timing'
|
||||
}
|
||||
end
|
||||
|
||||
it 'should configure the sorting_method option' do
|
||||
should contain_swift_internal_client_config('app:proxy-server/sorting_method').with_value('timing')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
@ -250,7 +250,19 @@ describe 'swift::proxy' do
|
||||
should raise_error(Puppet::Error, /write_affinity_node_count requires write_affinity/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with sorting_method' do
|
||||
let :params do
|
||||
{
|
||||
:proxy_local_net_ip => '127.0.0.1',
|
||||
:sorting_method => 'timing'
|
||||
}
|
||||
end
|
||||
|
||||
it 'should configure the sorting_method option' do
|
||||
should contain_swift_proxy_config('app:proxy-server/sorting_method').with_value('timing')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
5
types/sortingmethod.pp
Normal file
5
types/sortingmethod.pp
Normal file
@ -0,0 +1,5 @@
|
||||
type Swift::SortingMethod = Enum[
|
||||
'affinity',
|
||||
'shuffle',
|
||||
'timing'
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user