Multiple changes in 'gluster-swift-gen-builder'
script now does some validation on accountnames and does not put forward anything on screen unless asked verbose, '-v'. Help text is also added and can be used with '-h' option. Bug: 1001033 https://bugzilla.redhat.com/show_bug.cgi?id=1001033 Change-Id: I26af27fc96c1b1b0b84319d8b8453dfa075a8c55 Signed-off-by: Chetan Risbud <crisbud@redhat.com> Reviewed-on: http://review.gluster.org/6121 Reviewed-by: Luis Pabon <lpabon@redhat.com> Tested-by: Luis Pabon <lpabon@redhat.com>
This commit is contained in:
parent
f8ae648c6d
commit
d65cee2e3b
@ -5,6 +5,30 @@
|
|||||||
declare -A port=(["account.builder"]=6012 ["container.builder"]=6011 \
|
declare -A port=(["account.builder"]=6012 ["container.builder"]=6011 \
|
||||||
["object.builder"]=6010)
|
["object.builder"]=6010)
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
echo "
|
||||||
|
NAME
|
||||||
|
gluster-swift-gen-builders - Registers GlusterFS volumes to be accessed by
|
||||||
|
object storage.
|
||||||
|
SYNOPSIS
|
||||||
|
gluster-swift-gen-builders [-v] [-h] volumes...
|
||||||
|
DESCRIPTION
|
||||||
|
Register GlusterFS volumes to be accessed over OpenStack Swift object
|
||||||
|
storage.
|
||||||
|
OPTIONS
|
||||||
|
-v or --verbose
|
||||||
|
Verbose
|
||||||
|
-h or --help
|
||||||
|
Prints help screen
|
||||||
|
EXAMPLES
|
||||||
|
gluster-swift-gen-builders myvol1 myvol2
|
||||||
|
-Creates new ring files with myvol1 and myvol2
|
||||||
|
|
||||||
|
gluster-swift-gen-builders myvol2
|
||||||
|
-Creates new ring files by removing myvol1
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
builder_files="account.builder container.builder object.builder"
|
builder_files="account.builder container.builder object.builder"
|
||||||
|
|
||||||
function create {
|
function create {
|
||||||
@ -23,13 +47,27 @@ function build {
|
|||||||
swift-ring-builder $1
|
swift-ring-builder $1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1x" = "x" ]; then
|
verbose=0
|
||||||
|
outdev="/dev/null"
|
||||||
|
|
||||||
|
if [ "$1" = "-v" ] || [ "$1" = "--verbose" ]; then
|
||||||
|
verbose=1
|
||||||
|
outdev="/dev/stdout"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "x$1" = "x" ]; then
|
||||||
echo "Please specify the gluster volume name to use."
|
echo "Please specify the gluster volume name to use."
|
||||||
|
print_usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Save the current directory and then cd to /etc/swift
|
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||||
temp_dir=$PWD
|
print_usage
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
cd /etc/swift
|
cd /etc/swift
|
||||||
|
|
||||||
for builder_file in $builder_files
|
for builder_file in $builder_files
|
||||||
@ -39,13 +77,13 @@ do
|
|||||||
zone=1
|
zone=1
|
||||||
for volname in $@
|
for volname in $@
|
||||||
do
|
do
|
||||||
add $builder_file $zone ${port[$builder_file]} $volname
|
add $builder_file $zone ${port[$builder_file]} $volname >& $outdev
|
||||||
zone=$(expr $zone + 1)
|
zone=$(expr $zone + 1)
|
||||||
done
|
done
|
||||||
|
|
||||||
rebalance $builder_file
|
rebalance $builder_file >& $outdev
|
||||||
build $builder_file
|
build $builder_file >& $outdev
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
cd $temp_dir
|
echo "Ring files are prepared in /etc/swift. Please restart object store services"
|
||||||
echo "Ring files are prepared in /etc/swift"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user