Whamcloud - gitweb
LU-5030 util: migrate lctl params functions to use cfs_get_paths()
[fs/lustre-release.git] / lustre / tests / test-framework.sh
index a81c609..43b17e9 100755 (executable)
@@ -1116,7 +1116,7 @@ get_osd_param() {
        local name=$3
 
        do_nodes $nodes "$LCTL get_param -n obdfilter.$device.$name \
-               osd-*.$device.$name 2>&1" | grep -v 'Found no match'
+               osd-*.$device.$name 2>&1" | grep -v 'error:'
 }
 
 set_osd_param() {
@@ -1126,7 +1126,7 @@ set_osd_param() {
        local value=$4
 
        do_nodes $nodes "$LCTL set_param -n obdfilter.$device.$name=$value \
-               osd-*.$device.$name=$value 2>&1" | grep -v 'Found no match'
+               osd-*.$device.$name=$value 2>&1" | grep -v 'error:'
 }
 
 set_debug_size () {
@@ -4562,33 +4562,10 @@ set_nodes_failloc () {
 }
 
 cancel_lru_locks() {
-    $LCTL mark "cancel_lru_locks $1 start"
-
-    if [ $1 != "MGC" ]; then
-       for d in $(lctl get_param -N ldlm.namespaces.*.lru_size |
-                egrep -i $1); do
-           $LCTL set_param -n $d=clear
-       done
-       $LCTL get_param ldlm.namespaces.*.lock_unused_count | egrep -i $1 |
-               grep -v '=0'
-    else
-       for d in $(find \
-               /{proc,sys}/fs/lustre/ldlm/namespaces/*$1*/lru_size \
-               2> /dev/null); do
-           echo "clear" > $d
-       done
-
-       for d in $(find \
-               /{proc,sys}/fs/lustre/ldlm/namespaces/*$1*/lock_unused_count \
-               2> /dev/null); do
-           if [ $(cat $d) != 0 ]; then
-               echo "ldlm.namespaces.$(echo "$d" |
-                       cut -f 7 -d'/').lock_unused_count=$(cat $d)"
-           fi
-       done
-    fi
-
-    $LCTL mark "cancel_lru_locks $1 stop"
+       #$LCTL mark "cancel_lru_locks $1 start"
+       $LCTL set_param -n ldlm.namespaces.*$1*.lru_size=clear
+       $LCTL get_param ldlm.namespaces.*$1*.lock_unused_count | grep -v '=0'
+       #$LCTL mark "cancel_lru_locks $1 stop"
 }
 
 default_lru_size()
@@ -6242,6 +6219,31 @@ max_recovery_time() {
        echo -n $service_time
 }
 
+recovery_time_min() {
+       local connection_switch_min=5
+       local connection_switch_inc=5
+       local connection_switch_max
+       local reconnect_delay_max
+       local initial_connect_timeout
+       local max
+       local timout_20
+
+       #connection_switch_max=min(50, max($connection_switch_min,$TIMEOUT)
+       (($connection_switch_min > $TIMEOUT)) &&
+               max=$connection_switch_min || max=$TIMEOUT
+       (($max < 50)) && connection_switch_max=$max || connection_switch_max=50
+
+       #initial_connect_timeout = max(connection_switch_min, obd_timeout/20)
+       timeout_20=$((TIMEOUT/20))
+       (($connection_switch_min > $timeout_20)) &&
+               initial_connect_timeout=$connection_switch_min ||
+               initial_connect_timeout=$timeout_20
+
+       reconnect_delay_max=$((connection_switch_max + connection_switch_inc + \
+                              initial_connect_timeout))
+       echo $((2 * reconnect_delay_max))
+}
+
 get_clients_mount_count () {
     local clients=${CLIENTS:-`hostname`}