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
-
- 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
# 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"
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"
complete $SECONDS
$MMP_RESTORE_MOUNT && setupall
+check_and_cleanup_lustre
exit_status