Whamcloud - gitweb
LU-7223 test: check mmp feature properly in mmp.sh 84/17884/4
authorNiu Yawei <yawei.niu@intel.com>
Fri, 8 Jan 2016 03:33:43 +0000 (22:33 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 11 Jan 2016 19:07:14 +0000 (19:07 +0000)
The mmp.sh checks if the mmp feature is enabled by looking at
the failover_HOST variables, which is not reliable, this patch
changed it to looking at the features on device directly.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: Ia86d1bfbfa56e01efa06955a36fa34ca62997a54
Reviewed-on: http://review.whamcloud.com/17884
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/mmp.sh

index 946a414..db5ce5a 100755 (executable)
@@ -179,6 +179,9 @@ set_mmp_update_interval() {
        return ${PIPESTATUS[0]}
 }
 
+I_ENABLED_MDS=0
+I_ENABLED_OSS=0
+
 # Enable the MMP feature on the Lustre server targets.
 mmp_init() {
        init_vars
@@ -193,63 +196,50 @@ mmp_init() {
                exit
        fi
 
-    # The MMP feature is automatically enabled by mkfs.lustre for
-    # new file system at format time if failover is being used.
-    # Otherwise, the Lustre administrator has to manually enable
-    # this feature when the file system is unmounted.
-
-    local var=${MMP_MDS}failover_HOST
-    if [ -z "${!var}" ]; then
-        log "Failover is not used on MDS, enabling MMP manually..."
-        enable_mmp $MMP_MDS $MMP_MDSDEV || \
-            error "failed to enable MMP on $MMP_MDSDEV on $MMP_MDS"
-    fi
+       mmp_is_enabled $MMP_MDS $MMP_MDSDEV ||
+       {
+               log "MMP is not enabled on MDS, enabling it manually..."
+               enable_mmp $MMP_MDS $MMP_MDSDEV ||
+                       error "failed to enable MMP on $MMP_MDSDEV on $MMP_MDS"
+               I_ENABLED_MDS=1
+       }
 
-    var=${MMP_OSS}failover_HOST
-    if [ -z "${!var}" ]; then
-        log "Failover is not used on OSS, enabling MMP manually..."
-        enable_mmp $MMP_OSS $MMP_OSTDEV || \
-            error "failed to enable MMP on $MMP_OSTDEV on $MMP_OSS"
-    fi
+       mmp_is_enabled $MMP_OSS $MMP_OSTDEV ||
+       {
+               log "MMP is not enabled on OSS, enabling it manually..."
+               enable_mmp $MMP_OSS $MMP_OSTDEV ||
+                       error "failed to enable MMP on $MMP_OSTDEV on $MMP_OSS"
+               I_ENABLED_OSS=1
+       }
 
-    # check whether the MMP feature is enabled or not
-    mmp_is_enabled $MMP_MDS $MMP_MDSDEV || \
-        error "MMP was not enabled on $MMP_MDSDEV on $MMP_MDS"
+       # check whether the MMP feature is enabled or not
+       mmp_is_enabled $MMP_MDS $MMP_MDSDEV ||
+               error "MMP was not enabled on $MMP_MDSDEV on $MMP_MDS"
 
-       mmp_is_enabled $MMP_OSS $MMP_OSTDEV || \
-       {
-               do_facet $MMP_OSS "$DUMPE2FS -h $MMP_OSTDEV"
-               log "Try to enable again:"
-               enable_mmp $MMP_OSS $MMP_OSTDEV
-               log "Verify again:"
-               do_facet $MMP_OSS "$DUMPE2FS -h $MMP_OSTDEV"
+       mmp_is_enabled $MMP_OSS $MMP_OSTDEV ||
                error "MMP was not enabled on $MMP_OSTDEV on $MMP_OSS"
-       }
 }
 
 # Disable the MMP feature on the Lustre server targets
-# which did not use failover.
 mmp_fini() {
 
-    local var=${MMP_MDS}failover_HOST
-    if [ -z "${!var}" ]; then
-        log "Failover is not used on MDS, disabling MMP manually..."
-        disable_mmp $MMP_MDS $MMP_MDSDEV || \
-            error "failed to disable MMP on $MMP_MDSDEV on $MMP_MDS"
-        mmp_is_enabled $MMP_MDS $MMP_MDSDEV && \
-            error "MMP was not disabled on $MMP_MDSDEV on $MMP_MDS"
-    fi
+       if [ $I_ENABLED_MDS -eq 1 ]; then
+               log "Disabling MMP on $MMP_MDSDEV on $MMP_MDS manually..."
+               disable_mmp $MMP_MDS $MMP_MDSDEV ||
+                       error "failed to disable MMP on $MMP_MDSDEV on $MMP_MDS"
+               mmp_is_enabled $MMP_MDS $MMP_MDSDEV &&
+                       error "MMP was not disabled on $MMP_MDSDEV on $MMP_MDS"
+       fi
 
-    var=${MMP_OSS}failover_HOST
-    if [ -z "${!var}" ]; then
-        log "Failover is not used on OSS, disabling MMP manually..."
-        disable_mmp $MMP_OSS $MMP_OSTDEV || \
-            error "failed to disable MMP on $MMP_OSTDEV on $MMP_OSS"
-        mmp_is_enabled $MMP_OSS $MMP_OSTDEV && \
-            error "MMP was not disabled on $MMP_OSTDEV on $MMP_OSS"
-    fi
+       if [ $I_ENABLED_OSS -eq 1 ]; then
+               log "Disabling MMP on $MMP_OSTDEV on $MMP_OSS manually..."
+               disable_mmp $MMP_OSS $MMP_OSTDEV ||
+                       error "failed to disable MMP on $MMP_OSTDEV on $MMP_OSS"
+               mmp_is_enabled $MMP_OSS $MMP_OSTDEV &&
+                       error "MMP was not disabled on $MMP_OSTDEV on $MMP_OSS"
+       fi
 
-    return 0
+       return 0
 }
 
 # Mount the shared target on the failover server after some interval it's