Whamcloud - gitweb
LU-14034 hsm: add PID file handling to lhsmtool_posix
[fs/lustre-release.git] / lustre / tests / sanity-hsm.sh
index 87b270a..37ebd70 100755 (executable)
@@ -84,7 +84,7 @@ CLIENT2=${CLIENT2:-$CLIENT1}
 
 search_copytools() {
        local hosts=${1:-$(facet_active_host $SINGLEAGT)}
-       do_nodesv $hosts "libtool execute pgrep -x $HSMTOOL"
+       do_nodesv $hosts "pgrep --pidfile=$HSMTOOL_PID_FILE hsmtool"
 }
 
 wait_copytools() {
@@ -148,7 +148,7 @@ fid2archive()
        local fid="$1"
 
        case "$HSMTOOL" in
-       lhsmtool_posix)
+       *lhsmtool_posix)
                printf "%s" "$(hsm_root)/*/*/*/*/*/*/$fid"
                ;;
        esac
@@ -168,9 +168,8 @@ get_copytool_event_log() {
 copytool_suspend() {
        local agents=${1:-$(facet_active_host $SINGLEAGT)}
 
-       stack_trap \
-               "do_nodesv $agents libtool execute pkill -CONT -x '$HSMTOOL' || true" EXIT
-       do_nodesv $agents "libtool execute pkill -STOP -x $HSMTOOL" || return 0
+       stack_trap "pkill_copytools $agents CONT || true" EXIT
+       pkill_copytools $agents STOP || return 0
        echo "Copytool is suspended on $agents"
 }
 
@@ -488,7 +487,8 @@ get_agent_uuid() {
 
        # Lustre mount-point is mandatory and last parameter on
        # copytool cmd-line.
-       local mntpnt=$(do_rpc_nodes $agent libtool execute ps -C $HSMTOOL -o args= |
+       local mntpnt=$(do_rpc_nodes $agent \
+                       pgrep --pidfile=$HSMTOOL_PID_FILE --list-full hsmtool |
                       awk '{print $NF}')
        [ -n "$mntpnt" ] || error "Found no Agent or with no mount-point "\
                                  "parameter"