#!/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"