4 Commits

Author SHA1 Message Date
Dan Bode
c9389516ba Ensure swift hash is rebuilt for every puppet run
Previously, the swift caches were being built on the class
instances themselves.

This could result in stale values when puppet runs multiple times
using the same process (like in the case of puppet agent)

This commit uses prefetch to ensure that the retrieved swift ring
values are updated per puppet run.
2012-04-13 13:41:12 -07:00
Dan
f93ba72fbb Munge weights to be in the format %.2f
The swift ring db converts integers into floats with 2 decimal
points percisions. This was causing the ring resources to constantly
resync.

This commit munges weight in the type to the proper format.
2012-03-14 05:41:41 +00:00
Dan Bode
b6b13ce1b2 Handle case where ring_builder has no rows
The code was not robust when no
rows were returned from
  swift_ringbuilder(builder_file_path).

The calls to retrieve an array range from the
array of this commands output was returning nil
which caused the failure: undef method each on nil

This change explicitly checks for the case where
there are no rows returned by swift-ring-builder.
2012-01-23 11:44:54 -08:00
Dan Bode
917426380e Implement ringbuilder
This commit adds a class, defined resources and
native types that can be used together to manage
the creation, configuration, and rebalancing of
rings.

Creates the following native types:

  ring_account_device
  ring_container_device
  ring_object_device

The implementation of these types is provided
by swift-ring-builder and most of the functionality
is provided by the parent provider (SwiftRingBuilder)

Each of the providers is hard-coded to find the
relevent ring database in /etc/swift. This directory
location can currently not be configured.

Each provider implements self.instances so the
current state can of the ring can be queried from
puppet.

These providers do not handle either the creation
or the rebalancing of the rings, they are intended
to be used in combination with defined resource types
that perform that functionality:

  swift::ringbuilder::create
  swift::ringbuilder::rebalance

The swift::ringbuilder class is also created as
a part of this commit. This class does the following:

  - creates object, account, and container rings
(it uses the same parameters to create these rings)
  - creates the rebalance defines
  - sets up the following relationships:
    for each ring type, create should be applied before
    the native types which should refresh the rebalance
2012-01-23 11:42:42 -08:00