File: policy_ring.pp

package info (click to toggle)
puppet-module-swift 25.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,400 kB
  • sloc: ruby: 9,593; python: 38; sh: 10; makefile: 10
file content (65 lines) | stat: -rw-r--r-- 1,746 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Used to build an additional object ring for a storage policy.
# The namevar/name of this class must be an integer.
#
# Specifies the following relationship:
#  Rings should be created before any devices are added to them
#  Rings should be rebalanced if anything changes
#
# == Parameters
#  [*policy_id*]
#    (required) The id must be a positive integer. This is used to denote
#    the storage policy ID for the object ring.
#    Defaults to $name
#
#  [*part_power*]
#    (optional) The total number of partitions that should exist in the ring.
#    This is expressed as a power of 2.
#
#  [*replicas*]
#    (optional) Number of replicas that should be maintained of each stored
#    object.
#
#  [*min_part_hours*]
#    (optional) Minimum amount of time before partitions can be moved.
#
# == Dependencies
#
#   Class['swift']
#
# == Examples
#
# == Authors
#
#   Dan Bode dan@puppetlabs.com
#   Adam Vinsh adam.vinsh@charter.com
#
# == Copyright
#
# Copyright 2011 Puppetlabs Inc, unless otherwise noted.
#
define swift::ringbuilder::policy_ring(
  Pattern[/^\d+$/] $policy_id = $name,
  $part_power                 = undef,
  $replicas                   = undef,
  $min_part_hours             = undef,
) {

  include swift::deps
  Class['swift'] -> Swift::Ringbuilder::Policy_ring[$policy_id]

  if $policy_id == '0' {
    $ring_builder = 'object'
  } else {
    $ring_builder = "object-${policy_id}"
  }

  swift::ringbuilder::create{ $ring_builder :
    part_power     => $part_power,
    replicas       => $replicas,
    min_part_hours => $min_part_hours,
  }
  swift::ringbuilder::rebalance{ $ring_builder: }

  Swift::Ringbuilder::Create[$ring_builder] -> Ring_object_device <| |> ~> Swift::Ringbuilder::Rebalance[$ring_builder]

}