#
grep -q exportfs_decode_fh $SYMLIST ||
{ modprobe exportfs 2> /dev/null || true; }
- load_module ../ldiskfs/ldiskfs/ldiskfs
+ load_module ../ldiskfs/ldiskfs
load_module lvfs/fsfilt_ldiskfs
load_module osd-ldiskfs/osd_ldiskfs
fi
fi
}
+facet_svc() {
+ local facet=$1
+ local var=${facet}_svc
+
+ echo -n ${!var}
+}
+
facet_type() {
local facet=$1
$LFS df $* | sed -e 's/filesystem /filesystem_/'
}
+# Get free inodes on the MDT specified by mdt index, free indoes on
+# the whole filesystem will be returned when index == -1.
+mdt_free_inodes() {
+ local index=$1
+ local free_inodes
+ local mdt_uuid
+
+ if [ $index -eq -1 ]; then
+ mdt_uuid="summary"
+ else
+ mdt_uuid=$(mdtuuid_from_index $index)
+ fi
+
+ free_inodes=$(lfs_df -i $MOUNT | grep $mdt_uuid | awk '{print $4}')
+ echo $free_inodes
+}
+
setup_quota(){
if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
setup_quota_old $1
TESTNAME=$TESTNAME \
DBENCH_LIB=$DBENCH_LIB \
DBENCH_SRC=$DBENCH_SRC \
+CLIENT_COUNT=$((CLIENTCOUNT - 1)) \
LFS=$LFS \
run_${load}.sh" &
local ppid=$!
echo "Waiting for orphan cleanup..."
# MAX value includes time needed for MDS-OST reconnection
local MAX=$(( TIMEOUT * 2 ))
+ local WAIT_TIMEOUT=${1:-$MAX}
local WAIT=0
local new_wait=true
local list=$(comma_list $(mdts_nodes))
list=$(comma_list $(osts_nodes))
cmd="$LCTL get_param -n obdfilter.*.mds_sync"
fi
- while [ $WAIT -lt $MAX ]; do
+
+ echo "wait $WAIT_TIMEOUT secs maximumly for $list mds-ost sync done."
+ while [ $WAIT -lt $WAIT_TIMEOUT ]; do
local -a sync=($(do_nodes $list "$cmd"))
local con=1
local i
done
sleep 2 # increase waiting time and cover statfs cache
[ ${con} -eq 1 ] && return 0
- echo "Waiting $WAIT secs for $facet mds-ost sync done."
+ echo "Waiting $WAIT secs for $list $i mds-ost sync done."
WAIT=$((WAIT + 2))
done
- echo "$facet recovery not done in $MAX sec. $STATUS"
+
+ # show which nodes are not finished.
+ do_nodes $list "$cmd"
+ echo "$facet recovery node $i not done in $WAIT_TIMEOUT sec. $STATUS"
return 1
}
$LCTL mark "local REPLAY BARRIER on ${!svc}"
}
+#
+# Get Lustre client uuid for a given Lustre mount point.
+#
+get_client_uuid() {
+ local mntpnt=${1:-$MOUNT}
+
+ local name=$($LFS getname $mntpnt | cut -d' ' -f1)
+ local uuid=$($LCTL get_param -n llite.$name.uuid)
+
+ echo -n $uuid
+}
+
mds_evict_client() {
- UUID=`lctl get_param -n mdc.${mds1_svc}-mdc-*.uuid`
- do_facet mds1 "lctl set_param -n mdt.${mds1_svc}.evict_client $UUID"
+ local mntpnt=${1:-$MOUNT}
+ local uuid=$(get_client_uuid $mntpnt)
+
+ do_facet $SINGLEMDS \
+ "$LCTL set_param -n mdt.${mds1_svc}.evict_client $uuid"
}
ost_evict_client() {
- UUID=`lctl get_param -n devices| grep ${ost1_svc}-osc- | egrep -v 'MDT' | awk '{print $5}'`
- do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.evict_client $UUID"
+ local mntpnt=${1:-$MOUNT}
+ local uuid=$(get_client_uuid $mntpnt)
+
+ do_facet ost1 \
+ "$LCTL set_param -n obdfilter.${ost1_svc}.evict_client $uuid"
}
fail() {
}
h2name_or_ip() {
- if [ "$1" = "client" -o "$1" = "'*'" ]; then echo \'*\'; else
- echo $1"@$2"
- fi
+ if [ "$1" = "'*'" ]; then echo \'*\'; else
+ echo $1"@$2"
+ fi
}
h2ptl() {
- if [ "$1" = "client" -o "$1" = "'*'" ]; then echo \'*\'; else
- ID=`xtprocadmin -n $1 2>/dev/null | egrep -v 'NID' | awk '{print $1}'`
- if [ -z "$ID" ]; then
- echo "Could not get a ptl id for $1..."
- exit 1
- fi
- echo $ID"@ptl"
- fi
+ if [ "$1" = "'*'" ]; then echo \'*\'; else
+ ID=`xtprocadmin -n $1 2>/dev/null | egrep -v 'NID' | \
+ awk '{print $1}'`
+ if [ -z "$ID" ]; then
+ echo "Could not get a ptl id for $1..."
+ exit 1
+ fi
+ echo $ID"@ptl"
+ fi
}
declare -fx h2ptl
h2tcp() {
- h2name_or_ip "$1" "tcp"
+ h2name_or_ip "$1" "tcp"
}
declare -fx h2tcp
h2elan() {
- if [ "$1" = "client" -o "$1" = "'*'" ]; then echo \'*\'; else
- if type __h2elan >/dev/null 2>&1; then
- ID=$(__h2elan $1)
- else
- ID=`echo $1 | sed 's/[^0-9]*//g'`
- fi
- echo $ID"@elan"
- fi
+ if [ "$1" = "'*'" ]; then echo \'*\'; else
+ if type __h2elan >/dev/null 2>&1; then
+ ID=$(__h2elan $1)
+ else
+ ID=`echo $1 | sed 's/[^0-9]*//g'`
+ fi
+ echo $ID"@elan"
+ fi
}
declare -fx h2elan
h2o2ib() {
- h2name_or_ip "$1" "o2ib"
+ h2name_or_ip "$1" "o2ib"
}
declare -fx h2o2ib
[ $(find $1 -maxdepth 1 -name lost+found -o -name .lustre -prune -o \
-print | wc -l) = 1 ] || return 1
[ ! -d $1/lost+found ] || is_empty_dir $1/lost+found || return 1
- if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.0) ]; then
+ if [ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.4.0) ]; then
# exclude .lustre/fid (LU-2780)
[ $(find $1/.lustre -maxdepth 1 -name fid -prune -o \
-print | wc -l) = 1 ] || return 1
fi
if [ $(lower $OSD_TRACK_DECLARES_LBUG) == 'yes' ] ; then
- local facets="$(get_facets OST),$(get_facets MDS),mgs"
+ local facets=""
+ [ "$(facet_fstype ost1)" = "ldiskfs" ] &&
+ facets="$(get_facets OST)"
+ [ "$(facet_fstype mds1)" = "ldiskfs" ] &&
+ facets="$facets,$(get_facets MDS)"
+ [ "$(facet_fstype mgs)" = "ldiskfs" ] &&
+ facets="$facets,mgs"
local nodes="$(facets_hosts ${facets})"
if [ -n "$nodes" ] ; then
do_nodes $nodes "$LCTL set_param \
# verify a directory is shared among nodes.
check_shared_dir() {
local dir=$1
+ local list=${2:-$(comma_list $(nodes_list))}
[ -z "$dir" ] && return 1
- do_rpc_nodes "$(comma_list $(nodes_list))" check_logdir $dir
- check_write_access $dir || return 1
+ do_rpc_nodes "$list" check_logdir $dir
+ check_write_access $dir "$list" || return 1
return 0
}
case $type in
MGS ) list="$list $name";;
- MDS|OST ) local count=${type}COUNT
+ MDS|OST|AGT ) local count=${type}COUNT
for ((i=1; i<=${!count}; i++)) do
list="$list ${name}$i"
done;;
echo -n $(facets_nodes $(get_facets OST))
}
+# Get all of the active AGT (HSM agent) nodes.
+agts_nodes () {
+ echo -n $(facets_nodes $(get_facets AGT))
+}
+
# Get all of the client nodes and active server nodes.
nodes_list () {
local nodes=$HOSTNAME
}
check_write_access() {
- local dir=$1
- local node
- local file
+ local dir=$1
+ local list=${2:-$(comma_list $(nodes_list))}
+ local node
+ local file
- for node in $(nodes_list); do
- file=$dir/check_file.$(short_hostname $node)
- if [[ ! -f "$file" ]]; then
- # Logdir not accessible/writable from this node.
- return 1
- fi
- rm -f $file || return 1
- done
- return 0
+ for node in ${list//,/ }; do
+ file=$dir/check_file.$(short_hostname $node)
+ if [[ ! -f "$file" ]]; then
+ # Logdir not accessible/writable from this node.
+ return 1
+ fi
+ rm -f $file || return 1
+ done
+ return 0
}
init_logging() {
}
reformat_external_journal() {
+ local facet=$1
+
if [ ! -z ${EJOURNAL} ]; then
- local rcmd="do_facet ${SINGLEMDS}"
+ local rcmd="do_facet $facet"
- echo "reformat external journal on ${SINGLEMDS}:${EJOURNAL}"
+ echo "reformat external journal on $facet:${EJOURNAL}"
${rcmd} mke2fs -O journal_dev ${EJOURNAL} || return 1
fi
}
# MDT file-level backup/restore
mds_backup_restore() {
- local devname=$(mdsdevname ${SINGLEMDS//mds/})
+ local facet=$1
+ local igif=$2
+ local devname=$(mdsdevname $(facet_number $facet))
local mntpt=$(facet_mntpt brpt)
- local rcmd="do_facet ${SINGLEMDS}"
+ local rcmd="do_facet $facet"
local metaea=${TMP}/backup_restore.ea
local metadata=${TMP}/backup_restore.tgz
local opts=${MDS_MOUNT_OPTS}
- local svc=${SINGLEMDS}_svc
- local igif=$1
+ local svc=${facet}_svc
if ! ${rcmd} test -b ${devname}; then
opts=$(csa_add "$opts" -o loop)
fi
- echo "file-level backup/restore on ${SINGLEMDS}:${devname}"
+ echo "file-level backup/restore on $facet:${devname}"
# step 1: build mount point
${rcmd} mkdir -p $mntpt
# step 6: umount
${rcmd} umount -d $mntpt || return 4
# step 7: reformat external journal if needed
- reformat_external_journal || return 5
+ reformat_external_journal $facet || return 5
# step 8: reformat dev
echo "reformat new device"
- add ${SINGLEMDS} $(mkfs_opts ${SINGLEMDS} ${devname}) --backfstype \
- ldiskfs --reformat ${devname} $(mdsvdevname 1) > /dev/null ||
- exit 6
+ add $facet $(mkfs_opts $facet ${devname}) --backfstype ldiskfs \
+ --reformat ${devname} $(mdsvdevname $(facet_number $facet)) \
+ > /dev/null || exit 6
# step 9: mount dev
${rcmd} mount -t ldiskfs $opts $devname $mntpt || return 7
# step 10: restore metadata
# remove OI files
mds_remove_ois() {
- local devname=$(mdsdevname ${SINGLEMDS//mds/})
+ local facet=$1
+ local idx=$2
+ local devname=$(mdsdevname $(facet_number $facet))
local mntpt=$(facet_mntpt brpt)
- local rcmd="do_facet ${SINGLEMDS}"
- local idx=$1
+ local rcmd="do_facet $facet"
local opts=${MDS_MOUNT_OPTS}
if ! ${rcmd} test -b ${devname}; then
opts=$(csa_add "$opts" -o loop)
fi
- echo "remove OI files: idx=${idx}"
+ echo "removing OI files on $facet: idx=${idx}"
# step 1: build mount point
${rcmd} mkdir -p $mntpt