kolla-ansible/tests/init-swift.sh
Martin Hiner 53e8b80ed3 Add container engine option to scripts
This patch add a way to choose container engine inside tool and test
scripts. This is in preparation for Podman introduction but still
leaves Docker as default container engine.

Signed-off-by: Martin Hiner <m.hiner@partner.samsung.com>
Change-Id: I395d2bdb0dfb4b325b6ad197c8893c8a0f768324
2023-04-28 16:16:55 +02:00

58 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
set -o xtrace
set -o errexit
function init_swift_logged {
next_port=6000
# the order is important due to port incrementation
for ring in object account container; do
# create the *.builder files
sudo ${CONTAINER_ENGINE} run \
--rm \
-v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
$KOLLA_SWIFT_BASE_IMAGE \
swift-ring-builder \
/etc/kolla/config/swift/$ring.builder create 10 3 1
# add nodes to them
for node in ${STORAGE_NODES[@]}; do
sudo ${CONTAINER_ENGINE} run \
--rm \
-v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
$KOLLA_SWIFT_BASE_IMAGE \
swift-ring-builder \
/etc/kolla/config/swift/$ring.builder add r1z1-${node}:$next_port/d0 1
done
# create the *.ring.gz files
sudo ${CONTAINER_ENGINE} run \
--rm \
-v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
$KOLLA_SWIFT_BASE_IMAGE \
swift-ring-builder \
/etc/kolla/config/swift/$ring.builder rebalance
# display contents for debugging
sudo ${CONTAINER_ENGINE} run \
--rm \
-v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
$KOLLA_SWIFT_BASE_IMAGE \
swift-ring-builder \
/etc/kolla/config/swift/$ring.builder
# next ring = next port
next_port=$((next_port+1))
done
}
function init_swift {
echo "Initialising Swift"
init_swift_logged &> /tmp/logs/ansible/init-swift
}
init_swift