2019-11-27 18:16:03 +01:00
|
|
|
#!/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
|
2022-11-21 18:38:57 +01:00
|
|
|
sudo ${CONTAINER_ENGINE} run \
|
2019-11-27 18:16:03 +01:00
|
|
|
--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
|
2022-11-21 18:38:57 +01:00
|
|
|
sudo ${CONTAINER_ENGINE} run \
|
2019-11-27 18:16:03 +01:00
|
|
|
--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
|
2022-11-21 18:38:57 +01:00
|
|
|
sudo ${CONTAINER_ENGINE} run \
|
2019-11-27 18:16:03 +01:00
|
|
|
--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
|
2022-11-21 18:38:57 +01:00
|
|
|
sudo ${CONTAINER_ENGINE} run \
|
2019-11-27 18:16:03 +01:00
|
|
|
--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
|
2020-04-24 15:57:55 +02:00
|
|
|
next_port=$((next_port+1))
|
2019-11-27 18:16:03 +01:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function init_swift {
|
|
|
|
echo "Initialising Swift"
|
|
|
|
init_swift_logged &> /tmp/logs/ansible/init-swift
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
init_swift
|