Whamcloud - gitweb
b=14471
authorgrev <grev>
Wed, 17 Sep 2008 15:25:37 +0000 (15:25 +0000)
committergrev <grev>
Wed, 17 Sep 2008 15:25:37 +0000 (15:25 +0000)
i=Adilger
replace proc with lctl [set|get]_param

lustre/tests/sanity-gss.sh
lustre/tests/sanity-lmv.sh
lustre/tests/sanity-sec.sh
lustre/tests/sanityN.sh

index f1a9c26..40390b0 100644 (file)
@@ -58,6 +58,8 @@ cnt_all2mdt=0
 cnt_all2all=0
 DBENCH_PID=0
 PROC_CLI="srpc.info"
+# Escape "." to use lctl
+PROC_CLI=${PROC_CLI//\./\*} 
 
 # set manually
 GSS=true
@@ -183,7 +185,7 @@ flvr_cnt_cli2mdt()
 {
     local flavor=$1
 
-    output=`do_facet client cat $LPROC/mdc/*-MDT*-mdc-*/$PROC_CLI 2>/dev/null`
+    output=`do_facet client lctl get_param -n mdc.*-MDT*-mdc-*.$PROC_CLI 2>/dev/null`
     count_flvr "$output" $flavor
 }
 
@@ -191,7 +193,7 @@ flvr_cnt_cli2ost()
 {
     local flavor=$1
 
-    output=`do_facet client cat $LPROC/osc/*OST*-osc-[^M][^D][^T]*/$PROC_CLI 2>/dev/null`
+    output=`do_facet client lctl get_param -n osc.*OST*-osc-[^M][^D][^T]*.$PROC_CLI 2>/dev/null`
     count_flvr "$output" $flavor
 }
 
@@ -206,7 +208,7 @@ flvr_cnt_mdt2mdt()
     fi
 
     for num in `seq $MDSCOUNT`; do
-        output=`do_facet mds$num cat $LPROC/mdc/*-MDT*-mdc[0-9]*/$PROC_CLI 2>/dev/null`
+        output=`do_facet mds$num lctl get_param -n mdc.*-MDT*-mdc[0-9]*.$PROC_CLI 2>/dev/null`
         tmpcnt=`count_flvr "$output" $flavor`
         cnt=$((cnt + tmpcnt))
     done
@@ -219,7 +221,7 @@ flvr_cnt_mdt2ost()
     local cnt=0
 
     for num in `seq $MDSCOUNT`; do
-        output=`do_facet mds$num cat $LPROC/osc/*OST*-osc-MDT*/$PROC_CLI 2>/dev/null`
+        output=`do_facet mds$num lctl get_param -n osc.*OST*-osc-MDT*.$PROC_CLI 2>/dev/null`
         tmpcnt=`count_flvr "$output" $flavor`
         cnt=$((cnt + tmpcnt))
     done
@@ -284,16 +286,16 @@ wait_flavor()
 
 restore_to_default_flavor()
 {
-    local proc=$LPROC/mgs/MGS/live/$FSNAME
+    local proc="mgs.MGS.live.$FSNAME"
 
     echo "restoring to default flavor..."
 
-    nrule=`do_facet mgs cat $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
+    nrule=`do_facet mgs lctl get_param -n $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
 
     # remove all existing rules if any
     if [ $nrule -ne 0 ]; then
         echo "$nrule existing rules"
-        for rule in `do_facet mgs cat $proc 2>/dev/null | grep ".srpc.flavor."`; do
+        for rule in `do_facet mgs lctl get_param -n $proc 2>/dev/null | grep ".srpc.flavor."`; do
             echo "remove rule: $rule"
             spec=`echo $rule | awk -F = '{print $1}'`
             do_facet mgs "$LCTL conf_param $spec="
@@ -301,7 +303,7 @@ restore_to_default_flavor()
     fi
 
     # verify no rules left
-    nrule=`do_facet mgs cat $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
+    nrule=`do_facet mgs lctl get_param -n $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
     [ $nrule -ne 0 ] && error "still $nrule rules left"
 
     # wait for default flavor to be applied
@@ -788,7 +790,7 @@ test_99() {
     #
     # general rules
     #
-    nrule_old=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
+    nrule_old=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
                | grep "$FSNAME.srpc.flavor." | wc -l`
     echo "original general rules: $nrule_old"
 
@@ -800,7 +802,7 @@ test_99() {
         set_rule $FSNAME elan$i any || error "remove rule $i"
     done
 
-    nrule_new=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
+    nrule_new=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
                | grep "$FSNAME.srpc.flavor." | wc -l`
     if [ $nrule_new != $nrule_old ]; then
         error "general rule: $nrule_new != $nrule_old"
@@ -809,7 +811,7 @@ test_99() {
     #
     # target-specific rules
     #
-    nrule_old=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
+    nrule_old=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
                | grep "$FSNAME-MDT0000.srpc.flavor." | wc -l`
     echo "original target rules: $nrule_old"
 
@@ -821,7 +823,7 @@ test_99() {
         set_rule $FSNAME-MDT0000 elan$i any || error "remove rule $i"
     done
 
-    nrule_new=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
+    nrule_new=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
                | grep "$FSNAME-MDT0000.srpc.flavor." | wc -l`
     if [ $nrule_new != $nrule_old ]; then
         error "general rule: $nrule_new != $nrule_old"
index 490b338..faa4b92 100644 (file)
@@ -81,10 +81,10 @@ trace() {
 TRACE=${TRACE:-""}
 
 check_kernel_version() {
-       VERSION_FILE=$LPROC/version
+       VERSION_FILE=version
        WANT_VER=$1
        [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
-       GOT_VER=$(awk '/kernel:/ {print $2}' $VERSION_FILE)
+       GOT_VER=$(lctl get_param $VERSION_FILE | awk '/kernel:/ {print $2}')
        [ $GOT_VER -ge $WANT_VER ] && return 0
        log "test needs at least kernel version $WANT_VER, running $GOT_VER"
        return 1
@@ -201,13 +201,13 @@ fi
 DIR=${DIR:-$MOUNT}
 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
 
-LOVNAME=`cat $LPROC/llite/*/lov/common_name | tail -n 1`
-OSTCOUNT=`cat $LPROC/lov/$LOVNAME/numobd`
-STRIPECOUNT=`cat $LPROC/lov/$LOVNAME/stripecount`
-STRIPESIZE=`cat $LPROC/lov/$LOVNAME/stripesize`
-ORIGFREE=`cat $LPROC/lov/$LOVNAME/kbytesavail`
+LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
+OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
+STRIPECOUNT=`lctl get_param -n lov.$LOVNAME.stripecount`
+STRIPESIZE=`lctl get_param -n lov.$LOVNAME.stripesize`
+ORIGFREE=`lctl get_param -n  lov.$LOVNAME.kbytesavail`
 MAXFREE=${MAXFREE:-$((200000 * $OSTCOUNT))}
-MDS=$(\ls $LPROC/mdt 2> /dev/null | grep -v num_refs | tail -n 1)
+MDS=$(lctl get_param -N mdt.* | grep -v num_refs | tail -n 1 | cut -d"." -f2)
 
 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
@@ -393,11 +393,15 @@ test_5a() {
        cancel_lru_locks osc
         dd if=$MOUNT2/$tdir/d2/f1 of=/dev/null
         stat $MOUNT2/$tdir/d2 $MOUNT2/$tdir/d2/f1 > /dev/null
-        can1=`awk '/ldlm_cancel/ {print $2}' /proc/fs/lustre/ldlm/services/ldlm_canceld/stats`
-        blk1=`awk '/ldlm_bl_callback/ {print $2}' /proc/fs/lustre/ldlm/services/ldlm_cbd/stats`
+        can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
+              awk '/ldlm_cancel/ {print $2}'`
+        blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
+              awk '/ldlm_bl_callback/ {print $2}'`
         unlink $MOUNT2/$tdir/d2/f1
-        can2=`awk '/ldlm_cancel/ {print $2}' /proc/fs/lustre/ldlm/services/ldlm_canceld/stats`
-        blk2=`awk '/ldlm_bl_callback/ {print $2}' /proc/fs/lustre/ldlm/services/ldlm_cbd/stats`
+        can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
+              awk '/ldlm_cancel/ {print $2}'`
+        blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
+              awk '/ldlm_bl_callback/ {print $2}'`
         umount $MOUNT2
         [ $can1 -eq $can2 ] && error "It does not look like a cross-ref file."
         [ $[$can1+1] -eq $can2 ] || error $[$[$can2-$can1]] "cancel RPC occured."
@@ -415,11 +419,15 @@ test_5b() {
        cancel_lru_locks osc
         dd if=$MOUNT2/$tdir/d1/f1 of=/dev/null
         stat $MOUNT2/$tdir/d1/f1 $MOUNT2/$tdir/d2 > /dev/null
-        can1=`awk '/ldlm_cancel/ {print $2}' /proc/fs/lustre/ldlm/services/ldlm_canceld/stats`
-        blk1=`awk '/ldlm_bl_callback/ {print $2}' /proc/fs/lustre/ldlm/services/ldlm_cbd/stats`
+        can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
+              awk '/ldlm_cancel/ {print $2}'`
+        blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
+              awk '/ldlm_bl_callback/ {print $2}'`
         ln $MOUNT2/$tdir/d1/f1 $MOUNT2/$tdir/d2/f2
-        can2=`awk '/ldlm_cancel/ {print $2}' /proc/fs/lustre/ldlm/services/ldlm_canceld/stats`
-        blk2=`awk '/ldlm_bl_callback/ {print $2}' /proc/fs/lustre/ldlm/services/ldlm_cbd/stats`
+        can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats |
+              awk '/ldlm_cancel/ {print $2}'`
+        blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats |
+              awk '/ldlm_bl_callback/ {print $2}'`
         umount $MOUNT2
         [ $can1 -eq $can2 ] && error "It does not look like a cross-ref file."
         [ $[$can1+1] -eq $can2 ] || error $[$[$can2-$can1]] "cancel RPC occured."
index e2a8d51..523ecdd 100644 (file)
@@ -22,11 +22,6 @@ RUNAS=${RUNAS:-"$LUSTRE/tests/runas"}
 WTL=${WTL:-"$LUSTRE/tests/write_time_limit"}
 
 PERM_CONF=/etc/lustre/perm.conf
-LLITE_LPROC=$LPROC/llite
-MDC_LPROC=$LPROC/mdc
-MDT_LPROC=$LPROC/mdt
-OST_LPROC=$LPROC/obdfilter
-
 SANITYSECLOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
 FAIL_ON_ERROR=false
 
@@ -63,15 +58,15 @@ else
        echo "without GSS support"
 fi
 
-MDT="`do_facet $SINGLEMDS find $MDT_LPROC/ -name \*MDT\* -printf %f 2>/dev/null || true`"
+MDT="`do_facet $SINGLEMDS "lctl get_param -N mdt.\*MDT\*/stats | cut -d"." -f2" || true`"
 if [ ! -z "$MDT" ]; then
-       IDENTITY_FLUSH=$MDT_LPROC/$MDT/identity_flush
-       MDSCAPA=$MDT_LPROC/$MDT/capa
-       CAPA_TIMEOUT=$MDT_LPROC/$MDT/capa_timeout
+       IDENTITY_FLUSH=mdt.$MDT.identity_flush
+       MDSCAPA=mdt.$MDT.capa
+       CAPA_TIMEOUT=mdt.$MDT.capa_timeout
 fi
 
 # for CLIENT_TYPE
-if [ -z "$(grep remote $LLITE_LPROC/*/client_type 2>/dev/null)" ]; then
+if [ -z "$(lctl get_param -n llite.*.client_type | grep remote 2>/dev/null)" ]; then
        CLIENT_TYPE="local"
        echo "local client"
 else
@@ -149,7 +144,7 @@ test_1() {
                skip "test_1 for local client only" && return
 
        do_facet $SINGLEMDS "rm -f $PERM_CONF"
-       do_facet $SINGLEMDS "echo -1 > $IDENTITY_FLUSH"
+       do_facet $SINGLEMDS "lctl set_param -n $IDENTITY_FLUSH=-1"
 
        rm -rf $DIR/d1
        mkdir $DIR/d1
@@ -158,7 +153,7 @@ test_1() {
        $RUNAS -u $ID1 -v $ID0 touch $DIR/d1/f0 && error "touch (2)"
        do_facet $SINGLEMDS "echo '* $ID1 setuid' > $PERM_CONF"
        echo "enable uid $ID1 setuid"
-       do_facet $SINGLEMDS "echo -1 > $IDENTITY_FLUSH"
+       do_facet $SINGLEMDS "lctl set_param -n $IDENTITY_FLUSH=-1"
        $RUNAS -u $ID1 -v $ID0 touch $DIR/d1/f1 || error "touch (3)"
 
        chown root $DIR/d1 || error "chown (4)"
@@ -168,14 +163,14 @@ test_1() {
        $RUNAS -u $ID1 -g $ID1 -j $ID0 touch $DIR/d1/f3 && error "touch (8)"
        do_facet $SINGLEMDS "echo '* $ID1 setuid,setgid' > $PERM_CONF"
        echo "enable uid $ID1 setuid,setgid"
-       do_facet $SINGLEMDS "echo -1 > $IDENTITY_FLUSH"
+       do_facet $SINGLEMDS "lctl set_param -n $IDENTITY_FLUSH=-1"
        $RUNAS -u $ID1 -g $ID1 -j $ID0 touch $DIR/d1/f4 || error "touch (9)"
        $RUNAS -u $ID1 -v $ID0 -g $ID1 -j $ID0 touch $DIR/d1/f5 || error "touch (10)"
 
        rm -rf $DIR/d1
 
        do_facet $SINGLEMDS "rm -f $PERM_CONF"
-       do_facet $SINGLEMDS "echo -1 > $IDENTITY_FLUSH"
+       do_facet $SINGLEMDS "lctl set_param -n $IDENTITY_FLUSH=-1"
 }
 run_test 1 "setuid/gid ============================="
 
@@ -189,7 +184,7 @@ run_rmtacl_subtest() {
 test_2 () {
        [ "$CLIENT_TYPE" = "local" ] && \
                skip "remote_acl for remote client only" && return
-       [ -z "$(grep ^acl $MDC_LPROC/*-mdc-*/connect_flags)" ] && \
+       [ -z "$(lctl get_param -n mdc.*-mdc-*.connect_flags | grep ^acl)" ] && \
                skip "must have acl enabled" && return
        [ -z "$(which setfacl 2>/dev/null)" ] && \
                skip "could not find setfacl" && return
@@ -206,7 +201,7 @@ test_2 () {
 
        if [ ! -z "$MDT" ]; then
                do_facet $SINGLEMDS "echo '* 0 rmtacl' > $PERM_CONF"
-               do_facet $SINGLEMDS "echo -1 > $IDENTITY_FLUSH"
+               do_facet $SINGLEMDS "lctl set_param -n $IDENTITY_FLUSH=-1"
        fi
 
         if lfs rgetfacl $DIR; then
@@ -233,7 +228,7 @@ test_2 () {
 
        if [ ! -z "$MDT" ]; then
                do_facet $SINGLEMDS "rm -f $PERM_CONF"
-               do_facet $SINGLEMDS "echo -1 > $IDENTITY_FLUSH"
+               do_facet $SINGLEMDS "lctl set_param -n $IDENTITY_FLUSH=-1"
        fi
 
        cd $SAVE_PWD
@@ -261,12 +256,12 @@ test_4() {
        if [ "$CLIENT_TYPE" != "remote" ]; then
                if [ ! -z "$MDT" ]; then
                        do_facet $SINGLEMDS "echo '* $ID1 setgrp' > $PERM_CONF"
-                       do_facet $SINGLEMDS "echo -1 > $IDENTITY_FLUSH"
+                       do_facet $SINGLEMDS "lctl set_param -n $IDENTITY_FLUSH=-1"
                fi
                $RUNAS -u $ID1 -G1,2,$ID0 ls $DIR/d4 || error "setgroups (2)"
                if [ ! -z "$MDT" ]; then
                        do_facet $SINGLEMDS "rm -f $PERM_CONF"
-                       do_facet $SINGLEMDS "echo -1 > $IDENTITY_FLUSH"
+                       do_facet $SINGLEMDS "lctl set_param -n $IDENTITY_FLUSH=-1"
                fi
        fi
        $RUNAS -u $ID1 -G1,2 ls $DIR/d4 && error "setgroups (3)"
@@ -278,7 +273,7 @@ mds_capability_timeout() {
         [ $# -lt 1 ] && echo "Miss mds capability timeout value" && return 1
 
         echo "Set mds capability timeout as $1 seconds"
-       do_facet $SINGLEMDS "echo $1 > $CAPA_TIMEOUT"
+       do_facet $SINGLEMDS "lctl set_param -n $CAPA_TIMEOUT=$1"
         return 0
 }
 
@@ -291,7 +286,7 @@ mds_capability_switch() {
                 *) echo "Invalid mds capability switch value" && return 2;;
         esac
 
-       do_facet $SINGLEMDS "echo $1 > $MDSCAPA"
+       do_facet $SINGLEMDS "lctl set_param -n $MDSCAPA=$1"
         return 0
 }
 
@@ -306,8 +301,8 @@ oss_capability_switch() {
 
        for i in `seq $OSTCOUNT`; do
                local j=`expr $i - 1`
-               local OST="`do_facet ost$i find $OST_LPROC/ -name \*OST\*$j -printf %f 2>/dev/null || true`"
-               do_facet ost$i "echo $1 > $OST_LPROC/$OST/capa"
+               local OST="`do_facet ost$i "lctl get_param -N obdfilter.\*OST\*$j/stats | cut -d"." -f2" || true`"
+               do_facet ost$i "lctl set_param -n obdfilter.$OST.capa=$1"
        done
         return 0
 }
index 3edb02f..0602ca4 100644 (file)
@@ -54,13 +54,10 @@ FAIL_ON_ERROR=false
 SETUP=${SETUP:-:}
 TRACE=${TRACE:-""}
 
-LPROC=/proc/fs/lustre
-
 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
 
 check_and_setup_lustre
 
-LPROC=/proc/fs/lustre
 LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
 OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
 
@@ -360,10 +357,8 @@ run_test 18 "mmap sanity check ================================="
 test_19() { # bug3811
        [ -d /proc/fs/lustre/obdfilter ] || return 0
 
-       MAX=`cat /proc/fs/lustre/obdfilter/*/readcache_max_filesize | head -n 1`
-       for O in /proc/fs/lustre/obdfilter/*OST*; do
-               echo 4096 > $O/readcache_max_filesize
-       done
+       MAX=`lctl get_param -n obdfilter.*.readcache_max_filesize | head -n 1`
+       lctl set_param -n obdfilter.*OST*.readcache_max_filesize=4096
        dd if=/dev/urandom of=$TMP/f19b bs=512k count=32
        SUM=`cksum $TMP/f19b | cut -d" " -f 1,2`
        cp $TMP/f19b $DIR1/f19b
@@ -378,9 +373,7 @@ test_19() { # bug3811
                [ "`cat $TMP/sum2`" = "$SUM" ] || \
                        error "$DIR2/f19b `cat $TMP/sum2` != $SUM"
        done
-       for O in /proc/fs/lustre/obdfilter/*OST*; do
-               echo $MAX > $O/readcache_max_filesize
-       done
+       lctl set_param -n obdfilter.*OST*.readcache_max_filesize=$MAX
        rm $DIR1/f19b
 }
 run_test 19 "test concurrent uncached read races ==============="
@@ -388,12 +381,12 @@ run_test 19 "test concurrent uncached read races ==============="
 test_20() {
        mkdir $DIR1/d20
        cancel_lru_locks osc
-       CNT=$((`cat /proc/fs/lustre/llite/*/dump_page_cache | wc -l`))
+       CNT=$((`lctl get_param -n llite.*.dump_page_cache | wc -l`))
        multiop $DIR1/f20 Ow8190c
        multiop $DIR2/f20 Oz8194w8190c
        multiop $DIR1/f20 Oz0r8190c
        cancel_lru_locks osc
-       CNTD=$((`cat /proc/fs/lustre/llite/*/dump_page_cache | wc -l` - $CNT))
+       CNTD=$((`lctl get_param -n llite.*.dump_page_cache | wc -l` - $CNT))
        [ $CNTD -gt 0 ] && \
            error $CNTD" page left in cache after lock cancel" || true
 }