swiftonhpss/bin/gluster-swift-gen-builders
Chetan Risbud 4023c7277f gluster-swift-gen-builders behaviour changes
gluster-swift-gen-builders now changes directory to /etc/swift prior to
creating ring files. It does display a message indicating the location of
the ring files.

BUG: 986458

https://bugzilla.redhat.com/show_bug.cgi?id=986458

Change-Id: Iea33c925d98c47c914e8a95d11faa3220967b4d6
Signed-off-by: Chetan Risbud <crisbud@redhat.com>
Reviewed-on: http://review.gluster.org/5658
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Tested-by: Luis Pabon <lpabon@redhat.com>
2013-08-20 04:22:03 -07:00

52 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
# Save the current directory and then cd to /etc/swift
temp_dir=$PWD
cd /etc/swift
for builder_file in $builder_files
do
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
cd $temp_dir
echo "Ring files are prepared in /etc/swift"