aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/swift/swift-base/Dockerfile.j21
-rw-r--r--docker/swift/swift-base/build-swift-ring.py96
2 files changed, 0 insertions, 97 deletions
diff --git a/docker/swift/swift-base/Dockerfile.j2 b/docker/swift/swift-base/Dockerfile.j2
index b4caa5b29..947a243f2 100644
--- a/docker/swift/swift-base/Dockerfile.j2
+++ b/docker/swift/swift-base/Dockerfile.j2
@@ -48,7 +48,6 @@ RUN ln -s swift-base-source/* swift \
COPY swift-rootwrap /var/lib/kolla/venv/bin/swift-rootwrap
COPY rootwrap.conf /etc/swift/rootwrap.conf
COPY swift_sudoers /etc/sudoers.d/kolla_swift_sudoers
-COPY build-swift-ring.py /usr/local/bin/kolla_build_swift_ring
RUN chmod 755 /var/lib/kolla/venv/bin/swift-rootwrap \
&& chmod 644 /etc/swift/rootwrap.conf \
diff --git a/docker/swift/swift-base/build-swift-ring.py b/docker/swift/swift-base/build-swift-ring.py
deleted file mode 100644
index ca42205f8..000000000
--- a/docker/swift/swift-base/build-swift-ring.py
+++ /dev/null
@@ -1,96 +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 # nosec
-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))
- # NOTE(sdake): [0] we expect Operators to run this command and for their
- # environment to be properly secured. Since this is not a network
- # facing tool, there is no risk of untrusted input.
- subprocess.call(cmd) # nosec [0]
-
-
-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(['swift-ring-builder',
- args.ring_file,
- 'create',
- args.part_power,
- args.num_replicas,
- args.min_part_hours])
-
- for i in range(len(hosts)):
- run_cmd(['swift-ring-builder',
- args.ring_file,
- 'add',
- 'z{}-{}/{}'.format(zones[i], hosts[i], devices[i]),
- weights[i]])
-
- run_cmd(['swift-ring-builder', args.ring_file, 'rebalance'])
-
-
-def main():
- args = setup_args()
- run(args)
-
-
-if __name__ == "__main__":
- main()