Whamcloud - gitweb
LU-4656 tests: Add MOUNT_FLAGS variable and rename MOUNTOPT 32/9332/16
authorRyan Haasken <haasken@cray.com>
Thu, 20 Feb 2014 21:13:50 +0000 (15:13 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 1 Aug 2014 06:45:28 +0000 (06:45 +0000)
This patch adds a MOUNT_FLAGS variable which can be set to any extra
flags to the mount command, such as "-n".  MOUNTOPT was renamed to
MOUNT_OPTS to reflect that is a list of options. It should now contain
just a comma-separated list of mount options which will be passed to
the mount command as "-o $MOUNT_OPTS".  MOUNT_OPTS should not include
the "-o" anymore.

MOUNT_FLAGS was added to the mount commands and output messages in
zconf_mount and zconf_mount_clients in test-framework.sh.  MOUNT_OPTS
was prepended with the "-o" before being passed to the mount command.
MOUNT_FLAGS was given an empty default value in cfg/local.sh, and some
short documentation was added above MOUNT_OPTS and MOUNT_FLAGS.  Any
place which called zconf_mount or zconf_mount_clients was updated to
pass the mount options without the "-o".

All code which added an option to MOUNT_OPTS was updated to add the
option correctly, with a comma only if necessary.  Wherever possible,
the new mount options were passed to zconf_mount* to avoid modifying
global state.  In som_mode_switch, som_preview was removed from the
options correctly, removing a comma if necessary.

Two lines in test_132 were also edited to use "lctl get_param -n"
instead of piping the output of "lctl get_param" through an awk
command.

Test-Parameters:     envdefinitions=MOUNT_OPTS=user_xattr,MOUNT_FLAGS="-o flock"
Signed-off-by: Ryan Haasken <haasken@cray.com>
Change-Id: I32d078fc6b64ee93199ad7b881791e872590f711
Reviewed-on: http://review.whamcloud.com/9332
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Robert Read <robert.read@intel.com>
Reviewed-by: Chris Horn <hornc@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/cfg/local.sh
lustre/tests/conf-sanity.sh
lustre/tests/functions.sh
lustre/tests/parallel-scale-nfs.sh
lustre/tests/recovery-small.sh
lustre/tests/sanity-gss.sh
lustre/tests/sanity-krb5.sh
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index dbd76c5..601d7bc 100644 (file)
@@ -100,7 +100,10 @@ LQUOTAOPTS=${LQUOTAOPTS:-"hash_lqs_cur_bits=3"}
 MOUNT=${MOUNT:-/mnt/${FSNAME}}
 MOUNT1=${MOUNT1:-$MOUNT}
 MOUNT2=${MOUNT2:-${MOUNT}2}
-MOUNTOPT=${MOUNTOPT:-"-o user_xattr,flock"}
+# Comma-separated option list used as "mount [...] -o $MOUNT_OPTS [...]"
+MOUNT_OPTS=${MOUNT_OPTS:-"user_xattr,flock"}
+# Mount flags (e.g. "-n") used as "mount [...] $MOUNT_FLAGS [...]"
+MOUNT_FLAGS=${MOUNT_FLAGS:-""}
 DIR=${DIR:-$MOUNT}
 DIR1=${DIR:-$MOUNT1}
 DIR2=${DIR2:-$MOUNT2}
index 5165889..95cc423 100644 (file)
@@ -203,7 +203,7 @@ mount_client() {
 }
 
 remount_client() {
-       local mountopt="-o remount,$1"
+       local mountopt="remount,$1"
        local MOUNTPATH=$2
        echo "remount '$1' lustre on ${MOUNTPATH}....."
        zconf_mount `hostname`  $MOUNTPATH "$mountopt"  || return 96
index 0bc4fa0..dfcebba 100644 (file)
@@ -908,7 +908,7 @@ run_statahead () {
 
     local num_mntpts=$statahead_NUMMNTPTS
     local mntpt_root=$TMP/mntpt/lustre
-    local mntopts=${MNTOPTSTATAHEAD:-$MOUNTOPT}
+    local mntopts=$MNTOPTSTATAHEAD
 
     echo "Mounting $num_mntpts lustre clients starts on $clients"
     trap "cleanup_statahead $clients $mntpt_root $num_mntpts" EXIT ERR
index 2e0bbd2..0f8fead 100755 (executable)
@@ -20,7 +20,8 @@ check_and_setup_lustre
 cleanup_mount $MOUNT
 # mount lustre on mds
 lustre_client=$(facet_active_host $SINGLEMDS)
-[ "$NFSVERSION" = "4" ] && cl_mnt_opt="$MOUNTOPT,32bitapi" || cl_mnt_opt=""
+[ "$NFSVERSION" = "4" ] && cl_mnt_opt="${MOUNT_OPTS:+$MOUNT_OPTS,}32bitapi" ||
+    cl_mnt_opt=""
 zconf_mount_clients $lustre_client $MOUNT "$cl_mnt_opt" || \
     error "mount lustre on $lustre_client failed"
 
index 62d2051..fe2a1df 100755 (executable)
@@ -1568,10 +1568,9 @@ test_105()
         # get one of the clients from client list
         local rcli=$(echo $RCLIENTS |cut -d' ' -f 1)
 
-        local old_MOUNTOPT=$MOUNTOPT
-        MOUNTOPT=${MOUNTOPT},noir
+        local mount_opts=${MOUNT_OPTS:+$MOUNT_OPTS,}noir
         zconf_umount $rcli $MOUNT || error "umount failed"
-        zconf_mount $rcli $MOUNT || error "mount failed"
+        zconf_mount $rcli $MOUNT $mount_opts || error "mount failed"
 
         # make sure lustre mount at $rcli disabling IR
         local ir_state=$(check_cli_ir_state $rcli)
@@ -1593,8 +1592,7 @@ test_105()
        [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
                error "IR status on ost1 should be DISABLED"
 
-        # restore it
-        MOUNTOPT=$old_MOUNTOPT
+        # remount with the default MOUNT_OPTS
         zconf_umount $rcli $MOUNT || error "umount failed"
         zconf_mount $rcli $MOUNT || error "mount failed"
 
index 541eeac..ee07c8f 100755 (executable)
@@ -507,7 +507,7 @@ test_102() {
 run_test 102 "survive from insanely fast flavor switch"
 
 test_150() {
-    local save_opts
+    local mount_opts
     local count
     local clients=$CLIENTS
 
@@ -524,18 +524,14 @@ test_150() {
     zconf_umount_clients $clients $MOUNT || return 1
 
     # mount client with conflict flavor - should fail
-    save_opts=$MOUNTOPT
-       MOUNTOPT="$MOUNTOPT,mgssec=gssnull"
-       zconf_mount_clients $clients $MOUNT &&
-               error "mount with conflict flavor should have failed"
-    MOUNTOPT=$save_opts
+    mount_opts="${MOUNT_OPTS:+$MOUNT_OPTS,}mgssec=gssnull"
+    zconf_mount_clients $clients $MOUNT $mount_opts &&
+        error "mount with conflict flavor should have failed"
 
     # mount client with same flavor - should succeed
-    save_opts=$MOUNTOPT
-    MOUNTOPT="$MOUNTOPT,mgssec=null"
-    zconf_mount_clients $clients $MOUNT || \
+    mount_opts="${MOUNT_OPTS:+$MOUNT_OPTS,}mgssec=null"
+    zconf_mount_clients $clients $MOUNT $mount_opts ||
         error "mount with same flavor should have succeeded"
-    MOUNTOPT=$save_opts
     zconf_umount_clients $clients $MOUNT || return 2
 
     # mount client with default flavor - should succeed
index 6d3ba8e..5306591 100755 (executable)
@@ -719,7 +719,7 @@ test_102() {
 run_test 102 "survive from insanely fast flavor switch"
 
 test_150() {
-       local save_opts
+       local mount_opts
        local count
        local clients=$CLIENTS
 
@@ -736,18 +736,14 @@ test_150() {
        zconf_umount_clients $clients $MOUNT || return 1
 
        # mount client with conflict flavor - should fail
-       save_opts=$MOUNTOPT
-       MOUNTOPT="$MOUNTOPT,mgssec=krb5p"
-       zconf_mount_clients $clients $MOUNT &&
+       mount_opts="${MOUNT_OPTS:+$MOUNT_OPTS,}mgssec=krb5p"
+       zconf_mount_clients $clients $MOUNT $mount_opts &&
            error "mount with conflict flavor should have failed"
-       MOUNTOPT=$save_opts
 
        # mount client with same flavor - should succeed
-       save_opts=$MOUNTOPT
-       MOUNTOPT="$MOUNTOPT,mgssec=null"
-       zconf_mount_clients $clients $MOUNT ||
+       mount_opts="${MOUNT_OPTS:+$MOUNT_OPTS,}mgssec=null"
+       zconf_mount_clients $clients $MOUNT $mount_opts ||
            error "mount with same flavor should have succeeded"
-       MOUNTOPT=$save_opts
        zconf_umount_clients $clients $MOUNT || return 2
 
        # mount client with default flavor - should succeed
index deec912..bc6fb0b 100644 (file)
@@ -8824,11 +8824,12 @@ som_mode_switch() {
 
         if [ x$som = x"enabled" ]; then
                 [ $((gl2 - gl1)) -gt 0 ] && error "no glimpse RPC is expected"
-                MOUNTOPT=`echo $MOUNTOPT | sed 's/som_preview//g'`
+                MOUNT_OPTS=`echo $MOUNT_OPTS |
+                    sed 's/som_preview,\|,som_preview\|som_preview//g'`
                 do_facet mgs "$LCTL conf_param $FSNAME.mdt.som=disabled"
         else
                 [ $((gl2 - gl1)) -gt 0 ] || error "some glimpse RPC is expected"
-                MOUNTOPT="$MOUNTOPT,som_preview"
+                MOUNT_OPTS="${MOUNT_OPTS:+$MOUNT_OPTS,}som_preview"
                 do_facet mgs "$LCTL conf_param $FSNAME.mdt.som=enabled"
         fi
 
@@ -8844,12 +8845,12 @@ test_132() { #1028, SOM
         remote_mds_nodsh && skip "remote MDS with nodsh" && return
         local num=$(get_mds_dir $DIR)
         local mymds=mds${num}
-        local MOUNTOPT_SAVE=$MOUNTOPT
+        local MOUNT_OPTS_SAVE=$MOUNT_OPTS
 
         dd if=/dev/zero of=$DIR/$tfile count=1 2>/dev/null
         cancel_lru_locks osc
 
-        som1=$(do_facet $mymds "$LCTL get_param mdt.*.som" |  awk -F= ' {print $2}' | head -n 1)
+        som1=$(do_facet $mymds "$LCTL get_param -n mdt.*.som" | head -n 1)
 
         gl1=$(get_ost_param "ldlm_glimpse_enqueue")
         stat $DIR/$tfile >/dev/null
@@ -8861,7 +8862,7 @@ test_132() { #1028, SOM
         dd if=/dev/zero of=$DIR/$tfile count=1 2>/dev/null
         cancel_lru_locks osc
 
-        som2=$(do_facet $mymds "$LCTL get_param mdt.*.som" |  awk -F= ' {print $2}' | head -n 1)
+        som2=$(do_facet $mymds "$LCTL get_param -n mdt.*.som" | head -n 1)
         if [ $som1 == $som2 ]; then
             error "som is still "$som2
             if [ x$som2 = x"enabled" ]; then
@@ -8876,7 +8877,7 @@ test_132() { #1028, SOM
         gl2=$(get_ost_param "ldlm_glimpse_enqueue")
         echo "====> SOM is "$som2", "$((gl2 - gl1))" glimpse RPC occured"
         som_mode_switch $som2 $gl1 $gl2
-        MOUNTOPT=$MOUNTOPT_SAVE
+        MOUNT_OPTS=$MOUNT_OPTS_SAVE
 }
 run_test 132 "som avoids glimpse rpc"
 
index 9258362..421a4e4 100755 (executable)
@@ -1438,17 +1438,19 @@ setup_quota(){
 zconf_mount() {
     local client=$1
     local mnt=$2
-    local OPTIONS=${3:-$MOUNTOPT}
+    local opts=${3:-$MOUNT_OPTS}
+    opts=${opts:+-o $opts}
+    local flags=${4:-$MOUNT_FLAGS}
 
     local device=$MGSNID:/$FSNAME
     if [ -z "$mnt" -o -z "$FSNAME" ]; then
-        echo Bad zconf mount command: opt=$OPTIONS dev=$device mnt=$mnt
+        echo Bad zconf mount command: opt=$flags $opts dev=$device mnt=$mnt
         exit 1
     fi
 
-    echo "Starting client: $client: $OPTIONS $device $mnt"
+    echo "Starting client: $client: $flags $opts $device $mnt"
     do_node $client mkdir -p $mnt
-    do_node $client $MOUNT_CMD $OPTIONS $device $mnt || return 1
+    do_node $client $MOUNT_CMD $flags $opts $device $mnt || return 1
 
     set_default_debug_nodes $client
 
@@ -1544,22 +1546,24 @@ sanity_mount_check () {
 zconf_mount_clients() {
     local clients=$1
     local mnt=$2
-    local OPTIONS=${3:-$MOUNTOPT}
+    local opts=${3:-$MOUNT_OPTS}
+    opts=${opts:+-o $opts}
+    local flags=${4:-$MOUNT_FLAGS}
 
     local device=$MGSNID:/$FSNAME
     if [ -z "$mnt" -o -z "$FSNAME" ]; then
-        echo Bad zconf mount command: opt=$OPTIONS dev=$device mnt=$mnt
+        echo Bad zconf mount command: opt=$flags $opts dev=$device mnt=$mnt
         exit 1
     fi
 
-    echo "Starting client $clients: $OPTIONS $device $mnt"
+    echo "Starting client $clients: $flags $opts $device $mnt"
 
     do_nodes $clients "
 running=\\\$(mount | grep -c $mnt' ');
 rc=0;
 if [ \\\$running -eq 0 ] ; then
     mkdir -p $mnt;
-    $MOUNT_CMD $OPTIONS $device $mnt;
+    $MOUNT_CMD $flags $opts $device $mnt;
     rc=\\\$?;
 fi;
 exit \\\$rc" || return ${PIPESTATUS[0]}