From 376b4044052a4e5d25e2390bbb8c2659028d6b09 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 21 Jan 2013 23:32:38 +0530 Subject: Tests: functions for shd statedump, child_up_status Change-Id: Ifed91d25b7c62e79019ece336e1065fa35beddb0 BUG: 861015 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/4400 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- tests/volume.rc | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/tests/volume.rc b/tests/volume.rc index 9e6671c3..2cae421a 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -34,29 +34,58 @@ function get_mount_process_pid { ps aux | grep glusterfs | grep -E "volfile-id[ =]/?$vol " | awk '{print $2}' | head -1 } -function generate_mount_statedump { - local vol=$1 +function generate_client_statedump { local fpath="" - mount_pid=$(get_mount_process_pid $vol) + client_pid=$1 #remove old stale statedumps - rm -f /tmp/glusterdump.$mount_pid.dump.* 2>/dev/null - kill -USR1 $mount_pid + rm -f /tmp/glusterdump.$client_pid.dump.* 2>/dev/null + kill -USR1 $client_pid #Wait till the statedump is generated sleep 1 - fname=$(ls /tmp | grep -E "glusterdump.$mount_pid.dump.*") + fname=$(ls /tmp | grep -E "glusterdump.$client_pid.dump.*") echo /tmp/$fname } -function afr_child_up_status { +function generate_mount_statedump { + local vol=$1 + generate_client_statedump $(get_mount_process_pid $vol) +} + +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) + local gen_state_dump=$3 + local fpath=$($gen_state_dump $vol) up=$(grep -B1 trusted.afr.$vol-client-$brick_id $fpath | head -1 | cut -f2 -d'=') rm -f $fpath echo "$up" } +function afr_child_up_status { + local vol=$1 + #brick_id is (brick-num in volume info - 1) + local brick_id=$2 + _afr_child_up_status $vol $brick_id generate_mount_statedump +} + +function get_shd_process_pid { + local vol=$1 + ps aux | grep glusterfs | grep -E "glustershd/run/glustershd.pid" | awk '{print $2}' | head -1 +} + +function generate_shd_statedump { + local vol=$1 + generate_client_statedump $(get_shd_process_pid $vol) +} + +function afr_child_up_status_in_shd { + local vol=$1 + #brick_id is (brick-num in volume info - 1) + local brick_id=$2 + _afr_child_up_status $vol $brick_id generate_shd_statedump +} + function glustershd_up_status { gluster volume status | grep "Self-heal Daemon" | awk '{print $6}' } -- cgit