Accept array/dict for affinity options
write_affinity and read_affinity accepts values which represent array (for write) or hash (for read). Allow using native array or hash so that users can manage the values passed more easily. Change-Id: Id628cf07ec78e6239d91be3a8ab22dd4c609e348
This commit is contained in:
parent
ea34ed8ee9
commit
1033656f6c
@ -122,8 +122,9 @@ class swift::internal_client (
|
||||
}
|
||||
|
||||
if $write_affinity {
|
||||
$write_affinity_real = join(any2array($write_affinity), ',')
|
||||
swift_internal_client_config {
|
||||
'app:proxy-server/write_affinity': value => $write_affinity;
|
||||
'app:proxy-server/write_affinity': value => $write_affinity_real;
|
||||
'app:proxy-server/write_affinity_node_count': value => $write_affinity_node_count;
|
||||
'app:proxy-server/write_affinity_handoff_delete_count': value => $write_affinity_handoff_delete_count;
|
||||
}
|
||||
@ -145,9 +146,14 @@ class swift::internal_client (
|
||||
if $sorting_method and $sorting_method != 'affinity' {
|
||||
fail('sorting_method should be \'affinity\' to use read affinity')
|
||||
}
|
||||
$read_affinity_real = $read_affinity ? {
|
||||
Hash => join(join_keys_to_values($read_affinity, '='), ','),
|
||||
default => join(any2array($read_affinity), ',')
|
||||
}
|
||||
|
||||
swift_internal_client_config {
|
||||
'app:proxy-server/sorting_method': value => 'affinity';
|
||||
'app:proxy-server/read_affinity': value => $read_affinity;
|
||||
'app:proxy-server/read_affinity': value => $read_affinity_real;
|
||||
}
|
||||
} else {
|
||||
swift_internal_client_config {
|
||||
|
@ -306,8 +306,9 @@ class swift::proxy(
|
||||
}
|
||||
|
||||
if $write_affinity {
|
||||
$write_affinity_real = join(any2array($write_affinity), ',')
|
||||
swift_proxy_config {
|
||||
'app:proxy-server/write_affinity': value => $write_affinity;
|
||||
'app:proxy-server/write_affinity': value => $write_affinity_real;
|
||||
'app:proxy-server/write_affinity_node_count': value => $write_affinity_node_count;
|
||||
'app:proxy-server/write_affinity_handoff_delete_count': value => $write_affinity_handoff_delete_count;
|
||||
}
|
||||
@ -329,9 +330,14 @@ class swift::proxy(
|
||||
if $sorting_method and $sorting_method != 'affinity' {
|
||||
fail('sorting_method should be \'affinity\' to use read affinity')
|
||||
}
|
||||
$read_affinity_real = $read_affinity ? {
|
||||
Hash => join(join_keys_to_values($read_affinity, '='), ','),
|
||||
default => join(any2array($read_affinity), ',')
|
||||
}
|
||||
|
||||
swift_proxy_config {
|
||||
'app:proxy-server/sorting_method': value => 'affinity';
|
||||
'app:proxy-server/read_affinity': value => $read_affinity;
|
||||
'app:proxy-server/read_affinity': value => $read_affinity_real;
|
||||
}
|
||||
} else {
|
||||
swift_proxy_config {
|
||||
|
Loading…
Reference in New Issue
Block a user