Whamcloud - gitweb
b=21115
authorgrev <grev>
Thu, 10 Dec 2009 12:06:26 +0000 (12:06 +0000)
committergrev <grev>
Thu, 10 Dec 2009 12:06:26 +0000 (12:06 +0000)
i=Robert.Read
mount the same config on all clients

lustre/tests/acceptance-small.sh
lustre/tests/sanityN.sh
lustre/tests/test-framework.sh

index b21d347..be833a8 100755 (executable)
@@ -62,7 +62,7 @@ setup_if_needed() {
 
     local MOUNTED=$(mounted_lustre_filesystems)
     if $(echo $MOUNTED | grep -w -q $MOUNT); then
 
     local MOUNTED=$(mounted_lustre_filesystems)
     if $(echo $MOUNTED | grep -w -q $MOUNT); then
-        check_config $MOUNT
+        check_config_clients $MOUNT
         init_facets_vars
         init_param_vars
         return
         init_facets_vars
         init_param_vars
         return
@@ -288,15 +288,7 @@ for NAME in $CONFIGS; do
 
        if [ "$SANITYN" != "no" ]; then
                title sanityN
 
        if [ "$SANITYN" != "no" ]; then
                title sanityN
-               $DEBUG_OFF
-
-               mkdir -p $MOUNT2
-               mount_client $MOUNT2
-               #echo "can't mount2 for '$NAME', skipping sanityN.sh"
-               START=: CLEAN=: bash sanityN.sh
-               [ "$(mount | grep $MOUNT2)" ] && umount $MOUNT2
-
-               $DEBUG_ON
+               bash sanityN.sh
                $CLEANUP
                $SETUP
                SANITYN="done"
                $CLEANUP
                $SETUP
                SANITYN="done"
index 64dfdcd..88326f9 100644 (file)
@@ -715,9 +715,6 @@ test_33a() {
     [ $CLIENTCOUNT -ge 2 ] || \
         { skip "Need two or more clients, have $CLIENTCOUNT" && return 0; }
 
     [ $CLIENTCOUNT -ge 2 ] || \
         { skip "Need two or more clients, have $CLIENTCOUNT" && return 0; }
 
-    zconf_mount_clients $CLIENT1,$CLIENT2 $DIR1
-    zconf_mount_clients $CLIENT1,$CLIENT2 $DIR2
-
     local nfiles=${TEST33_NFILES:-10000}
     local param_file=$TMP/$tfile-params
 
     local nfiles=${TEST33_NFILES:-10000}
     local param_file=$TMP/$tfile-params
 
index 618437f..24031dd 100644 (file)
@@ -1882,9 +1882,7 @@ nfs_client_mode () {
     return 1
 }
 
     return 1
 }
 
-check_config () {
-    nfs_client_mode && return
-
+check_config_client () {
     local mntpt=$1
 
     local mounted=$(mount | grep " $mntpt ")
     local mntpt=$1
 
     local mounted=$(mount | grep " $mntpt ")
@@ -1924,6 +1922,16 @@ check_config () {
                    Please use correct config or set mds_HOST correctly!"
     fi
 
                    Please use correct config or set mds_HOST correctly!"
     fi
 
+}
+
+check_config_clients () {
+    local clients=${CLIENTS:-$HOSTNAME}
+    local mntpt=$1
+
+    nfs_client_mode && return
+
+    do_rpc_nodes $clients check_config_client $mntpt
+
     sanity_mount_check ||
         error "environments are insane!"
 }
     sanity_mount_check ||
         error "environments are insane!"
 }
@@ -1937,37 +1945,65 @@ check_timeout () {
     fi
 }
 
     fi
 }
 
+is_mounted () {
+    local mntpt=$1
+    local mounted=$(mounted_lustre_filesystems)
+
+    echo $mounted' ' | grep -w -q $mntpt' '
+}
+
 check_and_setup_lustre() {
     nfs_client_mode && return
 
     local MOUNTED=$(mounted_lustre_filesystems)
 
     local do_check=true
 check_and_setup_lustre() {
     nfs_client_mode && return
 
     local MOUNTED=$(mounted_lustre_filesystems)
 
     local do_check=true
-    # MOUNT is not mounted
-    if [ -z "$MOUNTED" ] || ! $(echo $MOUNTED | grep -w -q $MOUNT); then
+    # 1.
+    # both MOUNT and MOUNT2 are not mounted
+    if ! is_mounted $MOUNT && ! is_mounted $MOUNT2; then
         [ "$REFORMAT" ] && formatall
         [ "$REFORMAT" ] && formatall
+        # setupall mounts both MOUNT and MOUNT2 (if MOUNT_2 is set)
         setupall
         setupall
-        MOUNTED=$(mounted_lustre_filesystems | head -1)
-        [ -z "$MOUNTED" ] && error "NAME=$NAME not mounted"
+        is_mounted $MOUNT || error "NAME=$NAME not mounted"
         export I_MOUNTED=yes
         do_check=false
         export I_MOUNTED=yes
         do_check=false
-
-    # MOUNT and MOUNT2 are mounted
-    elif $(echo $MOUNTED | grep -w -q $MOUNT2); then
-
-        # MOUNT2 is mounted,  MOUNT_2 is not set
-        if ! [ "$MOUNT_2" ]; then
-            zconf_umount `hostname` $MOUNT2
-            export I_UMOUNTED2=yes
-
-        # MOUNT2 is mounted, MOUNT_2 is set
-        else
-            check_config $MOUNT2
-        fi 
+    # 2.
+    # MOUNT2 is mounted
+    elif is_mounted $MOUNT2; then
+            # 3.
+            # MOUNT2 is mounted, while MOUNT_2 is not set
+            if ! [ "$MOUNT_2" ]; then
+                cleanup_mount $MOUNT2
+                export I_UMOUNTED2=yes
+
+            # 4.
+            # MOUNT2 is mounted, MOUNT_2 is set
+            else
+                # FIXME: what to do if check_config failed?
+                # i.e. if:
+                # 1) remote client has mounted other Lustre fs ?
+                # 2) it has insane env ?
+                # let's try umount MOUNT2 on all clients and mount it again:
+                if ! check_config_clients $MOUNT2; then
+                    cleanup_mount $MOUNT2
+                    restore_mount $MOUNT2
+                    export I_MOUNTED2=yes
+                fi
+            fi 
+
+    # 5.
+    # MOUNT is mounted MOUNT2 is not mounted
+    elif [ "$MOUNT_2" ]; then
+        restore_mount $MOUNT2
+        export I_MOUNTED2=yes
     fi
 
     if $do_check; then
     fi
 
     if $do_check; then
-        check_config $MOUNT
+        # FIXME: what to do if check_config failed?
+        # i.e. if:
+        # 1) remote client has mounted other Lustre fs?
+        # 2) lustre is mounted on remote_clients atall ?
+        check_config_clients $MOUNT
         init_facets_vars
         init_param_vars
 
         init_facets_vars
         init_param_vars
 
@@ -1981,6 +2017,20 @@ check_and_setup_lustre() {
     fi
 }
 
     fi
 }
 
+restore_mount () {
+   local clients=${CLIENTS:-$HOSTNAME}
+   local mntpt=$1
+
+   zconf_mount_clients $clients $mntpt
+}
+
+cleanup_mount () {
+    local clients=${CLIENTS:-$HOSTNAME}
+    local mntpt=$1
+
+    zconf_umount_clients $clients $mntpt    
+}
+
 cleanup_and_setup_lustre() {
     if [ "$ONLY" == "cleanup" -o "`mount | grep $MOUNT`" ]; then
         lctl set_param debug=0 || true
 cleanup_and_setup_lustre() {
     if [ "$ONLY" == "cleanup" -o "`mount | grep $MOUNT`" ]; then
         lctl set_param debug=0 || true
@@ -1993,18 +2043,23 @@ cleanup_and_setup_lustre() {
 }
 
 check_and_cleanup_lustre() {
 }
 
 check_and_cleanup_lustre() {
-    if [ "`mount | grep $MOUNT`" ]; then
+    if is_mounted $MOUNT; then
         [ -n "$DIR" ] && rm -rf $DIR/[Rdfs][0-9]*
         [ "$ENABLE_QUOTA" ] && restore_quota_type || true
     fi
         [ -n "$DIR" ] && rm -rf $DIR/[Rdfs][0-9]*
         [ "$ENABLE_QUOTA" ] && restore_quota_type || true
     fi
+
     if [ "$I_UMOUNTED2" = "yes" ]; then
     if [ "$I_UMOUNTED2" = "yes" ]; then
-        mount_client $MOUNT2 || error "restore $MOUNT2 failed"
+        restore_mount $MOUNT2 || error "restore $MOUNT2 failed"
+    fi
+
+    if [ "$I_MOUNTED2" = "yes" ]; then
+        cleanup_mount $MOUNT2
     fi
 
     if [ "$I_MOUNTED" = "yes" ]; then
         cleanupall -f || error "cleanup failed"
     fi
 
     if [ "$I_MOUNTED" = "yes" ]; then
         cleanupall -f || error "cleanup failed"
+        unset I_MOUNTED
     fi
     fi
-    unset I_MOUNTED
 }
 
 #######
 }
 
 #######