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.
|
||||
@ -51,17 +55,18 @@
|
||||
# Defaults to false.
|
||||
#
|
||||
class swift::internal_client (
|
||||
$user = $::swift::params::user,
|
||||
Swift::Pipeline $pipeline = ['catch_errors', 'proxy-logging', 'cache', 'proxy-server'],
|
||||
$object_chunk_size = $facts['os_service_default'],
|
||||
$client_chunk_size = $facts['os_service_default'],
|
||||
$read_affinity = undef,
|
||||
$write_affinity = $facts['os_service_default'],
|
||||
$write_affinity_node_count = $facts['os_service_default'],
|
||||
$client_timeout = $facts['os_service_default'],
|
||||
$node_timeout = $facts['os_service_default'],
|
||||
$recoverable_node_timeout = $facts['os_service_default'],
|
||||
Boolean $purge_config = false,
|
||||
$user = $::swift::params::user,
|
||||
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'],
|
||||
$client_timeout = $facts['os_service_default'],
|
||||
$node_timeout = $facts['os_service_default'],
|
||||
$recoverable_node_timeout = $facts['os_service_default'],
|
||||
Boolean $purge_config = false,
|
||||
) inherits swift::params {
|
||||
|
||||
include swift::deps
|
||||
@ -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.
|
||||
@ -166,41 +170,42 @@
|
||||
#
|
||||
class swift::proxy(
|
||||
$proxy_local_net_ip,
|
||||
$port = '8080',
|
||||
Swift::Pipeline $pipeline = [
|
||||
$port = '8080',
|
||||
Swift::Pipeline $pipeline = [
|
||||
'catch_errors', 'gatekeeper', 'healthcheck', 'proxy-logging', 'cache',
|
||||
'listing_formats', 'tempauth', 'copy', 'proxy-logging', 'proxy-server'],
|
||||
$workers = $facts['os_workers'],
|
||||
Boolean $allow_account_management = true,
|
||||
Boolean $account_autocreate = true,
|
||||
$log_headers = $facts['os_service_default'],
|
||||
$log_udp_host = $facts['os_service_default'],
|
||||
$log_udp_port = $facts['os_service_default'],
|
||||
$log_address = '/dev/log',
|
||||
$log_level = 'INFO',
|
||||
$log_facility = 'LOG_LOCAL2',
|
||||
$log_handoffs = $facts['os_service_default'],
|
||||
$log_name = 'proxy-server',
|
||||
$cors_allow_origin = $facts['os_service_default'],
|
||||
$strict_cors_mode = $facts['os_service_default'],
|
||||
$cors_expose_headers = $facts['os_service_default'],
|
||||
$object_chunk_size = $facts['os_service_default'],
|
||||
$client_chunk_size = $facts['os_service_default'],
|
||||
$max_containers_per_account = $facts['os_service_default'],
|
||||
$max_containers_whitelist = $facts['os_service_default'],
|
||||
$read_affinity = undef,
|
||||
$write_affinity = undef,
|
||||
$write_affinity_node_count = $facts['os_service_default'],
|
||||
$client_timeout = $facts['os_service_default'],
|
||||
$keepalive_timeout = $facts['os_service_default'],
|
||||
$node_timeout = $facts['os_service_default'],
|
||||
$recoverable_node_timeout = $facts['os_service_default'],
|
||||
$allow_open_expired = $facts['os_service_default'],
|
||||
Boolean $manage_service = true,
|
||||
Boolean $enabled = true,
|
||||
$package_ensure = 'present',
|
||||
Swift::ServiceProvider $service_provider = $::swift::params::service_provider,
|
||||
Boolean $purge_config = false,
|
||||
$workers = $facts['os_workers'],
|
||||
Boolean $allow_account_management = true,
|
||||
Boolean $account_autocreate = true,
|
||||
$log_headers = $facts['os_service_default'],
|
||||
$log_udp_host = $facts['os_service_default'],
|
||||
$log_udp_port = $facts['os_service_default'],
|
||||
$log_address = '/dev/log',
|
||||
$log_level = 'INFO',
|
||||
$log_facility = 'LOG_LOCAL2',
|
||||
$log_handoffs = $facts['os_service_default'],
|
||||
$log_name = 'proxy-server',
|
||||
$cors_allow_origin = $facts['os_service_default'],
|
||||
$strict_cors_mode = $facts['os_service_default'],
|
||||
$cors_expose_headers = $facts['os_service_default'],
|
||||
$object_chunk_size = $facts['os_service_default'],
|
||||
$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'],
|
||||
$client_timeout = $facts['os_service_default'],
|
||||
$keepalive_timeout = $facts['os_service_default'],
|
||||
$node_timeout = $facts['os_service_default'],
|
||||
$recoverable_node_timeout = $facts['os_service_default'],
|
||||
$allow_open_expired = $facts['os_service_default'],
|
||||
Boolean $manage_service = true,
|
||||
Boolean $enabled = true,
|
||||
$package_ensure = 'present',
|
||||
Swift::ServiceProvider $service_provider = $::swift::params::service_provider,
|
||||
Boolean $purge_config = false,
|
||||
) inherits swift::params {
|
||||
|
||||
include swift::deps
|
||||
@ -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…
Reference in New Issue
Block a user