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