puppet-swift/manifests/ringbuilder/policy_ring.pp
Adam Vinsh 63688a14e5 Add support for swift storage policies
This change implements storage policies as defined by swift:
http://docs.openstack.org/developer/swift/overview_policies.html

There are two primary areas of change in this review
- Add storage policy support to the ringbuilder and ring devices, along with
  associated spec tests.
- Adding storage policy support and enforcing rules in swift.conf using the
  swift_storage_policy type and provider. Also: updated spec tests and an
  update to swift acceptance test to use storage policies to configure an
  additional 3 replica based ring.

See release notes and the README update for more details/instructions.

Change-Id: I2b8db751790704df3f1027a14f61e231591537f3
2016-11-22 16:17:52 +00:00

59 lines
1.6 KiB
Puppet

# Used to build an aditional 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
# [*title*] required. Title must be a positive integer. Title of this class
# is used to denote the storage policy ID for the object ring.
#
# [*part_power*] The total number of partitions that should exist in the ring.
# This is expressed as a power of 2.
# [*replicas*] Numer of replicas that should be maintained of each stored object.
# [*min_part_hours*] 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(
$part_power = undef,
$replicas = undef,
$min_part_hours = undef,
) {
validate_re($title, '^\d+$')
include ::swift::deps
Class['swift'] -> Swift::Ringbuilder::Policy_ring[$title]
if $title == '0' {
$ring_builder = 'object'
} else {
$ring_builder = "object-${title}"
}
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]
}