Whamcloud - gitweb
LU-9771 flr: Merge branch 'flr'
[fs/lustre-release.git] / lustre / tests / test-framework.sh
index a5fe967..cb9d21a 100755 (executable)
@@ -1865,6 +1865,19 @@ zconf_umount() {
     fi
 }
 
+# Mount the file system on the MGS
+mount_mgs_client() {
+       do_facet mgs "mkdir -p $MOUNT"
+       zconf_mount $mgs_HOST $MOUNT $MOUNT_OPTS ||
+               error "unable to mount $MOUNT on MGS"
+}
+
+# Unmount the file system on the MGS
+umount_mgs_client() {
+       zconf_umount $mgs_HOST $MOUNT
+       do_facet mgs "rm -rf $MOUNT"
+}
+
 # nodes is comma list
 sanity_mount_check_nodes () {
     local nodes=$1
@@ -4858,17 +4871,19 @@ wait_for_function () {
 }
 
 check_network() {
-    local host=$1
-    local max=$2
-    local sleep=${3:-5}
+       local host=$1
+       local max=$2
+       local sleep=${3:-5}
 
-    echo `date +"%H:%M:%S (%s)"` waiting for $host network $max secs ...
-    if ! wait_for_function --quiet "ping -c 1 -w 3 $host" $max $sleep ; then
-        echo "Network not available!"
-        exit 1
-    fi
+       [ "$host" = "$HOSTNAME" ] && return 0
+
+       echo "$(date +'%H:%M:%S (%s)') waiting for $host network $max secs ..."
+       if ! wait_for_function --quiet "ping -c 1 -w 3 $host" $max $sleep ; then
+               echo "Network not available!"
+               exit 1
+       fi
 
-    echo `date +"%H:%M:%S (%s)"` network interface is UP
+       echo "$(date +'%H:%M:%S (%s)') network interface is UP"
 }
 
 no_dsh() {
@@ -5274,6 +5289,29 @@ report_error() {
 # Test interface
 ##################################
 
+# usage: stack_trap arg sigspec
+#
+# stack_trap() behaves like bash's built-in trap, except that it "stacks" the
+# command ``arg`` on top of previously defined commands for ``sigspec`` instead
+# of overwriting them.
+# stacked traps are executed in reverse order of their registration
+#
+# arg and sigspec have the same meaning as in man (1) trap
+stack_trap()
+{
+       local arg="$1"
+       local sigspec="$2"
+
+       local cmd="$(trap -p $sigspec)"
+
+       cmd="${cmd#trap -- \'}"
+       cmd="${cmd%\'*}"
+       [ -n "$cmd" ] && cmd="; $cmd"
+       cmd="${arg}$cmd"
+
+       trap "$cmd" $sigspec
+}
+
 error_noexit() {
        report_error "$@"
 }
@@ -6345,10 +6383,7 @@ get_mdtosc_proc_path() {
        local mdt_label=$(convert_facet2label $mds_facet)
        local mdt_index=$(echo $mdt_label | sed -e 's/^.*-//')
 
-       if [ $(lustre_version_code $mds_facet) -le $(version_code 1.8.0) ] ||
-          mds_on_old_device $mds_facet; then
-               echo "${ost_label}-osc"
-       elif [[ $ost_label = *OST* ]]; then
+       if [[ $ost_label = *OST* ]]; then
                echo "${ost_label}-osc-${mdt_index}"
        else
                echo "${ost_label}-osp-${mdt_index}"