aboutsummaryrefslogtreecommitdiff
path: root/docker/common/swift/swift-base
diff options
context:
space:
mode:
authorSteven Dake <stdake@cisco.com>2015-08-27 19:03:59 -0700
committerSteven Dake <stdake@cisco.com>2015-08-28 00:50:30 -0700
commit26d0d8d2fbb5f52d0b5a35e0627fb0a61f529852 (patch)
tree43a7f4f6bc11ec71d761000f0155e6b64e3649d1 /docker/common/swift/swift-base
parenteef32f0353d5cee9b4bb876767aab5c8298375eb (diff)
downloadkolla-26d0d8d2fbb5f52d0b5a35e0627fb0a61f529852.tar.gz
kolla-26d0d8d2fbb5f52d0b5a35e0627fb0a61f529852.zip
Move scripts for swift to docker_templates
Change-Id: Ia1bcc94fd58bbfec980bfacbd7acb885a17f9056 Partially-Implements: blueprint remove-docker-dir
Diffstat (limited to 'docker/common/swift/swift-base')
-rw-r--r--docker/common/swift/swift-base/build-swift-ring.py93
-rwxr-xr-xdocker/common/swift/swift-base/config-swift.sh3
2 files changed, 0 insertions, 96 deletions
diff --git a/docker/common/swift/swift-base/build-swift-ring.py b/docker/common/swift/swift-base/build-swift-ring.py
deleted file mode 100644
index d7386392d..000000000
--- a/docker/common/swift/swift-base/build-swift-ring.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2015 Paul Bourke
-#
-# 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.
-
-"""
-This script is a simple wrapper used to create and rebalance Swift ring files.
-"""
-
-import argparse
-import subprocess
-import sys
-
-
-def setup_args():
- parser = argparse.ArgumentParser()
- parser.add_argument("-f", "--ring-file",
- required=True,
- help="Path to ring file")
- parser.add_argument("-p", "--part-power",
- required=True,
- help="Part power")
- parser.add_argument("-r", "--num-replicas",
- required=True,
- help="Number of replicas")
- parser.add_argument("-m", "--min-part-hours",
- required=True,
- help="Min part hours")
- parser.add_argument("-H", "--hosts",
- required=True,
- help="Hosts in the ring, comma delimited")
- parser.add_argument("-w", "--weights",
- required=True,
- help="Weight of each host, comma delimited")
- parser.add_argument("-d", "--devices",
- required=True,
- help="Device on each host, comma delimited")
- parser.add_argument("-z", "--zones",
- required=True,
- help="Zone of each host, comma delimited")
- return parser.parse_args()
-
-
-def run_cmd(cmd):
- print(' '.join(cmd))
- subprocess.call(cmd)
-
-
-def run(args):
- hosts = args.hosts.split(',')
- weights = args.weights.split(',')
- zones = args.zones.split(',')
- devices = args.devices.split(',')
- if not (len(hosts) == len(weights) == len(zones) == len(devices)):
- print('Error: an equal amount of hosts, devices, weights, '
- 'and zones are required')
- sys.exit(1)
-
- run_cmd(['/usr/bin/swift-ring-builder',
- args.ring_file,
- 'create',
- args.part_power,
- args.num_replicas,
- args.min_part_hours])
-
- for i in xrange(len(hosts)):
- run_cmd(['/usr/bin/swift-ring-builder',
- args.ring_file,
- 'add',
- 'z{}-{}/{}'.format(zones[i], hosts[i], devices[i]),
- weights[i]])
-
- run_cmd(['/usr/bin/swift-ring-builder', args.ring_file, 'rebalance'])
-
-
-def main():
- args = setup_args()
- run(args)
-
-
-if __name__ == "__main__":
- main()
diff --git a/docker/common/swift/swift-base/config-swift.sh b/docker/common/swift/swift-base/config-swift.sh
deleted file mode 100755
index b101b4e69..000000000
--- a/docker/common/swift/swift-base/config-swift.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-chown -R swift: /srv/node