From a4c19b67a39ef4fadf831a69e63588f4df4207ba Mon Sep 17 00:00:00 2001 From: Doug Ledford Date: Jun 30 2008 23:33:50 +0000 Subject: - Initial package for Fedora review process --- diff --git a/.cvsignore b/.cvsignore index e69de29..78cfadd 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +opensm-3.2.1.tar.gz diff --git a/opensm-3.2.1-rpath.patch b/opensm-3.2.1-rpath.patch new file mode 100644 index 0000000..871dcbb --- /dev/null +++ b/opensm-3.2.1-rpath.patch @@ -0,0 +1,113 @@ +--- opensm-3.2.1/libvendor/Makefile.am.rpath 2008-01-15 15:23:51.000000000 -0500 ++++ opensm-3.2.1/libvendor/Makefile.am 2008-06-30 11:03:22.000000000 -0400 +@@ -94,8 +94,8 @@ EXTRA_DIST = $(srcdir)/libosmvendor.map + # name. What we can do it create a link to the installed file such + # that it will mark it with an alias... + # we find the new lib by traversing the links +-install-exec-hook: +- if test -L $(DESTDIR)/$(libdir)/libosmvendor-$(VERSION).so; then rm $(DESTDIR)/$(libdir)/libosmvendor-$(VERSION).so; fi; \ +- lname=`\ls -l $(DESTDIR)/$(libdir)/libosmvendor.so | awk '{print $$NF}'`; \ +- ln -s $$lname $(DESTDIR)/$(libdir)/libosmvendor_$(with_osmv).so; \ +- ln -s $$lname $(DESTDIR)/$(libdir)/libosmvendor-$(VERSION).so ++#install-exec-hook: ++# if test -L $(DESTDIR)/$(libdir)/libosmvendor-$(VERSION).so; then rm $(DESTDIR)/$(libdir)/libosmvendor-$(VERSION).so; fi; \ ++# lname=`\ls -l $(DESTDIR)/$(libdir)/libosmvendor.so | awk '{print $$NF}'`; \ ++# ln -s $$lname $(DESTDIR)/$(libdir)/libosmvendor_$(with_osmv).so; \ ++# ln -s $$lname $(DESTDIR)/$(libdir)/libosmvendor-$(VERSION).so +--- opensm-3.2.1/opensm/Makefile.am.rpath 2008-03-12 17:43:16.000000000 -0400 ++++ opensm-3.2.1/opensm/Makefile.am 2008-06-30 11:11:40.000000000 -0400 +@@ -79,7 +79,7 @@ endif + if OSMV_SIM + USEGPPLINK = $(LIBTOOL) --mode=link g++ $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ + libopensm.la: $(libopensm_la_OBJECTS) $(libopensm_la_DEPENDENCIES) +- $(USEGPPLINK) -rpath $(libdir) $(libopensm_la_LDFLAGS) $(libopensm_la_OBJECTS) $(libopensm_la_LIBADD) $(LIBS) ++ $(USEGPPLINK) $(libopensm_la_LDFLAGS) $(libopensm_la_OBJECTS) $(libopensm_la_LIBADD) $(LIBS) + opensm$(EXEEXT): $(opensm_OBJECTS) $(opensm_DEPENDENCIES) + @rm -f opensm$(EXEEXT) + $(USEGPPLINK) $(opensm_LDFLAGS) $(opensm_OBJECTS) $(opensm_LDADD) $(LIBS) +@@ -87,9 +87,9 @@ endif + + # we need to be able to load libraries from local build subtree before make install + # we always give precedence to local tree libs and then use the pre-installed ones. +-opensm_LDADD = -L../complib -L../libvendor -L. $(OSMV_LDADD) -lopensm -losmcomp -losmvendor ++opensm_LDADD = -L../complib -losmcomp -L../libvendor -losmvendor -L. -lopensm + +-opensm_LDFLAGS = -Wl,--rpath -Wl,$(libdir) -lpthread -ldl ++opensm_LDFLAGS = -lpthread -ldl + + opensmincludedir = $(includedir)/infiniband/opensm + +@@ -124,10 +124,10 @@ EXTRA_DIST = $(srcdir)/libopensm.map $(s + # name. What we can do it create a link to the installed file such + # that it will mark it with an alias... + # we find the new lib by traversing the links +-install-exec-hook: +- if test -L $(DESTDIR)/$(libdir)/libopensm-$(VERSION).so; then rm $(DESTDIR)/$(libdir)/libopensm-$(VERSION).so; fi; \ +- lname=`\ls -l $(DESTDIR)/$(libdir)/libopensm.so | awk '{print $$NF}'`; \ +- ln -s $$lname $(DESTDIR)/$(libdir)/libopensm-$(VERSION).so ++#install-exec-hook: ++# if test -L $(DESTDIR)/$(libdir)/libopensm-$(VERSION).so; then rm $(DESTDIR)/$(libdir)/libopensm-$(VERSION).so; fi; \ ++# lname=`\ls -l $(DESTDIR)/$(libdir)/libopensm.so | awk '{print $$NF}'`; \ ++# ln -s $$lname $(DESTDIR)/$(libdir)/libopensm-$(VERSION).so + + # generate c and h files from the lex and yacc files + dist-hook: $(srcdir)/osm_qos_parser_y.c $(srcdir)/osm_qos_parser_l.c +--- opensm-3.2.1/osmtest/Makefile.am.rpath 2008-03-12 17:43:17.000000000 -0400 ++++ opensm-3.2.1/osmtest/Makefile.am 2008-06-30 11:03:22.000000000 -0400 +@@ -18,10 +18,10 @@ osmtest_CFLAGS = -Wall $(OSMV_CFLAGS) -D + else + osmtest_CFLAGS = -Wall $(OSMV_CFLAGS) -DVENDOR_RMPP_SUPPORT $(DBGFLAGS) + endif +-osmtest_LDADD = -L../complib -L../libvendor -L../opensm -L$(libdir) -L. \ +- $(OSMV_LDADD) -lopensm -losmcomp -losmvendor ++osmtest_LDADD = -L../complib -losmcomp -L../libvendor -losmvendor \ ++ -L../opensm -lopensm + +-osmtest_LDFLAGS = -Wl,--rpath -Wl,$(libdir) -lpthread -L../opensm ++osmtest_LDFLAGS = -lpthread + # for linking with the simulator client library we have to use g++: + if OSMV_SIM + USEGPPLINK = $(LIBTOOL) --mode=link g++ $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +--- opensm-3.2.1/complib/Makefile.am.rpath 2008-03-12 17:43:16.000000000 -0400 ++++ opensm-3.2.1/complib/Makefile.am 2008-06-30 11:03:22.000000000 -0400 +@@ -85,7 +85,7 @@ EXTRA_DIST = $(srcdir)/libosmcomp.map $( + # name. What we can do it create a link to the installed file such + # that it will mark it with an alias... + # we find the new lib by traversing the links +-install-exec-hook: +- if test -L $(DESTDIR)/$(libdir)/libosmcomp-$(VERSION).so; then rm $(DESTDIR)/$(libdir)/libosmcomp-$(VERSION).so; fi; \ +- lname=`\ls -l $(DESTDIR)/$(libdir)/libosmcomp.so | awk '{print $$NF}'`; \ +- ln -s $$lname $(DESTDIR)/$(libdir)/libosmcomp-$(VERSION).so ++#install-exec-hook: ++# if test -L $(DESTDIR)/$(libdir)/libosmcomp-$(VERSION).so; then rm $(DESTDIR)/$(libdir)/libosmcomp-$(VERSION).so; fi; \ ++# lname=`\ls -l $(DESTDIR)/$(libdir)/libosmcomp.so | awk '{print $$NF}'`; \ ++# ln -s $$lname $(DESTDIR)/$(libdir)/libosmcomp-$(VERSION).so +--- opensm-3.2.1/Makefile.am.rpath 2008-03-12 17:43:16.000000000 -0400 ++++ opensm-3.2.1/Makefile.am 2008-06-30 11:03:22.000000000 -0400 +@@ -9,16 +9,16 @@ MAINTAINERCLEANFILES = Makefile.in acloc + ACLOCAL = aclocal -I $(ac_aux_dir) + + # we should provide a hint for other apps about the build mode of this project +-install-exec-hook: +- mkdir -p $(DESTDIR)/$(includedir) +-if DEBUG +- echo "define osm_build_type \"debug\"" > $(DESTDIR)/$(includedir)/infiniband/opensm/osm_build_id.h +-else +- echo "define osm_build_type \"free\"" > $(DESTDIR)/$(includedir)/infiniband/opensm/osm_build_id.h +-endif +- $(top_srcdir)/config/install-sh -m 755 -d $(DESTDIR)/$(sysconfdir)/init.d +- cp $(top_builddir)/scripts/opensm.init $(DESTDIR)/$(sysconfdir)/init.d/opensmd +- chmod 755 $(DESTDIR)/$(sysconfdir)/init.d/opensmd ++#install-exec-hook: ++# mkdir -p $(DESTDIR)/$(includedir) ++#if DEBUG ++# echo "define osm_build_type \"debug\"" > $(DESTDIR)/$(includedir)/infiniband/opensm/osm_build_id.h ++#else ++# echo "define osm_build_type \"free\"" > $(DESTDIR)/$(includedir)/infiniband/opensm/osm_build_id.h ++#endif ++# $(top_srcdir)/config/install-sh -m 755 -d $(DESTDIR)/$(sysconfdir)/init.d ++# cp $(top_builddir)/scripts/opensm.init $(DESTDIR)/$(sysconfdir)/init.d/opensmd ++# chmod 755 $(DESTDIR)/$(sysconfdir)/init.d/opensmd + + + man_MANS = man/opensm.8 man/osmtest.8 diff --git a/opensm.conf b/opensm.conf new file mode 100644 index 0000000..5db81dc --- /dev/null +++ b/opensm.conf @@ -0,0 +1,129 @@ +OPTIONS="-B" +# 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. +# OPTIONS="$OPTIONS -d 1" + +# 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. +# OPTIONS="$OPTIONS -l 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 +# four outstanding SMP. +OPTIONS="$OPTIONS -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. +# OPTIONS="$OPTIONS -r" + +# 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. +# OPTIONS="$OPTIONS -s 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 +# 200 milliseconds. +# OPTIONS="$OPTIONS -t 200" + +# OSM_LOG +# This option defines the log to be the given file. +# By default the log goes to /tmp/osm.log, which isn't very suitable +# for a distribution, so we override it by default here. +# For the log to go to standard output use OSM_LOG=stdout. +OPTIONS="$OPTIONS -f /var/log/opensm.log" + +# QoS +# This option enable QoS support in opensm +# OPTIONS="$OPTIONS -Q" + +# QoS_POLICY +# This option sets the file from which to load the QoS policy +# OPTIONS="$OPTIONS -Y /etc/rdma/qos_policy" + +# 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". +# OPTIONS="$OPTIONS -v 0x00" + +# ROUTING_ENGINE +# This option chooses the routing engine to use instead of the default +# algorithm Min Hop +# Supported engines are: updn, file, ftree, lash, dor +# OPTIONS="$OPTIONS -R updn" + +# ROOT_GUID_FILE +# This option only allowed when UPDN algorithm is activated +# It specifies the guid list file from which to fetch the root node guid list +# The file contain in each line only one valid guid +# OPTIONS="$OPTIONS -a /etc/rdma/root_guids" + +# CN_GUID_FILE +# This option only allowed when UPDN algorithm is activated +# It specifies the guid list file from which to fetch the compute node +# guid list +# The file contain in each line only one valid guid +# OPTIONS="$OPTIONS -u /etc/rdma/cn_guids" + +# GUID +# 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, opensm would list the available guids and wait for +# the user to select one (which obviously is no use in an init script) +# Without -g, OpenSM trys to use the default port. +# OPTIONS="$OPTIONS -g " + +# PRIORITY +# This option specifies the SM's PRIORITY. +# This will effect the handover cases, where master +# is chosen by priority and GUID. Range goes +# from 0 (lowest priority) to 15 (highest). +OPTIONS="$OPTIONS -p 15" + +# OSM_CACHE_DIR +# There is no command line option to opensm to set this, it can only be set +# as an environment variable. +OSM_CACHE_DIR=/var/cache/opensm + +# CACHE_OPTIONS +# Cache the given command line options into the file +# OSM_CACHE_DIR/opensm.opts for use next invocation +# Set to '--cache-options' or '-c' in order to enable +# OPTIONS="$OPTIONS -c" + diff --git a/opensm.initd b/opensm.initd new file mode 100644 index 0000000..5d62e47 --- /dev/null +++ b/opensm.initd @@ -0,0 +1,132 @@ +#!/bin/bash +# +# Bring up/down opensm +# +# chkconfig: - 15 85 +# description: Activates/Deactivates InfiniBand Subnet Manager +# config: /etc/rdma/opensm.conf +# +### BEGIN INIT INFO +# Provides: opensm +# Default-Stop: 0 1 2 3 4 5 6 +# Required-Start: $rdma +# Short-Description: Starts/Stops the InfiniBand Subnet Manager +# Description: Starts/Stops the InfiniBand Subnet Manager +### END INIT INFO + +. /etc/rc.d/init.d/functions + +prog=/usr/sbin/opensm +CONFIG=/etc/rdma/opensm.conf +PID_FILE=/var/run/opensm.pid + +start() +{ + local OSM_PID= + if [ ! -f $CONFIG ]; then + echo -n "Starting opensm: $CONFIG missing" + echo_failure + return 6 + fi + . $CONFIG + [ -f /var/lock/subsys/opensm ] && return 0 + # Start opensm + echo -n "Starting IB Subnet Manager:" + $prog $OPTIONS > /dev/null 2>&1 & + OSM_PID=$! + sleep 1 + checkpid $OSM_PID + RC=$? + [ $RC -eq 0 ] && echo_success || echo_failure + [ $RC -eq 0 ] && touch /var/lock/subsys/opensm + [ $RC -eq 0 ] && echo $OSM_PID > $PID_FILE + echo + return $RC +} + +stop() +{ + [ -f /var/lock/subsys/opensm ] || return 0 + + echo -n "Stopping IB Subnet Manager." + + OSM_PID=`cat $PID_FILE` + + checkpid "$OSM_PID" + RC=$? + if [ $RC -ne 0 ]; then + rm -f $PID_FILE + rm -f /var/lock/subsys/opensm + echo_success + return 0 + fi + # Kill opensm + kill -15 $OSM_PID > /dev/null 2>&1 + cnt=0 + while [ $cnt -lt 6 -a checkpid $OSM_PID -eq 0 ]; do + echo -n "." + sleep 1 + let cnt++ + done + + if [ checkpid $OSM_PID -eq 0 ]; then + kill -KILL $OSM_PID > /dev/null 2>&1 + echo -n "+" + sleep 1 + fi + checkpid $pid + DEAD=$? + if [ $DEAD -eq 0 ]; then + echo_failure + echo + return 1 + fi + echo_success + echo + + # Remove pid file if any. + rm -f $PID_FILE + rm -f /var/lock/subsys/opensm + return 0 +} + +restart () +{ + stop + start +} + +condrestart () +{ + [ -f /var/lock/subsys/opensm ] && restart || return 0 +} + +reload () +{ + [ -f $PID_FILE ] || return 0 + OSM_PID=`cat $PID_FILE` + action $"Rescanning IB Subnet:" kill -HUP $OSM_PID + return $? +} + +usage () +{ + echo + echo "Usage: `basename $0` {start|stop|restart|condrestart|try-restart|force-reload|status}" + echo + return 2 +} + +case $ACTION in + start) start; RC=$? ;; + stop) stop; RC=$? ;; + restart) restart; RC=$? ;; + reload) reload; RC=$? ;; + condrestart) condrestart; RC=$? ;; + try-restart) condrestart; RC=$? ;; + force-reload) condrestart; RC=$? ;; + status) status $prog; RC=$? ;; + *) usage; RC=$? ;; +esac + +exit $RC diff --git a/opensm.logrotate b/opensm.logrotate new file mode 100644 index 0000000..e16e227 --- /dev/null +++ b/opensm.logrotate @@ -0,0 +1,7 @@ +/var/log/opensm.log { + missingok + notifempty + copytruncate + weekly + compress +} diff --git a/opensm.spec b/opensm.spec new file mode 100644 index 0000000..3aa72c8 --- /dev/null +++ b/opensm.spec @@ -0,0 +1,113 @@ +Name: opensm +Version: 3.2.1 +Release: 1%{?dist} +Summary: OpenIB InfiniBand Subnet Manager and management utilities +Group: System Environment/Daemons +License: GPLv2 or BSD +Url: http://www.openfabrics.org/ +Source0: http://www.openfabrics.org/downloads/management/%{name}-%{version}.tar.gz +Source1: opensm.conf +Source2: opensm.logrotate +Source3: opensm.initd +Patch0: opensm-3.2.1-rpath.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: libibmad-devel >= 1.2.0, libtool +Requires: %{name}-libs = %{version}-%{release}, logrotate, rdma + +%description +OpenSM is the OpenIB project's Subnet Manager for Infiniband networks. +The subnet manager is run as a system daemon on one of the machines in +the infiniband fabric to manage the fabric's routing state. This package +also contains various tools for diagnosing and testing Infiniband networks +that can be used from any machine and do not need to be run on a machine +running the opensm daemon. + +%package libs +Summary: Libraries used by opensm and included utilities +Group: System Environment/Libraries + +%description libs +Shared libraries for Infiniband user space access + +%package devel +Summary: Development files for the opensm-libs libraries +Group: Development/System +Requires: %{name}-libs = %{version}-%{release} + +%description devel +Development environment for the opensm libraries + +%package static +Summary: Static version of the opensm libraries +Group: Development/System +Requires: %{name}-devel = %{version}-%{release} +%description static +Static version of opensm libraries + +%prep +%setup -q +%patch0 -p1 -b .rpath +./autogen.sh + +%build +%configure --with-opensm-conf-sub-dir=rdma +make %{?_smp_mflags} + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT +# remove unpackaged files from the buildroot +rm -f $RPM_BUILD_ROOT%{_libdir}/*.la +install -D -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rdma/opensm.conf +install -D -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/opensm +install -D -m755 %{SOURCE3} $RPM_BUILD_ROOT%{_initrddir}/opensm +mkdir -p ${RPM_BUILD_ROOT}/var/cache/opensm + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +if [ $1 = 1 ]; then + /sbin/chkconfig --add opensm +else + /sbin/service opensm condrestart +fi + +%preun +if [ $1 = 0 ]; then + /sbin/service opensm stop + /sbin/chkconfig --del opensm + rm -f /var/cache/opensm/* +fi + +%post libs -p /sbin/ldconfig + +%postun libs -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%dir /var/cache/opensm +%{_sbindir}/* +%{_initrddir}/opensm +%{_mandir}/man8/* +%config(noreplace) %{_sysconfdir}/logrotate.d/opensm +%config(noreplace) %{_sysconfdir}/rdma/opensm.conf +%doc AUTHORS COPYING ChangeLog INSTALL README NEWS + +%files libs +%defattr(-,root,root,-) +%{_libdir}/lib*.so.* + +%files devel +%defattr(-,root,root,-) +%{_libdir}/lib*.so +%{_includedir}/infiniband + +%files static +%defattr(-,root,root,-) +%{_libdir}/lib*.a + +%changelog +* Sun Jun 08 2008 Doug Ledford - 3.2.1-1 +- Initial package for Fedora review process + diff --git a/sources b/sources index e69de29..4ae143f 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +997d10f81896a0d70e0f21f0e78eca92 opensm-3.2.1.tar.gz