X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fmmp.sh;h=ba2dcbf1adb7c5b220a62c534a20e395141cd817;hb=be189ac74726415c0859c3001e3f1cfde7542864;hp=946a4145815c00ba627d42330c3c31a9887da63d;hpb=eb6cd4804d65dda1b6ea4a1289cc01647d03a47a;p=fs%2Flustre-release.git diff --git a/lustre/tests/mmp.sh b/lustre/tests/mmp.sh index 946a414..ba2dcbf 100755 --- a/lustre/tests/mmp.sh +++ b/lustre/tests/mmp.sh @@ -179,77 +179,67 @@ 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 if [ $(facet_fstype $MMP_MDS) != ldiskfs ]; then - skip "Only applicable to ldiskfs-based MDTs" + skip "ldiskfs only test" exit fi if [ $(facet_fstype $MMP_OSS) != ldiskfs ]; then - skip "Only applicable to ldiskfs-based OSTs" + skip "ldiskfs only test" 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 @@ -439,10 +429,11 @@ mmp_init # Test 1 - two mounts at the same time. test_1() { - check_failover_pair || return 0 + check_failover_pair || return 0 - mount_after_interval 0 0 || return ${PIPESTATUS[0]} - stop_services primary || return ${PIPESTATUS[0]} + mount_after_interval 0 0 || return ${PIPESTATUS[0]} + stop_services primary || return ${PIPESTATUS[0]} + stop_services failover || return ${PIPESTATUS[0]} } run_test 1 "two mounts at the same time" @@ -672,7 +663,7 @@ test_10() { error_noexit "e2fsck $MMP_OSTDEV on $MMP_OSS_FAILOVER returned $rc" fi - stop_services primary || return ${PIPESTATUS[0]} + CLEANUP_DM_DEV=true stop_services primary || return ${PIPESTATUS[0]} return 0 } run_test 10 "e2fsck with mounted filesystem" @@ -682,4 +673,5 @@ FAIL_ON_ERROR=$SAVED_FAIL_ON_ERROR complete $SECONDS $MMP_RESTORE_MOUNT && setupall +check_and_cleanup_lustre exit_status