From 2dbc9a53a1a8149f6a4fdcfd1be4a632f65d6e83 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 6 Feb 2013 08:39:41 +0530 Subject: tests: Added function to generate brick statedump Change-Id: I5f394a028a3251ec673c8787b2c67691a8b57449 BUG: 908146 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/4470 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- tests/volume.rc | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/tests/volume.rc b/tests/volume.rc index 9d579aa2..9daf560b 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -39,21 +39,21 @@ function get_mount_process_pid { ps aux | grep glusterfs | grep -E "volfile-id[ =]/?$vol " | awk '{print $2}' | head -1 } -function generate_client_statedump { +function generate_statedump { local fpath="" - client_pid=$1 + pid=$1 #remove old stale statedumps - rm -f $statedumpdir/glusterdump.$client_pid.dump.* 2>/dev/null - kill -USR1 $client_pid + rm -f "$statedumpdir/*$pid.dump.*" + kill -USR1 $pid #Wait till the statedump is generated sleep 1 - fname=$(ls $statedumpdir | grep -E "glusterdump.$client_pid.dump.*") + fname=$(ls $statedumpdir | grep -E "*$pid.dump.*") echo $statedumpdir/$fname } function generate_mount_statedump { local vol=$1 - generate_client_statedump $(get_mount_process_pid $vol) + generate_statedump $(get_mount_process_pid $vol) } function _afr_child_up_status { @@ -81,7 +81,14 @@ function get_shd_process_pid { function generate_shd_statedump { local vol=$1 - generate_client_statedump $(get_shd_process_pid $vol) + generate_statedump $(get_shd_process_pid $vol) +} + +function generate_brick_statedump { + local vol=$1 + local host=$2 + local brick=$3 + generate_statedump $(get_brick_pid $vol $host $brick) } function afr_child_up_status_in_shd { @@ -96,17 +103,17 @@ function glustershd_up_status { } function get_brick_pid { - vol=$1 - host=$2 - brick=$3 - brick_hiphenated=$(echo $brick | tr '/' '-') + local vol=$1 + local host=$2 + local brick=$3 + local brick_hiphenated=$(echo $brick | tr '/' '-') echo `cat /var/lib/glusterd/vols/$vol/run/${host}${brick_hiphenated}.pid` } function kill_brick { - vol=$1 - host=$2 - brick=$3 + local vol=$1 + local host=$2 + local brick=$3 kill -9 $(get_brick_pid $vol $host $brick) } -- cgit