diff options
Diffstat (limited to 'sys-cluster/openib-osm')
-rw-r--r-- | sys-cluster/openib-osm/ChangeLog | 9 | ||||
-rw-r--r-- | sys-cluster/openib-osm/Manifest | 28 | ||||
-rw-r--r-- | sys-cluster/openib-osm/files/digest-openib-osm-1.1 | 3 | ||||
-rw-r--r-- | sys-cluster/openib-osm/files/opensm.conf | 141 | ||||
-rwxr-xr-x | sys-cluster/openib-osm/files/opensmd | 277 | ||||
-rwxr-xr-x | sys-cluster/openib-osm/files/sldd.sh | 251 | ||||
-rw-r--r-- | sys-cluster/openib-osm/metadata.xml | 10 | ||||
-rw-r--r-- | sys-cluster/openib-osm/openib-osm-1.1.ebuild | 50 |
8 files changed, 769 insertions, 0 deletions
diff --git a/sys-cluster/openib-osm/ChangeLog b/sys-cluster/openib-osm/ChangeLog new file mode 100644 index 000000000..5d7d43eeb --- /dev/null +++ b/sys-cluster/openib-osm/ChangeLog @@ -0,0 +1,9 @@ +# ChangeLog for sys-cluster/openib-osm +# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + +*openib-osm-1.1 (26 Oct 2006) + + 26 Oct 2006; Bryan Green <bgreen@gentoo.org> ChangeLog: + Initial Import + diff --git a/sys-cluster/openib-osm/Manifest b/sys-cluster/openib-osm/Manifest new file mode 100644 index 000000000..8e7f9c298 --- /dev/null +++ b/sys-cluster/openib-osm/Manifest @@ -0,0 +1,28 @@ +AUX opensm.conf 4489 RMD160 aeae8d7a83810d566cdee9e88c0a1f1955e75220 SHA1 c23f628bbd8249593b8ba411f8ebc0f4dd0f735f SHA256 ce257b09663a7cb621fb8ad4193d6831bf7532a57190b38e33e769e0d4890828 +MD5 ca14789c13334ae4f0c0420f7f8dd26c files/opensm.conf 4489 +RMD160 aeae8d7a83810d566cdee9e88c0a1f1955e75220 files/opensm.conf 4489 +SHA256 ce257b09663a7cb621fb8ad4193d6831bf7532a57190b38e33e769e0d4890828 files/opensm.conf 4489 +AUX opensmd 6040 RMD160 740decb4755c133bbccfde897350bda6f92bfb59 SHA1 4d0994a84f55a512e54f403c102789eae8eec673 SHA256 d010b5840632ed8e5f0706bcff8c431a1a147b259d3d15200bbddac2fba045c3 +MD5 0369bb37d2d961977f8b4d4bcb3b0c99 files/opensmd 6040 +RMD160 740decb4755c133bbccfde897350bda6f92bfb59 files/opensmd 6040 +SHA256 d010b5840632ed8e5f0706bcff8c431a1a147b259d3d15200bbddac2fba045c3 files/opensmd 6040 +AUX sldd.sh 6999 RMD160 3df5e20bfda04dc850d1968ead1761e683ae8940 SHA1 ee398a5faf55c0165f9fd04ac8675bd22588e7dc SHA256 3b59effb22f8138c2a12e7115949ca336a19a076cbd0d6690641f55d1d49b5cf +MD5 df48488ea978dd7d068177422c90c6e9 files/sldd.sh 6999 +RMD160 3df5e20bfda04dc850d1968ead1761e683ae8940 files/sldd.sh 6999 +SHA256 3b59effb22f8138c2a12e7115949ca336a19a076cbd0d6690641f55d1d49b5cf files/sldd.sh 6999 +DIST openib-userspace-1.1.tgz 12361548 RMD160 53f69c5b66ac1a9bd7c22ebda39439453802204f SHA1 8993b2724d798f27ed560cf3ce4e8c1b9e6fffb1 SHA256 2e8430443a40eed95f1492c1e11aa515f8b4f20ab431b0cf588032fc6a01d04a +EBUILD openib-osm-1.1.ebuild 1289 RMD160 aab008a0b10599c0ff53f0ca7b98b90f690f77b9 SHA1 6774973c7465028b9ef30c8bd5844c38f2832351 SHA256 adea23adb4e1326676ec3638655774fe2b483613a446dbc00b5422fc225cd0c4 +MD5 68781a5d5fbba0f1f9722ff06221f2d7 openib-osm-1.1.ebuild 1289 +RMD160 aab008a0b10599c0ff53f0ca7b98b90f690f77b9 openib-osm-1.1.ebuild 1289 +SHA256 adea23adb4e1326676ec3638655774fe2b483613a446dbc00b5422fc225cd0c4 openib-osm-1.1.ebuild 1289 +MISC ChangeLog 230 RMD160 a3d624626cf2e3c54b82975ee18daff786a0ba76 SHA1 6b6541b37d7cdf03eee8858ad98b849b1477ef88 SHA256 f71fb8c45e6c6d77478a8da392a5ce07c5898df3898b5848b6e362a4aa28c1b0 +MD5 37c2ea8637c5e70a4fb90fd6d23e4d97 ChangeLog 230 +RMD160 a3d624626cf2e3c54b82975ee18daff786a0ba76 ChangeLog 230 +SHA256 f71fb8c45e6c6d77478a8da392a5ce07c5898df3898b5848b6e362a4aa28c1b0 ChangeLog 230 +MISC metadata.xml 419 RMD160 f9b6f7b72f595559b5fdbf3c2bf6cad3490b5900 SHA1 be8a65515c13b833f49766db58e9486961c65078 SHA256 e33518d9908c9e6ee2629959038228160a7215b5b7e04cab593a9734c40df34b +MD5 52b30da9f1f4eab4753efad40f1538ea metadata.xml 419 +RMD160 f9b6f7b72f595559b5fdbf3c2bf6cad3490b5900 metadata.xml 419 +SHA256 e33518d9908c9e6ee2629959038228160a7215b5b7e04cab593a9734c40df34b metadata.xml 419 +MD5 a3cd89187e71c6edf828b0f4a8a179ef files/digest-openib-osm-1.1 259 +RMD160 853717cd6ffcbf3d4c0f0480af448bf377a81515 files/digest-openib-osm-1.1 259 +SHA256 e8b21d649a2cdcee36ce648f9c48a7e09dda631159b74a5ee24b6a0d65593558 files/digest-openib-osm-1.1 259 diff --git a/sys-cluster/openib-osm/files/digest-openib-osm-1.1 b/sys-cluster/openib-osm/files/digest-openib-osm-1.1 new file mode 100644 index 000000000..09168024a --- /dev/null +++ b/sys-cluster/openib-osm/files/digest-openib-osm-1.1 @@ -0,0 +1,3 @@ +MD5 f7a8e6f92193efe98f7df2e275489906 openib-userspace-1.1.tgz 12361548 +RMD160 53f69c5b66ac1a9bd7c22ebda39439453802204f openib-userspace-1.1.tgz 12361548 +SHA256 2e8430443a40eed95f1492c1e11aa515f8b4f20ab431b0cf588032fc6a01d04a openib-userspace-1.1.tgz 12361548 diff --git a/sys-cluster/openib-osm/files/opensm.conf b/sys-cluster/openib-osm/files/opensm.conf new file mode 100644 index 000000000..58880400d --- /dev/null +++ b/sys-cluster/openib-osm/files/opensm.conf @@ -0,0 +1,141 @@ +# DEBUG mode +# This option specifies a debug option. +# These options are not normally needed. +# The number following -d selects the debug +# option to enable as follows: +# OPT Description +# --- ----------------- +# 0 - Ignore other SM nodes. +# 1 - Force single threaded dispatching. +# 2 - Force log flushing after each log message. +# 3 - Disable multicast support. +# 4 - Put OpenSM in memory tracking mode. +# 10.. Put OpenSM in testability mode. +# none, no debug options are enabled. +DEBUG=none + +# LMC +# This option specifies the subnet's LMC value. +# The number of LIDs assigned to each port is 2^LMC. +# The LMC value must be in the range 0-7. +# LMC values > 0 allow multiple paths between ports. +# LMC values > 0 should only be used if the subnet +# topology actually provides multiple paths between +# ports, i.e. multiple interconnects between switches. +# OpenSM defaults to LMC = 0, which allows +# one path between any two ports. +LMC=0 + +# MAXSMPS +# This option specifies the number of VL15 SMP MADs +# allowed on the wire at any one time. +# Specifying -maxsmps 0 allows unlimited outstanding SMPs. +# Without -maxsmps, OpenSM defaults to a maximum of +# one outstanding SMP. +MAXSMPS=0 + +# REASSIGN_LIDS +# This option causes OpenSM to reassign LIDs to all +# end nodes. Specifying "REASSIGN_LIDS=yes" on a running subnet +# may disrupt subnet traffic. +# With "REASSIGN_LIDS=no", OpenSM attempts to preserve existing +# LID assignments resolving multiple use of same LID. +REASSIGN_LIDS="no" + +# SWEEP +# This option specifies the number of seconds between +# subnet sweeps. Specifying SWEEP=0 disables sweeping. +# OpenSM defaults to a sweep interval of 10 seconds. +SWEEP=10 + +# TIMEOUT +# This option specifies the time in milliseconds +# used for transaction timeouts. +# Specifying -t 0 disables timeouts. +# Without -t, OpenSM defaults to a timeout value of +# 100 milliseconds. +TIMEOUT=200 + + +# OSM_LOG +# This option defines the log to be the given file. +# By default the log goes to /tmp/osm.log. +# For the log to go to standard output use OSM_LOG=stdout. +OSM_LOG=/tmp/osm.log + +# VERBOSE +# This option increases the log verbosity level. +# The "-v" option may be specified multiple times +# to further increase the verbosity level. +# "-V" option sets the maximum verbosity level and +# forces log flushing. +# The "-V" is equivalent to "-vf 0xFF -d 2". +VERBOSE="none" + +# UPDN +# This option activate UPDN algorithm instead of Min Hop +# algorithm (default). +# To switch on UPDN algorithm set UPDN="on" +UPDN="off" + + +# GUID_FILE +# This option only allowed when UPDN algorithm is activated +# It specifies the guid list file from which to fetch the guid list +# The file contain in each line only one valid guid +GUID_FILE="none" + +# This option specifies the local port GUID value +# with which OpenSM should bind. OpenSM may be +# bound to 1 port at a time. +# If GUID given is 0, opensmd use PORT_NUM parameter. +# Without -g (GUID="none"), OpenSM trys to use the default port. +GUID=0 + +# OSM_HOSTS +# The list of all SM's IP addresses in InfiniBand subnet +# Used to handover mechanism +OSM_HOSTS="" + +# OSM_CACHE_DIR +OSM_CACHE_DIR=/var/cache/osm + +# CACHE_OPTIONS +# Cache the given command line options into the file +# /var/cache/osm/opensm.opts for use next invocation +# The cache directory can be changed by the environment +# variable OSM_CACHE_DIR +# Set to '--cache-options' or '-c' in order to enable +CACHE_OPTIONS="none" + +# HONORE_GUID2LID +# This option forces OpenSM to honor the guid2lid file, +# when it comes out of Standby state, if such file exists +# under OSM_CACHE_DIR, and is valid. +# Set to '--honor_guid2lid' or '-x' to enable. +# By default this is FALSE. Will be set automatically to '--honor_guid2lid' +# if OSM_HOSTS includes list of more then one IP addresses. +HONORE_GUID2LID="none" + +# RCP +# This option osed by SLDD daemon for handover mechanism +# to copy local cache file to remote computer +RCP=/usr/bin/scp + +# RSH +# This option osed by SLDD daemon for handover mechanism +# to execute commands on remote computer +RSH=/usr/bin/ssh + +# RESCAN_TIME +# This option osed by SLDD daemon for handover mechanism +# Time between sweep of sldd daemon in seconds +RESCAN_TIME=60 + +# PORT_NUM +# This option defines HCA's port number which OpenSM should bind +PORT_NUM=1 + +# ONBOOT +# To start OpenSM automatically set ONBOOT=yes +ONBOOT=no diff --git a/sys-cluster/openib-osm/files/opensmd b/sys-cluster/openib-osm/files/opensmd new file mode 100755 index 000000000..19b63066b --- /dev/null +++ b/sys-cluster/openib-osm/files/opensmd @@ -0,0 +1,277 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# Based on opensmd script from openfabrics.org, +# Copyright (c) 2006 Mellanox Technologies. All rights reserved. +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need openib + after net # ip net seems to be needed to perform management. +} + +if [ -r /etc/opensm.conf ]; then + . /etc/opensm.conf +fi + +prog=/usr/bin/opensm +bin=${prog##*/} + +# Handover daemon for updating guid2lid cache file +sldd_prog=/usr/bin/sldd.sh +sldd_bin=${sldd_prog##*/} +sldd_pid_file=/var/run/sldd.pid + +# Setting OpenSM start parameters +PID_FILE=/var/run/${bin}.pid + +if [[ -z $DEBUG || "$DEBUG" == "none" ]]; then + DEBUG_FLAG="" +else + DEBUG_FLAG="-d ${DEBUG}" +fi + +if [[ -z $LMC || "$LMC" == "0" ]]; then + LMC_FLAG="" +else + LMC_FLAG="-l ${LMC}" +fi + +if [[ -z $MAXSMPS || "$MAXSMPS" == "0" ]]; then + MAXSMPS_FLAG="" +else + MAXSMPS_FLAG="-maxsmps ${MAXSMPS}" +fi + +if [[ -z $REASSIGN_LIDS || "$REASSIGN_LIDS" == "no" ]]; then + REASSIGN_LIDS_FLAG="" +else + REASSIGN_LIDS_FLAG="-r" +fi + +if [[ -z $SWEEP || "$SWEEP" == "10" ]]; then + SWEEP_FLAG="" +else + SWEEP_FLAG="-s ${SWEEP}" +fi + +if [[ -z $TIMEOUT || "$TIMEOUT" == "100" ]]; then + TIMEOUT_FLAG="" +else + TIMEOUT_FLAG="-t ${TIMEOUT}" +fi + +if [[ -z $OSM_LOG || "$OSM_LOG" == "/tmp/osm.log" ]]; then + OSM_LOG_FLAG="" +else + OSM_LOG_FLAG="-f ${OSM_LOG}" +fi + +if [[ -z $VERBOSE || "$VERBOSE" == "none" ]]; then + VERBOSE_FLAG="" +else + VERBOSE_FLAG="${VERBOSE}" +fi + +if [[ -z $UPDN || "$UPDN" == "off" ]]; then + UPDN_FLAG="" +else + UPDN_FLAG="-u" +fi + +if [[ -z $GUID_FILE || "$GUID_FILE" == "none" ]]; then + GUID_FILE_FLAG="" +else + GUID_FILE_FLAG="-a ${GUID_FILE}" +fi + +if [[ -z $GUID || "$GUID" == "none" ]]; then + GUID_FLAG="" +else + GUID_FLAG="-g ${GUID}" +fi + +if [[ -z $HONORE_GUID2LID || "$HONORE_GUID2LID" == "none" ]]; then + HONORE_GUID2LID_FLAG="" +else + HONORE_GUID2LID_FLAG="--honor_guid2lid" +fi + +if [[ -n "${OSM_HOSTS}" && $(echo -n ${OSM_HOSTS} | wc -w | tr -d '[:space:]') -gt 1 ]]; then + HONORE_GUID2LID_FLAG="--honor_guid2lid" +fi + + +if [[ -z $CACHE_OPTIONS || "$CACHE_OPTIONS" == "none" ]]; then + CACHE_OPTIONS_FLAG="" +else + CACHE_OPTIONS_FLAG="--cache-options" +fi + + +if [ -z $PORT_NUM ]; then + PORT_FLAG=1 +else + PORT_FLAG="${PORT_NUM}" +fi + +# Check if $pid (could be plural) are running +checkpid() { + local i + + for i in $* ; do + [ -d "/proc/$i" ] || return 1 + done + return 0 +} + +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 + + einfo "starting sldd daemon" + $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 + einfo "killing sldd daemon" + kill -15 ${sldd_pid} > /dev/null 2>&1 + fi + +} + +start() { + ebegin "Starting OpenSM Infiniband Subnet Manager" + eindent + + local OSM_PID= + local RC=0 + + 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 + ewarn $"${bin} (pid $pid) is already running..." + else + if [ -n "${HONORE_GUID2LID_FLAG}" ]; then + # Run sldd daemod + start_sldd + fi + + # Start opensm + local START_FLAGS="" + for flag in "$DEBUG_FLAG" "$LMC_FLAG" "$MAXSMPS_FLAG" "$REASSIGN_LIDS_FLAG" "$SWEEP_FLAG" "$TIMEOUT_FLAG" "$OSM_LOG_FLAG" "$VERBOSE_FLAG" "$UPDN_FLAG" "$GUID_FILE_FLAG" "$GUID_FLAG" "$HONORE_GUID2LID_FLAG" "$CACHE_OPTIONS_FLAG" + do + [ ! -z "$flag" ] && START_FLAGS="$START_FLAGS $flag" + done + + echo $PORT_FLAG | $prog $START_FLAGS > /dev/null 2>&1 & + OSM_PID=$! + echo $OSM_PID > $PID_FILE + sleep 1 + checkpid $OSM_PID + RC=$? + fi + + eoutdent + eend $RC +} + +stop() { + ebegin "Stopping OpenSM Infiniband Subnet Manager" + local RC=0 + 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 + kill -15 $pid > /dev/null 2>&1 + cnt=0 + while [ $cnt -lt 6 ]; do + #echo -n "."; + sleep 1; let cnt++ + 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 ] && eerror "$bin shutdown failed" + RC=$((! $RC)) + else + ewarn "$bin does not appear to be running" + RC=1 + fi + + # Remove pid file if any. + rm -f $PID_FILE + + eend $RC +} + diff --git a/sys-cluster/openib-osm/files/sldd.sh b/sys-cluster/openib-osm/files/sldd.sh new file mode 100755 index 000000000..9604b848f --- /dev/null +++ b/sys-cluster/openib-osm/files/sldd.sh @@ -0,0 +1,251 @@ +#!/bin/bash +# +# 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: sldd.sh 7779 2006-06-07 12:05:46Z vlad $ +# + +# 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. + +# config: /etc/opensm.conf + +CONFIG=/etc/opensm.conf + +SLDD_DEBUG=${SLDD_DEBUG:-0} + +if [ ! -f ${CONFIG} ]; then + [ $SLDD_DEBUG -eq 1 ] && + echo "${CONFIG} not found." + exit 0 +fi + +. ${CONFIG} + +CACHE_FILE=${CACHE_FILE:-/var/cache/osm/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 diff --git a/sys-cluster/openib-osm/metadata.xml b/sys-cluster/openib-osm/metadata.xml new file mode 100644 index 000000000..aa628f31d --- /dev/null +++ b/sys-cluster/openib-osm/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>cluster</herd> +<longdescription> +OpenSM provides an implementation for an InfiniBand Subnet Manager and +Administrator. Such a software entity is required to run for in order to +initialize the InfiniBand hardware (at least one per each InfiniBand subnet). +</longdescription> +</pkgmetadata> diff --git a/sys-cluster/openib-osm/openib-osm-1.1.ebuild b/sys-cluster/openib-osm/openib-osm-1.1.ebuild new file mode 100644 index 000000000..e68179c91 --- /dev/null +++ b/sys-cluster/openib-osm/openib-osm-1.1.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +SLOT="0" +LICENSE="|| ( GPL-2 BSD-2 )" + +KEYWORDS="~amd64" + +DESCRIPTION="OpenSM - InfiniBand Subnet Manager and Administration for OpenIB" + +HOMEPAGE="http://www.openfabrics.org/" +#SRC_URI="http://www.openfabrics.org/downloads/openib-userspace-${PV}.tgz" +SRC_URI="http://mirror.gentooscience.org/openib-userspace-${PV}.tgz" +S="${WORKDIR}/openib-userspace-${PV}/src/userspace/management/osm" + +IUSE="" + +DEPEND="=sys-cluster/libibmad-${PV}" +RDEPEND="$DEPEND + =sys-cluster/openib-files-${PV} + net-misc/iputils" # for 'ping' + +src_compile() { + econf || die "could not configure" + emake || die "emake failed" +} + +src_install() { + make DESTDIR="${D}" install || die "install failed" + dodoc AUTHORS README COPYING NEWS ChangeLog + docinto doc + dodoc doc/* + insinto /etc + if [[ $BRANCH="1.0" ]]; then + doins ${FILESDIR}/opensm.conf + dobin ${FILESDIR}/sldd.sh + else + doins ${S}/scripts/opensm.conf + dobin ${S}/scripts/sldd.sh + fi + doinitd ${FILESDIR}/opensmd +} + +pkg_postinst() { + einfo "To automatically configure the infiniband subnet manager on boot," + einfo "edit /etc/opensm.conf and add opensmd to your start-up scripts:" + einfo "\`rc-update add opensmd default\`" +} + |