c64538ef83
If the ring has been rebalanced recently, the next call to rebalance will not rebalance again if the time passed is shorter than min_part_time. swift-ring-builder returns an exit code of 1 in this case, which is a warning, but not a hard error (errors will use an exit code of 2). It makes sense therefore to expect an exit code of 0 or 1 and only fail if it's different. Closes-Bug: 1677588 Change-Id: I03dd075c590344a920099c57b6a7530f103e0ede
30 lines
811 B
Puppet
30 lines
811 B
Puppet
# Swift::Ring::Rebalance
|
|
# Reblances the specified ring. Assumes that the ring already exists
|
|
# and is stored at /etc/swift/${name}.builder
|
|
#
|
|
# == Parameters
|
|
#
|
|
# [*name*] Type of ring to rebalance. The ring file is assumed to be at the path
|
|
# /etc/swift/${name}.builder
|
|
#
|
|
# [*seed*] Optional. Seed value used to seed pythons pseudo-random for ringbuilding.
|
|
define swift::ringbuilder::rebalance(
|
|
$seed = undef
|
|
) {
|
|
|
|
include ::swift::deps
|
|
|
|
validate_re($name, '^object|container|account$')
|
|
if $seed {
|
|
validate_re($seed, '^\d+$')
|
|
}
|
|
|
|
exec { "rebalance_${name}":
|
|
command => strip("swift-ring-builder /etc/swift/${name}.builder rebalance ${seed}"),
|
|
path => ['/usr/bin'],
|
|
refreshonly => true,
|
|
before => Anchor['swift::config::end'],
|
|
returns => [0, 1],
|
|
}
|
|
}
|