From: Stan Smith Date: Thu, 27 May 2010 18:00:30 +0000 (+0000) Subject: [OPENSM] remove Linux scripts; add Windows osmtest regression script. X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=691484b64e314384bfa0bc0db8bac8a6b4121044;p=~shefty%2Frdma-win.git [OPENSM] remove Linux scripts; add Windows osmtest regression script. git-svn-id: svn://openib.tc.cornell.edu/gen1@2817 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/ulp/opensm/user/scripts/opensm.init.in b/trunk/ulp/opensm/user/scripts/opensm.init.in deleted file mode 100644 index 997dce5a..00000000 --- a/trunk/ulp/opensm/user/scripts/opensm.init.in +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/bash -# -# opensm: Manage OpenSM -# -# chkconfig: - 09 91 -# description: Manage OpenSM -# -### BEGIN INIT INFO -# Provides: opensm -# Required-Start: $syslog -# Default-Start: none -# Default-Stop: 0 1 6 -# Description: Manage OpenSM -### END INIT INFO -# -# Copyright (c) 2008 Voltaire, Inc. All rights reserved. -# Copyright 2006 PathScale, Inc. All Rights Reserved. -# -# This Software is licensed under one of the following licenses: -# -# 1) under the terms of the "Common Public License 1.0" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/cpl.php. -# -# 2) under the terms of the "The BSD License" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/bsd-license.php. -# -# 3) under the terms of the "GNU General Public License (GPL) Version 2" a -# copy of which is available from the Open Source Initiative, see -# http://www.opensource.org/licenses/gpl-license.php. -# -# Licensee has the right to choose one of the above licenses. -# -# Redistributions of source code must retain the above copyright -# notice and one of the license notices. -# -# Redistributions in binary form must reproduce both the above copyright -# notice, one of the license notices in the documentation -# and/or other materials provided with the distribution. - -prefix=@prefix@ -exec_prefix=@exec_prefix@ - -# Source function library. -if [[ -s /etc/init.d/functions ]]; then - . /etc/init.d/functions - rc_status() { :; } - rc_exit() { exit $RETVAL; } -fi -if [[ -s /etc/rc.status ]]; then - . /etc/rc.status - failure() { rc_status -v; } - success() { rc_status -v; } -fi - -CONFIG=@sysconfdir@/sysconfig/opensm -if [[ -s $CONFIG ]]; then - . $CONFIG -fi - -start () { - echo -n "Starting opensm: " - @sbindir@/opensm --daemon $OPTIONS > /dev/null - if [[ $RETVAL -eq 0 ]]; then - touch /var/lock/subsys/opensm - success - else - failure - fi - echo -} - -stop () { - echo -n "Shutting down opensm: " - killproc opensm - if [[ $RETVAL -eq 0 ]]; then - rm -f /var/lock/subsys/opensm - success - else - failure - fi - echo -} - -Xstatus () { - pid="`pidof opensm`" - ret=$? - if [ $ret -eq 0 ] ; then - echo "OpenSM is running... pid=$pid" - else - echo "OpenSM is not running." - fi -} - -restart() { - stop - start -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - Xstatus - ;; - restart | force-reload | reload) - restart - ;; - try-restart | condrestart) - [ -e /var/lock/subsys/opensm ] && restart - ;; - resweep) - killall -HUP opensm - RETVAL=$? - ;; - rotatelog) - killall -USR1 opensm - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|reload|condrestart|resweep|rotatelog}" - RETVAL=1 - ;; -esac - -_rc_status_all=$RETVAL -rc_exit diff --git a/trunk/ulp/opensm/user/scripts/opensm.logrotate b/trunk/ulp/opensm/user/scripts/opensm.logrotate deleted file mode 100644 index ee5a455f..00000000 --- a/trunk/ulp/opensm/user/scripts/opensm.logrotate +++ /dev/null @@ -1,7 +0,0 @@ -/var/log/opensm.log { - missingok - notifempty - copytruncate - weekly - compress -} diff --git a/trunk/ulp/opensm/user/scripts/opensm.sysconfig b/trunk/ulp/opensm/user/scripts/opensm.sysconfig deleted file mode 100644 index 2d723503..00000000 --- a/trunk/ulp/opensm/user/scripts/opensm.sysconfig +++ /dev/null @@ -1,2 +0,0 @@ -# It will be used for sldd.sh -OSM_HOSTS="" diff --git a/trunk/ulp/opensm/user/scripts/osm-regress.bat b/trunk/ulp/opensm/user/scripts/osm-regress.bat new file mode 100644 index 00000000..9229f91e --- /dev/null +++ b/trunk/ulp/opensm/user/scripts/osm-regress.bat @@ -0,0 +1,45 @@ +@echo off +setlocal + +rem requires cmd.exe /E /V, make it so... JLP +set F=on +set F=off +if "!F!" == "off" goto OK + +%comspec% /E:on /V:on /C %0 %1 %2 +exit /B %ERRORLEVEL% + +:OK + +if "%1" == "" ( +:usage + echo usage: osm-regress results-filename {exit-on-error} + exit /B 1 +) +if exist "%1" del /Q "%1" + +rem if not exist "osmtest.dat" ( +rem echo missing inventory file .\osmtest.dat ? +rem exit /B 1 +rem ) + +rem set T=..\..\..\bin\user\objchk_wlh_amd64\amd64\osmtest.exe +set T=osmtest.exe + +rem Event forwarding test 'e' is not yet implemented [3.3.5] + +set TESTS="c" "v" "m -M1" "m -M2" "m -M3" "m -M4" "f -s1" "f -s2" "f -s3" "f -s4" "s" "a" +rem set TESTS="c" "v" "a" "f -s1" "f -s2" "f -s3" "f -s4" "s" + +for %%t in ( %TESTS% ) DO ( + echo TEST: osmtest -f %%~t + echo TEST: osmtest -f %%~t >> %1 + %T% -f %%~t >> %1 + if !ERRORLEVEL! NEQ 0 ( + echo Error !ERRORLEVEL! reported in osmtest -f %%~t ? + if Not "%2" == "" exit /B 1 + ) + echo. >> %1 + echo PASS. +) +endlocal diff --git a/trunk/ulp/opensm/user/scripts/redhat-opensm.init.in b/trunk/ulp/opensm/user/scripts/redhat-opensm.init.in deleted file mode 100644 index 71d95d5d..00000000 --- a/trunk/ulp/opensm/user/scripts/redhat-opensm.init.in +++ /dev/null @@ -1,292 +0,0 @@ -#!/bin/bash -# -# Bring up/down opensm -# -# chkconfig: - 15 85 -# description: Activates/Deactivates InfiniBand Subnet Manager -# -### BEGIN INIT INFO -# Provides: opensm -### END INIT INFO -# -# Copyright (c) 2008 Voltaire, Inc. All rights reserved. -# Copyright (c) 2006 Mellanox Technologies. All rights reserved. -# -# This Software is licensed under one of the following licenses: -# -# 1) under the terms of the "Common Public License 1.0" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/cpl.php. -# -# 2) under the terms of the "The BSD License" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/bsd-license.php. -# -# 3) under the terms of the "GNU General Public License (GPL) Version 2" a -# copy of which is available from the Open Source Initiative, see -# http://www.opensource.org/licenses/gpl-license.php. -# -# Licensee has the right to choose one of the above licenses. -# -# Redistributions of source code must retain the above copyright -# notice and one of the license notices. -# -# Redistributions in binary form must reproduce both the above copyright -# notice, one of the license notices in the documentation -# and/or other materials provided with the distribution. -# -# -# $Id: openib-1.0-opensm.init,v 1.5 2006/08/02 18:18:23 dledford Exp $ -# -# processname: @sbindir@/opensm -# config: @sysconfdir@/sysconfig/opensm -# pidfile: /var/run/opensm.pid - -prefix=@prefix@ -exec_prefix=@exec_prefix@ - -. /etc/rc.d/init.d/functions - -CONFIG=@sysconfdir@/sysconfig/opensm -if [ -f $CONFIG ]; then - . $CONFIG -fi - -prog=@sbindir@/opensm -bin=${prog##*/} - -# Handover daemon for updating guid2lid cache file -sldd_prog=@sbindir@/sldd.sh -sldd_bin=${sldd_prog##*/} -sldd_pid_file=/var/run/sldd.pid - -ACTION=$1 - -# Setting OpenSM start parameters -PID_FILE=/var/run/${bin}.pid -touch $PID_FILE - -if [[ -n "${OSM_HOSTS}" && $(echo -n ${OSM_HOSTS} | wc -w | tr -d '[:space:]') -gt 1 ]]; then - HONORE_GUID2LID="--honor_guid2lid" -fi - -######################################################################### - -start_sldd() -{ - if [ -f $sldd_pid_file ]; then - local line p - read line < $sldd_pid_file - for p in $line ; do - [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && sldd_pid="$sldd_pid $p" - done - fi - - if [ -z "$sldd_pid" ]; then - sldd_pid=`pidof -x $sldd_bin` - fi - - if [ -n "${sldd_pid:-}" ] ; then - kill -9 ${sldd_pid} > /dev/null 2>&1 - fi - - $sldd_prog > /dev/null 2>&1 & - sldd_pid=$! - - echo ${sldd_pid} > $sldd_pid_file - # Sleep is needed in order to update local gid2lid cache file before running opensm - sleep 3 -} - -stop_sldd() -{ - if [ -f $sldd_pid_file ]; then - local line p - read line < $sldd_pid_file - for p in $line ; do - [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && sldd_pid="$sldd_pid $p" - done - fi - - if [ -z "$sldd_pid" ]; then - sldd_pid=`pidof -x $sldd_bin` - fi - - if [ -n "${sldd_pid:-}" ] ; then - kill -15 ${sldd_pid} > /dev/null 2>&1 - fi - -} - -start() -{ - local OSM_PID= - - pid="" - - if [ -f $PID_FILE ]; then - local line p - read line < $PID_FILE - for p in $line ; do - [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p" - done - fi - - if [ -z "$pid" ]; then - pid=`pidof -o $$ -o $PPID -o %PPID -x $bin` - fi - - if [ -n "${pid:-}" ] ; then - echo $"${bin} (pid $pid) is already running..." - else - - if [ -n "${HONORE_GUID2LID}" ]; then - # Run sldd daemod - start_sldd - fi - - # Start opensm - echo -n "Starting IB Subnet Manager" - $prog --daemon ${HONORE_GUID2LID} ${OPTIONS} > /dev/null - cnt=0; alive=0 - while [ $cnt -lt 6 -a $alive -ne 1 ]; do - echo -n "."; - sleep 1 - alive=0 - OSM_PID=`pidof $prog` - if [ "$OSM_PID" != "" ]; then - alive=1 - fi - let cnt++; - done - - echo $OSM_PID > $PID_FILE - checkpid $OSM_PID - RC=$? - [ $RC -eq 0 ] && echo_success || echo_failure - [ $RC -eq 0 ] && touch /var/lock/subsys/opensm - echo - - fi -return $RC -} - -stop() -{ - local pid= - local pid1= - local pid2= - - # Stop sldd daemon - stop_sldd - - if [ -f $PID_FILE ]; then - local line p - read line < $PID_FILE - for p in $line ; do - [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid1="$pid1 $p" - done - fi - - pid2=`pidof -o $$ -o $PPID -o %PPID -x $bin` - - pid=`echo "$pid1 $pid2" | sed -e 's/\ /\n/g' | sort -n | uniq | sed -e 's/\n/\ /g'` - - if [ -n "${pid:-}" ] ; then - # Kill opensm - echo -n "Stopping IB Subnet Manager." - kill -15 $pid > /dev/null 2>&1 - cnt=0; alive=1 - while [ $cnt -lt 6 -a $alive -ne 0 ]; do - echo -n "."; - alive=0 - for p in $pid; do - if checkpid $p ; then alive=1; echo -n "-"; fi - done - let cnt++; - sleep $alive - done - - for p in $pid - do - while checkpid $p ; do - kill -KILL $p > /dev/null 2>&1 - echo -n "+" - sleep 1 - done - done - checkpid $pid - RC=$? - [ $RC -eq 0 ] && echo_failure || echo_success - echo - RC=$((! $RC)) - else - echo -n "Stopping IB Subnet Manager." - echo_failure - echo - RC=1 - fi - - # Remove pid file if any. - rm -f $PID_FILE - rm -f /var/lock/subsys/opensm - return $RC -} - -status() -{ - local pid - - # First try "pidof" - pid=`pidof -o $$ -o $PPID -o %PPID -x ${bin}` - if [ -n "$pid" ]; then - echo $"${bin} (pid $pid) is running..." - return 0 - fi - - # Next try "/var/run/opensm.pid" files - if [ -f $PID_FILE ] ; then - read pid < $PID_FILE - if [ -n "$pid" ]; then - echo $"${bin} dead but pid file $PID_FILE exists" - return 1 - fi - fi - echo $"${bin} is stopped" - return 3 -} - - - -case $ACTION in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - status) - status - ;; - condrestart) - pid=`pidof -o $$ -o $PPID -o %PPID -x $bin` - if [ -n "$pid" ]; then - stop - sleep 1 - start - fi - ;; - *) - echo - echo "Usage: `basename $0` {start|stop|restart|status}" - echo - exit 1 - ;; -esac - -RC=$? -exit $RC diff --git a/trunk/ulp/opensm/user/scripts/sldd.sh.in b/trunk/ulp/opensm/user/scripts/sldd.sh.in deleted file mode 100644 index b661f0f2..00000000 --- a/trunk/ulp/opensm/user/scripts/sldd.sh.in +++ /dev/null @@ -1,246 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2008 Voltaire, Inc. All rights reserved. -# Copyright (c) 2006 Mellanox Technologies. All rights reserved. -# -# This Software is licensed under one of the following licenses: -# -# 1) under the terms of the "Common Public License 1.0" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/cpl.php. -# -# 2) under the terms of the "The BSD License" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/bsd-license.php. -# -# 3) under the terms of the "GNU General Public License (GPL) Version 2" a -# copy of which is available from the Open Source Initiative, see -# http://www.opensource.org/licenses/gpl-license.php. -# -# Licensee has the right to choose one of the above licenses. -# -# Redistributions of source code must retain the above copyright -# notice and one of the license notices. -# -# Redistributions in binary form must reproduce both the above copyright -# notice, one of the license notices in the documentation -# and/or other materials provided with the distribution. -# -# - -# OpenSM found to have the following problem -# when handover is performed: -# If some of the cluster nodes are rebooted during the handover they loose their LID assignment. -# The reason for it is that the standby SM does not obey its own Guid to LID table -# and simply uses the discovered LIDs. If some nodes are not available for it -# their previous LID assignment is lost forever. - -# The idea is to use an external daemon that will distribute -# the semi-static LID assignment table from the master SM to all standby SMs. -# A standby SM, becoming a master . needs to obey the copied semi static LID assignment table. - -prefix=@prefix@ -exec_prefix=@exec_prefix@ - -CONFIG=@sysconfdir@/sysconfig/opensm -if [ -f $CONFIG ]; then - . $CONFIG -fi - -SLDD_DEBUG=${SLDD_DEBUG:-0} - -CACHE_FILE=${CACHE_FILE:-/var/cache/opensm/guid2lid} -CACHE_DIR=$(dirname ${CACHE_FILE}) -tmp_cache=${CACHE_FILE}.tmp - -PING='ping -w 1 -c 1' - -RCP=${RCP:-/usr/bin/scp} -RSH=${RSH:-/usr/bin/ssh} -IFCONFIG=${IFCONFIG:-'/sbin/ifconfig -a'} - -declare -i SLDD_DEBUG -RESCAN_TIME=${RESCAN_TIME:-60} - -if [ -z "${OSM_HOSTS}" ]; then - [ $SLDD_DEBUG -eq 1 ] && - echo "No OpenSM servers (OSM_HOSTS) configured for the IB subnet." - exit 0 -fi - - -declare -a arr_OSM_HOSTS -arr_OSM_HOSTS=(${OSM_HOSTS}) - -num_of_osm_hosts=${#arr_OSM_HOSTS[@]} - -if [ ${num_of_osm_hosts} -eq 1 ]; then - [ $SLDD_DEBUG -eq 1 ] && - echo "One OpenSM server configured in the IB subnet." && - echo "Nothing to be done for SLDD" - - exit 0 -fi - -trap 'trap_handler' 15 - -trap_handler() -{ - logger -i "SLDD: Exiting." - exit 0 -} - -is_alive() -{ - $PING $1 > /dev/null 2>&1 - return $? -} - -is_local() -{ - $IFCONFIG | grep -w "$1" > /dev/null 2>&1 - return $? -} - -update_remote_cache() -{ - /bin/rm -f ${CACHE_FILE}.upd - /bin/cp -a ${CACHE_FILE} ${CACHE_FILE}.upd - - [ $SLDD_DEBUG -eq 1 ] && - echo "Updating remote cache file" - - for host in ${OSM_HOSTS} - do - # Skip local host update - if [ "${host}" == "${local_host}" ]; then - continue - fi - - if is_alive $host; then - stat=$($RSH $host "/bin/mkdir -p ${CACHE_DIR} > /dev/null 2>&1; /bin/rm -f ${CACHE_FILE}.${local_host} > /dev/null 2>&1; echo \$?" | tr -d '[:space:]') - if [ "X${stat}" == "X0" ]; then - [ $SLDD_DEBUG -eq 1 ] && - echo "Updating $host" - logger -i "SLDD: updating $host with ${CACHE_FILE}" - $RCP ${CACHE_FILE}.upd ${host}:${CACHE_FILE}.${local_host} - /bin/cp ${CACHE_FILE}.upd ${CACHE_FILE}.${host} - else - [ $SLDD_DEBUG -eq 1 ] && - echo "$RSH to $host failed." - logger -i "SLDD: Failed to update $host with ${CACHE_FILE}. $RSH without password should be enabled" - exit 5 - fi - else - [ $SLDD_DEBUG -eq 1 ] && - echo "$host is down." - continue - fi - done -} - -get_latest_remote_cache() -{ - # Find most updated remote cache file (the suffix should be like ip address: *.*.*.*) - echo -n "$(/bin/ls -1t ${CACHE_FILE}.*.* 2> /dev/null | head -1)" -} - -get_largest_remote_cache() -{ - # Find largest (size) remote cache file (the suffix should be like ip address: *.*.*.*) - echo -n "$(/bin/ls -1S ${CACHE_FILE}.*.* 2> /dev/null | head -1)" -} - -swap_cache_files() -{ - /bin/rm -f ${CACHE_FILE}.old - /bin/mv ${CACHE_FILE} ${CACHE_FILE}.old - /bin/cp ${largest_remote_cache} ${CACHE_FILE} - touch ${CACHE_FILE}.tmp -} - -# Find local host in the osm hosts list -local_host="" -for host in ${OSM_HOSTS} -do - if is_local $host; then - local_host=${host} - fi -done - -# Get cache file info -declare -i new_size=0 -declare -i last_size=0 -declare -i largest_remote_cache_size=0 - -if [ -e ${CACHE_FILE} ]; then - last_size=$(du -b ${CACHE_FILE} | awk '{print$1}' | tr -d '[:space:]') -else - touch ${CACHE_FILE} ${CACHE_FILE}.tmp -fi - -# if [ ${last_size} -gt 0 ]; then -# # First time update -# update_remote_cache -# fi - -while true -do - if [ -s "${CACHE_FILE}" ]; then - new_size=$(du -b ${CACHE_FILE} | awk '{print$1}' | tr -d '[:space:]') - # Check if local cache file grew from its last version or the time stamp changed - if [ ${new_size} -gt ${last_size} ] - [ "$(/bin/ls -1t ${CACHE_FILE} ${CACHE_FILE}.tmp 2> /dev/null | head -1)" != "${CACHE_FILE}.tmp" ]; then - largest_remote_cache=$(get_largest_remote_cache) - if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then - largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]') - else - largest_remote_cache_size=0 - fi - - # Check if local cache file larger than remote chache file - if [ ${new_size} -gt ${largest_remote_cache_size} ]; then - [ $SLDD_DEBUG -eq 1 ] && - echo "Local cache file larger then remote. Update remote cache files" - last_size=${new_size} - update_remote_cache - continue - fi - fi - - largest_remote_cache=$(get_largest_remote_cache) - if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then - largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]') - else - largest_remote_cache_size=0 - fi - - # Update local cache file from remote - if [ ${largest_remote_cache_size} -gt ${new_size} ]; then - [ $SLDD_DEBUG -eq 1 ] && - echo "Local cache file shorter then remote. Use ${largest_remote_cache}" - logger -i "SLDD: updating local cache file with ${largest_remote_cache}" - swap_cache_files - last_size=${largest_remote_cache_size} - fi - - else # The local cache file is empty - [ $SLDD_DEBUG -eq 1 ] && - echo "${CACHE_FILE} is empty" - - largest_remote_cache=$(get_largest_remote_cache) - if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then - # Copy it to the current cache - [ $SLDD_DEBUG -eq 1 ] && - echo "Local cache file is empty. Use ${largest_remote_cache}" - logger -i "SLDD: updating local cache file with ${largest_remote_cache}" - swap_cache_files - fi - - fi - - [ $SLDD_DEBUG -eq 1 ] && - echo "Sleeping ${RESCAN_TIME} seconds." - sleep ${RESCAN_TIME} - -done