diff --git a/lustre/tests/cfg/ncli.sh b/lustre/tests/cfg/ncli.sh
index ce95c68d6e1954e56f2b76f0baa86084e595af9f..907775e73917dab164699747700a6bf16561ba40 100644
--- a/lustre/tests/cfg/ncli.sh
+++ b/lustre/tests/cfg/ncli.sh
@@ -3,14 +3,8 @@
 CLIENT1=${CLIENT1:-`hostname`}
 SINGLECLIENT=$CLIENT1
 RCLIENTS=${RCLIENTS:-""}
-CLIENTS=`comma_list $SINGLECLIENT $RCLIENTS`
-REMOTECLIENTS=($RCLIENTS)
-for ((i=0; $i<${#REMOTECLIENTS[@]}; i++)); do
-	varname=CLIENT$((i + 2))
-	eval $varname=${REMOTECLIENTS[i]}
-done
 
-CLIENTCOUNT=$((${#REMOTECLIENTS[@]} + 1))
+init_clients_lists
 
 [ -n "$RCLIENTS" -a "$PDSH" = "no_dsh" ] && \
                 error "tests for remote clients $RCLIENTS needs pdsh != do_dsh " || true
diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh
index 3ee33cc5f8c998b2382b41c3dd62507628cdae38..b1b5df1b6296dc9a2d5c8765bd8ee64f48f4bf6e 100644
--- a/lustre/tests/test-framework.sh
+++ b/lustre/tests/test-framework.sh
@@ -1561,6 +1561,29 @@ nodes_list () {
     echo $myNODES_sort
 }
 
+init_clients_lists () {
+    # Sanity check: exclude the local client from RCLIENTS
+    local rclients=$(echo " $RCLIENTS " | sed -re "s/\s+$HOSTNAME\s+/ /g")
+
+    # Sanity check: exclude the dup entries
+    rclients=$(for i in $rclients; do echo $i; done | sort -u)
+
+    local clients="$SINGLECLIENT $HOSTNAME $rclients"
+
+    # Sanity check: exclude the dup entries from CLIENTS
+    # for those configs which has SINGLCLIENT set to local client 
+    clients=$(for i in $clients; do echo $i; done | sort -u)
+
+    CLIENTS=`comma_list $clients`
+    local -a remoteclients=($rclients)
+    for ((i=0; $i<${#remoteclients[@]}; i++)); do
+            varname=CLIENT$((i + 2))
+            eval $varname=${remoteclients[i]}
+    done
+
+    CLIENTCOUNT=$((${#remoteclients[@]} + 1))
+}
+
 is_patchless ()
 {
     lctl get_param version | grep -q patchless