Whamcloud - gitweb
b=17477
authorgrev <grev>
Fri, 7 Nov 2008 17:15:13 +0000 (17:15 +0000)
committergrev <grev>
Fri, 7 Nov 2008 17:15:13 +0000 (17:15 +0000)
i=Adilger
check config if lustre is mounted before acc-sm run

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

index ca92df4..4ab055c 100755 (executable)
@@ -59,8 +59,20 @@ FORMAT=${FORMAT:-formatall}
 CLEANUP=${CLEANUP:-stopall}
 
 setup_if_needed() {
-    mount | grep $MOUNT && return
+    local MOUNTED=$(mounted_lustre_filesystems)
+    if $(echo $MOUNTED | grep -w -q $MOUNT); then
+        check_config $MOUNT
+        return
+    fi
+
+    echo "Lustre is not mounted, trying to do setup SETUP=$SETUP ... "
     $FORMAT && $SETUP
+
+    MOUNTED=$(mounted_lustre_filesystems)
+    if ! $(echo $MOUNTED | grep -w -q $MOUNT); then
+        echo "Lustre is not mounted after setup! SETUP=$SETUP"
+        exit 1
+    fi
 }
 
 title() {
@@ -281,7 +293,7 @@ for NAME in $CONFIGS; do
                mount_client $MOUNT2
                #echo "can't mount2 for '$NAME', skipping sanityN.sh"
                START=: CLEAN=: bash sanityN.sh
-               umount $MOUNT2
+               [ "$(mount | grep $MOUNT2)" ] && umount $MOUNT2
 
                $DEBUG_ON
                $CLEANUP
index eee4a8a..3ef0ab2 100644 (file)
@@ -1277,15 +1277,28 @@ init_facets_vars () {
     done
 }
 
+check_config () {
+    local mntpt=$1
+    
+    echo Checking config lustre mounted on $mntpt
+    local mgshost=$(mount | grep " $mntpt " | awk -F@ '{print $1}')
+    if [ "$mgshost" != "$mgs_HOST" ]; then
+        FAIL_ON_ERROR=true \
+            error "Bad config file: lustre is mounted with mgs $mgshost, but mgs_HOST=$mgs_HOST
+                   Please use correct config or set mds_HOST correctly!"
+    fi
+}
+
 check_and_setup_lustre() {
-    MOUNTED="`mounted_lustre_filesystems`"
-    if [ -z "$MOUNTED" ]; then
+    local MOUNTED=$(mounted_lustre_filesystems)
+    if [ -z "$MOUNTED" ] || ! $(echo $MOUNTED | grep -w -q $MOUNT); then
         [ "$REFORMAT" ] && formatall
         setupall
-        MOUNTED="`mounted_lustre_filesystems`"
+        MOUNTED=$(mounted_lustre_filesystems | head -1)
         [ -z "$MOUNTED" ] && error "NAME=$NAME not mounted"
         export I_MOUNTED=yes
     else
+        check_config $MOUNT
         init_facets_vars
     fi
     if [ "$ONLY" == "setup" ]; then