summaryrefslogtreecommitdiffstats
path: root/tests/volume.rc
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2012-12-04 18:22:33 +0530
committerAnand Avati <avati@redhat.com>2012-12-04 14:50:13 -0800
commitd1bb60ad794dcf0fc8bf0cf8dc4ac13349d749d4 (patch)
tree9ea5f6b952c8cce3c867d4203fba2b79227e6b97 /tests/volume.rc
parent0adc7fd1a76e6868a940cc0725c2f8d93cbb9f29 (diff)
tests: Util commands for rebalance and afr child-up, shd up
Change-Id: I175171524b750dff5b2ec0c11dc006d77123ecd5 BUG: 858212 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/4237 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'tests/volume.rc')
-rw-r--r--tests/volume.rc40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/volume.rc b/tests/volume.rc
index 55c96b3ad..268887416 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -20,3 +20,43 @@ function volume_option()
local key=$2
$CLI volume info $vol | egrep "^$key: " | cut -f2 -d' ';
}
+
+function rebalance_status_completed_field {
+ $CLI volume rebalance $V0 status | awk '{print $6}' | sed -n 3p
+}
+
+function remove_brick_status_completed_field {
+ $CLI volume remove-brick $V0 $H0:$B0/r2d2_{4,5} status | awk '{print $6}' | sed -n 3p
+}
+
+function get_mount_process_pid {
+ local vol=$1
+ ps aux | grep glusterfs | grep -E "volfile-id[ =]/?$vol " | awk '{print $2}' | head -1
+}
+
+function generate_mount_statedump {
+ local vol=$1
+ local fpath=""
+ mount_pid=$(get_mount_process_pid $vol)
+ #remove old stale statedumps
+ rm -f /tmp/glusterdump.$mount_pid.dump.* 2>/dev/null
+ kill -USR1 $mount_pid
+ #Wait till the statedump is generated
+ sleep 1
+ fname=$(ls /tmp | grep -E "glusterdump.$mount_pid.dump.*")
+ echo /tmp/$fname
+}
+
+function afr_child_up_status {
+ local vol=$1
+ #brick_id is (brick-num in volume info - 1)
+ local brick_id=$2
+ local fpath=$(generate_mount_statedump $vol)
+ up=$(grep -B1 trusted.afr.$vol-client-$brick_id $fpath | head -1 | cut -f2 -d'=')
+ rm -f $fpath
+ echo "$up"
+}
+
+function glustershd_up_status {
+ gluster volume status | grep "Self-heal Daemon" | awk '{print $6}'
+}