File: rebalance.pp

package info (click to toggle)
puppet-module-swift 9.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,248 kB
  • ctags: 95
  • sloc: ruby: 5,804; python: 35; makefile: 17; sh: 15
file content (28 lines) | stat: -rw-r--r-- 784 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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'],
  }
}