diff options
author | Harshavardhana <harsha@harshavardhana.net> | 2014-08-23 02:14:36 -0700 |
---|---|---|
committer | Harshavardhana <harsha@harshavardhana.net> | 2014-09-05 10:04:20 -0700 |
commit | fd500d4396f910e4cf759e0fffa4daf4ed24745a (patch) | |
tree | 2e52c1b64659efc3cf98fed31a8a2fc6f8a4bc26 /tests/dht.rc | |
parent | 88159becd90d40323ecfc24cf40813538c9204cc (diff) |
porting: Provide setfattr/getfattr implementation
- Use 'getfattr' properly avoid redundant options during xattr query
- Untabify certain parts of tests (remove tabs)
- Avoid backtick evaluation for certain values to make code more portable.
- Use awk on FreeBSD/Darwin, since 'wc' implementation is broken and adds
spurious spaces in its output.
Change-Id: I7dcc0b70874e43b4cda8c306ed18a31b7a3f990a
BUG: 1131713
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8520
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Emmanuel Dreyfus <manu@netbsd.org>
Tested-by: Emmanuel Dreyfus <manu@netbsd.org>
Diffstat (limited to 'tests/dht.rc')
-rw-r--r-- | tests/dht.rc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/dht.rc b/tests/dht.rc index 50c4532617e..4d4979ea082 100644 --- a/tests/dht.rc +++ b/tests/dht.rc @@ -1,9 +1,9 @@ #!/bin/bash + function get_layout() { - getfattr -n trusted.glusterfs.dht -e hex $1 2>&1|grep dht |cut -d = -f2 - + getfattr -n trusted.glusterfs.dht -e hex $1 2>&1 | grep dht | cut -d = -f2 } ## populates $BRICK1 and $BRICK2 with hashed/cached subvolume. These will be @@ -15,7 +15,7 @@ function file_has_linkfile() l=0 while [ $k -lt $BRICK_COUNT ] do - stat=`stat $B0/${V0}$k/$1 2>/dev/null` + stat=$(stat $B0/${V0}$k/$1 2>/dev/null) if [ $? -eq 0 ] then let l++ @@ -33,7 +33,7 @@ function get_cached_brick() brick=$BRICK1 while [ $i -lt 3 ] do - test=`getfattr -n trusted.glusterfs.dht.linkto -e text $B0/${V0}$brick/$1 2>&1` + test=$(getfattr -n trusted.glusterfs.dht.linkto -e text $B0/${V0}$brick/$1 2>&1) if [ $? -eq 1 ] then cached=$brick @@ -52,7 +52,7 @@ function get_hashed_brick() brick=$BRICK1 while [ $j -lt 3 ] do - test=`getfattr -n trusted.glusterfs.dht.linkto -e text $B0/${V0}$brick/$1 2>&1` + test=$(getfattr -n trusted.glusterfs.dht.linkto -e text $B0/${V0}$brick/$1 2>&1) if [ $? -eq 0 ] then hashed=$brick @@ -69,7 +69,7 @@ function get_hashed_brick() function rebalance_completed() { val=1 - test=`gluster volume rebalance $V0 status |grep localhost|grep -v "in progress" 2>&1` + test=$(gluster volume rebalance $V0 status | grep localhost | grep -v "in progress" 2>&1) if [ $? -eq 0 ] then val=0 @@ -82,7 +82,7 @@ function rebalance_completed() function remove_brick_completed() { val=1 - test=`gluster volume remove-brick $V0 $H0:$B0/${V0}2 status |grep localhost|grep -v "in progress" 2>&1` + test=$(gluster volume remove-brick $V0 $H0:$B0/${V0}2 status | grep localhost | grep -v "in progress" 2>&1) if [ $? -eq 0 ] then val=0 @@ -95,14 +95,14 @@ function remove_brick_completed() function dht_get_linkto_target() { local path=$1; - echo `getfattr -d -m . -e text --only-values --absolute-names --name=trusted.glusterfs.dht.linkto $path` + echo $(getfattr -e text --only-values --absolute-names -n trusted.glusterfs.dht.linkto $path) } function is_dht_linkfile() { local path=$1 retval=0 - local output=`stat --format=%a $path` + local output=$(stat -c %a $path) if [ $output -eq 1000 ]; then retval=1 fi |