swiftonhpss/bin/gluster-swift-gen-builders
Chetan Risbud 7ef1581a07 gluster-swift-gen-builders behaviour changes
gluster-swift-gen-builders copies the older ring files to
/etc/swift/backup_ring. And then creates the new ring files to /etc/swift

BUG: 986458

Change-Id: I06e93179e46da56d5046419e66c8864aa08f184d
Signed-off-by: Chetan Risbud <crisbud@redhat.com>
Reviewed-on: http://review.gluster.org/5384
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Tested-by: Luis Pabon <lpabon@redhat.com>
2013-07-24 18:09:21 -07:00

51 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Note that these port numbers must match the configured values for the
# various servers in their configuration files.
declare -A port=(["account.builder"]=6012 ["container.builder"]=6011 \
["object.builder"]=6010)
builder_files="account.builder container.builder object.builder"
function create {
swift-ring-builder $1 create 1 1 1 >> /tmp/out
}
function add {
swift-ring-builder $1 add z$2-127.0.0.1:$3/$4_ 100.0
}
function rebalance {
swift-ring-builder $1 rebalance
}
function build {
swift-ring-builder $1
}
if [ "$1x" = "x" ]; then
echo "Please specify the gluster volume name to use."
exit 1
fi
for builder_file in $builder_files
do
mkdir /etc/swift/backup_rings
chmod +w /etc/swift/backup_rings
cp /etc/swift/*.ring.gz /etc/swift/backup_rings
cd /etc/swift
create $builder_file
zone=1
for volname in $@
do
add $builder_file $zone ${port[$builder_file]} $volname
zone=$(expr $zone + 1)
done
rebalance $builder_file
build $builder_file
done