12 Commits

Author SHA1 Message Date
Lukas Bezdicka
b6ba9f09b2 Fix ipv6 support
One shold never parse uri with split(':') as it was in types
ring_account_device, ring_container_device and ring_object_device.
This is fixed by using uri and just setting variables from that.
Also swift_ring_builder didn't add brackets to ipv6 address before
adding port information to it.

Change-Id: I55b7032143c8446abeed4f6c266c0fff0cb6b3b3
2015-04-07 12:54:14 +02:00
David Moreau Simard
bb3007615f Add swift-ring-builder multi region support
Since Swift 1.8.0, there is the region layer of topology above zones.
swift-ring-builder supports this natively and this commit allows a user to
specify a region when creating devices.
We maintain backwards compatibility by defaulting to region '1'.
The coverage of the ring builder spec tests were also improved as part of
this commit.

Change-Id: I67cbe6b87c84778f71df59cf00f2c5175342bc1b
2014-05-09 15:45:28 -04:00
Dan Prince
c89e327fb8 Use swift_config to configure swift.conf
This change also adds an autorequire in the swift_config
type to ensure the /etc/swift/swift.conf exists.

Change-Id: Ic591a3ceb040c4599339ed7f750a5273d2052ac1
Implements: blueprint puppet-swift-ini-settings
2013-08-26 20:54:06 -04:00
Mathieu Gagné
e41a552afe Add ini_setting based custom types for configs
Previous configuration file management method used templates.
This method had limited flexibility and was cumbersome
to use and maintain between upstream versions.

This change introduces new custom types based on ini_setting:
  * swift_account_config: /etc/swift/account-server.conf
  * swift_bench_config: /etc/swift/swift-bench.conf
  * swift_config: /etc/swift/swift.conf
  * swift_container_config: /etc/swift/container-server.conf
  * swift_dispersion_config: /etc/swift/dispersion.conf
  * swift_object_config: /etc/swift/object-server.conf
  * swift_proxy_config: /etc/swift/proxy-server.conf

The use of ini_setting offers multiple advantages:
  * Ability to individually manage configuration settings without
    the need to modify templates. This allows the user to manage or
    override settings that aren't handled by the module.
  * Use upstream default values if none is provided.
  * Remove the need to maintain and synchronize templates
    to match upstream versions. Such maintenance could become
    problematic and complicated if multiple upstream versions
    are supported but have different base configuration files.

Implements: blueprint puppet-swift-ini-settings
Change-Id: Iba7be64581b81b8ab4f33cf7096df37e64ccc4b4
2013-07-25 10:19:30 -04:00
Dan Prince
ee4a9d4859 Update swift_ring_builder to support replicator...
Updates swift_ring_builder rebalancing parsing to support the
latest upstream replicator_id and replicator_port changes.

This correspondes with swift 1.8+ upstream development.

Fixes LP Bug #1182197.

Change-Id: Ibbaf75ca22cad95b22f9b5f03b547db8c47a9ea4
2013-05-20 15:46:28 -04:00
Mehdi Abaakouk
a9ec8e1c2d Fix swift-ring-builder for swift 1.8
In some case, there are no spaces before - of the balance in swift 1.8.
The change fix this.

/etc/swift/object.builder, build version 9
32768 partitions, 3.000000 replicas, 1 regions, 3 zones, 9 devices, 200.00 balance
The minimum number of hours before a partition can be reassigned is 24
Devices:    id  region  zone      ip address  port      name weight partitions balance meta
             0     1     1      10.68.0.45  6000       sdd 100.00      32768 200.00
             1     1     2      10.68.0.46  6000       sdd 100.00          0-100.00
...

Change-Id: Ic7757a22ce94e4d51ae11780d4626c90a9ed430f
2013-05-02 14:17:26 +02:00
Dan Prince
bee081b5b6 Fix swift_ring_builder output parsing.
Updates the swift_ring_builder so that it parses ring builder output
from the most recent Swift releases correctly (1.7.6 or greated).

Backward compat for the previous parsing is still supported.

Change-Id: I4263b349310e16f6825960805eb27e4bfe3ff002
2013-04-11 11:37:38 -04:00
Dan Bode
09f726c363 Allow multiple devices per endpoint.
Previously, the Puppet modules only supported a single device per
endpoint.

This commits allows multiple devices per endpoint by making the device
name a part of the namevar for the swift ring devices.

it also updates the relevent configs.
2012-06-05 16:45:47 -07:00
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