local MOUNTED=$(mounted_lustre_filesystems)
if $(echo $MOUNTED | grep -w -q $MOUNT); then
- check_config $MOUNT
+ check_config_clients $MOUNT
init_facets_vars
init_param_vars
return
if [ "$SANITYN" != "no" ]; then
title sanityN
- $DEBUG_OFF
-
- mkdir -p $MOUNT2
- mount_client $MOUNT2
- #echo "can't mount2 for '$NAME', skipping sanityN.sh"
- START=: CLEAN=: bash sanityN.sh
- [ "$(mount | grep $MOUNT2)" ] && umount $MOUNT2
-
- $DEBUG_ON
+ bash sanityN.sh
$CLEANUP
$SETUP
SANITYN="done"
return 1
}
-check_config () {
- nfs_client_mode && return
-
+check_config_client () {
local mntpt=$1
local mounted=$(mount | grep " $mntpt ")
# Please use correct config or set mds_HOST correctly!"
# fi
+}
+
+check_config_clients () {
+ local clients=${CLIENTS:-$HOSTNAME}
+ local mntpt=$1
+
+ nfs_client_mode && return
+
+ do_rpc_nodes $clients check_config_client $mntpt
+
sanity_mount_check ||
error "environments are insane!"
}
# MOUNT2 is mounted, MOUNT_2 is not set
if ! [ "$MOUNT_2" ]; then
- zconf_umount `hostname` $MOUNT2
+ cleanup_mount $MOUNT2
export I_UMOUNTED2=yes
# MOUNT2 is mounted, MOUNT_2 is set
else
- check_config $MOUNT2
+ # FIXME: what to do if check_config failed?
+ # i.e. if:
+ # 1) remote client has mounted other Lustre fs ?
+ # 2) it has insane env ?
+ # let's try umount MOUNT2 on all clients and mount it again:
+ if ! check_config_clients $MOUNT2; then
+ cleanup_mount $MOUNT2
+ restore_mount $MOUNT2
+ export I_MOUNTED2=yes
+ fi
fi
fi
if $do_check; then
- check_config $MOUNT
+ # FIXME: what to do if check_config failed?
+ # i.e. if:
+ # 1) remote client has mounted other Lustre fs?
+ # 2) lustre is mounted on remote_clients atall ?
+ check_config_clients $MOUNT
init_facets_vars
init_param_vars
fi
}
+restore_mount () {
+ local clients=${CLIENTS:-$HOSTNAME}
+ local mntpt=$1
+
+ zconf_mount_clients $clients $mntpt
+}
+
+cleanup_mount () {
+ local clients=${CLIENTS:-$HOSTNAME}
+ local mntpt=$1
+
+ zconf_umount_clients $clients $mntpt
+}
+
cleanup_and_setup_lustre() {
if [ "$ONLY" == "cleanup" -o "`mount | grep $MOUNT`" ]; then
lctl set_param debug=0 || true
[ "$ENABLE_QUOTA" ] && restore_quota_type || true
fi
if [ "$I_UMOUNTED2" = "yes" ]; then
- mount_client $MOUNT2 || error "restore $MOUNT2 failed"
+ restore_mount $MOUNT2 || error "restore $MOUNT2 failed"
fi
+ if [ "$I_MOUNTED2" = "yes" ]; then
+ cleanup_mount $MOUNT2
+ fi
+ zconf_umount_clients $clients $MOUNT2
if [ "$I_MOUNTED" = "yes" ]; then
cleanupall -f || error "cleanup failed"
fi