Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

added the ability to retrive the value of mount_ip from /etc/swift/fs.co... #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions bin/gluster-swift-gen-builders
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ declare -A port=(["account.builder"]=6012 ["container.builder"]=6011 \

builder_files="account.builder container.builder object.builder"

mount_ip=`grep -i -P '^\s*mount_ip.+$' /etc/swift/fs.conf|cut -d \= -f 2|awk '{print $1}'`

if [ -z $mount_ip ]; then
mount_ip='127.0.0.1'
else
echo $mount_ip |grep -P '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'
if [ "$?" -gt 0 ]; then
mount_ip=`python -c "import socket; print socket.gethostbyname(\"$mount_ip\")"`
fi
fi

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
swift-ring-builder $1 add z$2-$3:$4/$5_ 100.0
}

function rebalance {
Expand All @@ -39,7 +50,7 @@ do
zone=1
for volname in $@
do
add $builder_file $zone ${port[$builder_file]} $volname
add $builder_file $zone $mount_ip ${port[$builder_file]} $volname
zone=$(expr $zone + 1)
done

Expand Down