opensm/opensm.launch
Doug Ledford 39a5c52144 Various updates
- Drop the old sysv init script
- Fix opensm-launch to restart opensm in a loop.  This works around the
  fact that systemd starts opensm so early that we very well might not
  have sync on the link yet.  Without the physical link being up, opensm
  exits immediately.  This way opensm will get restarted every 30 seconds
  until sync is active on the link or until the opensm service is
  stopped.
- Always install the newly generated opensm-%%{version}.conf as
  opensm.conf
- Make the launch work properly in the event that no GUIDs are
  set and there are no numbered config files

Signed-off-by: Doug Ledford <dledford@redhat.com>
2013-03-25 15:29:03 -04:00

45 lines
946 B
XML

#!/bin/bash
#
# Launch the necessary OpenSM daemons for systemd
#
# sysconfig: /etc/sysconfig/opensm
# config: /etc/rdma/opensm.conf
#
shopt -s nullglob
prog=/usr/sbin/opensm
[ -f /etc/sysconfig/opensm ] && . /etc/sysconfig/opensm
[ -n "$PRIORITY" ] && prio="-p $PRIORITY"
if [ -z "$GUIDS" ]; then
CONFIGS=""
CONFIG_CNT=0
for conf in /etc/rdma/opensm.conf.[0-9]*; do
CONFIGS="$CONFIGS $conf"
let CONFIG_CNT++
done
else
GUID_CNT=0
for guid in $GUIDS; do
let GUID_CNT++
done
fi
# Start opensm
if [ -n "$GUIDS" ]; then
SUBNET_COUNT=0
for guid in $GUIDS; do
SUBNET_PREFIX=`printf "0xfe800000000000%02d" $SUBNET_COUNT`
(while true; do $prog -B $prio -g $guid --subnet_prefix $SUBNET_PREFIX; sleep 30; done) &
let SUBNET_COUNT++
done
elif [ -n "$CONFIGS" ]; then
for config in $CONFIGS; do
(while true; do $prog -B $prio -F $config; sleep 30; done) &
done
else
(while true; do $prog -B $prio; sleep 30; done) &
fi
exit 0