summaryrefslogtreecommitdiffstats
path: root/tests/afr.rc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/afr.rc')
-rw-r--r--tests/afr.rc54
1 files changed, 47 insertions, 7 deletions
diff --git a/tests/afr.rc b/tests/afr.rc
index 721f24545d5..241789903ba 100644
--- a/tests/afr.rc
+++ b/tests/afr.rc
@@ -1,5 +1,19 @@
#!/bin/bash
+function create_brick_xattrop_entry {
+ local xattrop_dir=$(afr_get_index_path $1)
+ local base_entry=`ls $xattrop_dir|grep xattrop`
+ local gfid_str
+ local params=`echo "$@" | cut -d' ' -f2-`
+ echo $params
+
+ for file in $params
+ do
+ gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $1/$file))
+ ln $xattrop_dir/$base_entry $xattrop_dir/$gfid_str
+ done
+}
+
function diff_dirs {
diff <(ls $1 | sort) <(ls $2 | sort)
}
@@ -71,13 +85,39 @@ function is_file_heal_done {
#count the number of entries marked for self-heal
#in brick $1's index
-function count_sh_entries()
+function count_index_entries()
+{
+ ls $1/.glusterfs/indices/xattrop | wc -l
+}
+
+function afr_up_status()
+{
+ local v=$1
+ local m=$2
+ local replica_id=$3
+ grep -E "^up = " $m/.meta/graphs/active/${v}-replicate-${replica_id}/private | cut -f2 -d'='
+}
+
+function get_quorum_type()
{
- val1=0
- for g in $(ls $1/.glusterfs/indices/xattrop)
- do
- val1=$(( val1 + 1 ))
- done
+ local m="$1"
+ local v="$2"
+ local repl_id="$3"
+ cat $m/.meta/graphs/active/$v-replicate-$repl_id/private|grep quorum-type|awk '{print $3}'
+}
- echo $val1;
+function afr_private_key_value()
+{
+ local v=$1
+ local m=$2
+ local replica_id=$3
+ local key=$4
+#xargs at the end will strip leading spaces
+ grep -E "^${key} = " $m/.meta/graphs/active/${v}-replicate-${replica_id}/private | cut -f2 -d'=' | xargs
+}
+
+function afr_anon_entry_count()
+{
+ local b=$1
+ ls $b/.glusterfs-anonymous-inode* | wc -l
}