# umount everything, modules still loaded
stopall
+ # start mgs
+ start mgs $(mgsdevname 1) $MDS_MOUNT_OPTS
+
# mount mgs with default flavor, in current framework it means mgs+mdt1.
# the connection of mgc of mdt1 to mgs is expected fail.
DEVNAME=$(mdsdevname 1)
- start mds1 $DEVNAME $MDS_MOUNT_OPTS &&
+ start mds1 $DEVNAME $MDS_MOUNT_OPTS
+ wait_mgc_import_state mds FULL 0 &&
error "mount with default flavor should have failed"
+ stop mds1
# mount with unauthorized flavor should fail
save_opts=$MDS_MOUNT_OPTS
+ if [ -z "$MDS_MOUNT_OPTS" ]; then
+ MDS_MOUNT_OPTS="-o mgssec=null"
+ else
MDS_MOUNT_OPTS="$MDS_MOUNT_OPTS,mgssec=null"
- start mds1 $DEVNAME $MDS_MOUNT_OPTS &&
+ fi
+ start mds1 $DEVNAME $MDS_MOUNT_OPTS
+ wait_mgc_import_state mds FULL 0 &&
error "mount with unauthorized flavor should have failed"
MDS_MOUNT_OPTS=$save_opts
+ stop mds1
# mount with designated flavor should succeed
save_opts=$MDS_MOUNT_OPTS
+ if [ -z "$MDS_MOUNT_OPTS" ]; then
+ MDS_MOUNT_OPTS="-o mgssec=krb5p"
+ else
MDS_MOUNT_OPTS="$MDS_MOUNT_OPTS,mgssec=krb5p"
- start mds1 $DEVNAME $MDS_MOUNT_OPTS ||
+ fi
+ start mds1 $DEVNAME $MDS_MOUNT_OPTS
+ wait_mgc_import_state mds FULL 0 ||
error "mount with designated flavor should have succeeded"
MDS_MOUNT_OPTS=$save_opts
local expected=$1
local CONN_PROC=$2
local maxtime=${3:-$(max_recovery_time)}
+ local error_on_failure=${4:-1}
local CONN_STATE
local i=0
# reconnect timeout and test can't see real disconnect
[ "${CONN_STATE}" == "CONNECTING" ] && return 0
fi
- [ $i -ge $maxtime ] && \
- error "can't put import for $CONN_PROC into ${expected} state after $i sec, have ${CONN_STATE}" && \
+ if [ $i -ge $maxtime ]; then
+ [ $error_on_failure -ne 0 ] && \
+ error "can't put import for $CONN_PROC into ${expected}" \
+ "state after $i sec, have ${CONN_STATE}"
return 1
+ fi
sleep 1
# Add uniq for multi-mount case
CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2 | uniq)
local state=$1
local params=$2
local maxtime=${3:-$(max_recovery_time)}
+ local error_on_failure=${4:-1}
local param
for param in ${params//,/ }; do
- _wait_import_state $state $param $maxtime || return
+ _wait_import_state $state $param $maxtime $error_on_failure || return
done
}
fi
}
+_wait_mgc_import_state() {
+ local facet=$1
+ local expected=$2
+ local error_on_failure=${3:-1}
+ local param="mgc.*.mgs_server_uuid"
+ local params=$param
+ local i=0
+
+ # 1. wait the deadline of client 1st request (it could be skipped)
+ # 2. wait the deadline of client 2nd request
+ local maxtime=$(( 2 * $(request_timeout $facet)))
+
+ if [[ $facet == client* ]]; then
+ # During setup time, the osc might not be setup, it need wait
+ # until list_param can return valid value. And also if there
+ # are mulitple osc entries we should list all of them before
+ # go to wait.
+ params=$($LCTL list_param $param 2>/dev/null || true)
+ while [ -z "$params" ]; do
+ if [ $i -ge $maxtime ]; then
+ echo "can't get $param in $maxtime secs"
+ return 1
+ fi
+ sleep 1
+ i=$((i + 1))
+ params=$($LCTL list_param $param 2>/dev/null || true)
+ done
+ fi
+ if ! do_rpc_nodes "$(facet_active_host $facet)" \
+ wait_import_state $expected "$params" $maxtime \
+ $error_on_failure; then
+ if [ $error_on_failure -ne 0 ]; then
+ error "import is not in ${expected} state"
+ fi
+ return 1
+ fi
+
+ return 0
+}
+
+wait_mgc_import_state() {
+ local facet=$1
+ local expected=$2
+ local error_on_failure=${3:-1}
+ local num
+
+ if [[ $facet = mds ]]; then
+ for num in $(seq $MDSCOUNT); do
+ _wait_mgc_import_state mds$num "$expected" \
+ $error_on_failure || return
+ done
+ else
+ _wait_mgc_import_state "$facet" "$expected"
+ $error_on_failure || return
+ fi
+}
+
get_clientmdc_proc_path() {
echo "${1}-mdc-*"
}