X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fmmp.sh;h=db5ce5ae08e63667249c51be398ee031677105f5;hb=89c28146abe576aa1935f32ee9ce6949b85e381b;hp=6338f7e67f1355d2d2d9d4ae091eff84823d9f52;hpb=50f7e269307d28c87511615d3e40df8050129249;p=fs%2Flustre-release.git diff --git a/lustre/tests/mmp.sh b/lustre/tests/mmp.sh index 6338f7e..db5ce5a 100755 --- a/lustre/tests/mmp.sh +++ b/lustre/tests/mmp.sh @@ -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,56 +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 - - 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 - - # 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 || \ - error "MMP was not enabled on $MMP_OSTDEV on $MMP_OSS" + 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 + } + + 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" + + 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