diff options
author | Steven Hardy <shardy@redhat.com> | 2016-07-05 18:23:28 +0100 |
---|---|---|
committer | Steven Hardy <shardy@redhat.com> | 2016-07-14 16:19:21 +0100 |
commit | 2adcce7e4bca8b9f208eafd0ca03b120e41af724 (patch) | |
tree | 8f3c18824d25930e2aa9c5bcdf16b2d54c061f36 /manifests/profile/base/swift/add_devices.pp | |
parent | db4e237d527a4f400efba66590d833e6d0e585ef (diff) |
Add swift ringbuilder profile
I think this will need refinement in future, but for now this is
just a copy of what we have in t-h-t
Change-Id: I427f0b5ee93a0870d43419009178e0690ac66bd6
Partially-Implements: blueprint refactor-puppet-manifests
Diffstat (limited to 'manifests/profile/base/swift/add_devices.pp')
-rw-r--r-- | manifests/profile/base/swift/add_devices.pp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/manifests/profile/base/swift/add_devices.pp b/manifests/profile/base/swift/add_devices.pp new file mode 100644 index 0000000..f61f418 --- /dev/null +++ b/manifests/profile/base/swift/add_devices.pp @@ -0,0 +1,59 @@ +# Copyright 2015 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# == Function: tripleo::profile::base::swift::add_devices +# +# Swift add_devices helper function +# +# === Parameters +# +# [*swift_zones*] +# (Optional) The number of swift zones. + +define tripleo::profile::base::swift::add_devices( + $swift_zones = '1' +){ + + # NOTE(dprince): Swift zones is not yet properly wired into the Heat + # templates. See: https://review.openstack.org/#/c/97758/3 + # For now our regex supports the r1z1-192.0.2.6:%PORT%/d1 syntax or the + # newer r1z%<controller or SwiftStorage><N>%-192.0.2.6:%PORT%/d1 syntax. + $server_num_or_device = regsubst($name,'^r1z%+[A-Za-z]*([0-9]+)%+-(.*)$','\1') + if (is_integer($server_num_or_device)) { + $server_num = $server_num_or_device + } else { + $server_num = '1' + } + # Function to place server in its zone. Zone is calculated by + # server number in heat template modulo the number of zones + 1. + $zone = (($server_num%$swift_zones) + 1) + + # add the rings + $base = regsubst($name,'^r1.*-(.*)$','\1') + $object = regsubst($base, '%PORT%', '6000') + ring_object_device { $object: + zone => '1', + weight => 100, + } + $container = regsubst($base, '%PORT%', '6001') + ring_container_device { $container: + zone => '1', + weight => 100, + } + $account = regsubst($base, '%PORT%', '6002') + ring_account_device { $account: + zone => '1', + weight => 100, + } +} |