Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add systemd service #20

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Makefile.in
man/opensm.8
man/torus-2QoS.8
man/torus-2QoS.conf.5
[email protected]
opensm.spec
opensm/opensm
opensm/osm_qos_parser_l.c
Expand Down
6 changes: 6 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ docs = doc/performance-manager-HOWTO.txt doc/QoS_management_in_OpenSM.txt \
doc/partition-config.txt doc/opensm-sriov.txt \
doc/current-routing.txt doc/opensm_release_notes-3.3.txt

systemdunitdir = $(SYSTEMD_UNIT_DIR)
systemdunit_DATA = opensm.service [email protected]

[email protected]: [email protected]
sed -e 's,@sbindir\@,$(sbindir),g' $< > $@

EXTRA_DIST = autogen.sh opensm.spec $(various_scripts) $(man_MANS) $(docs)

dist-hook: $(EXTRA_DIST)
Expand Down
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ AC_DEFINE_UNQUOTED(HAVE_DEFAULT_PER_MOD_LOGGING_FILE,
[Define a Per Module Logging config file])
AC_SUBST(PER_MOD_LOGGING_FILE)

SYSTEMD_UNIT_DIR=`pkg-config systemd --variable=systemdsystemunitdir`
# Use default if SYSTEMD_DIR is empty
if test x"$SYSTEMD_UNIT_DIR" = "x"; then
SYSTEMD_UNIT_DIR=/lib/systemd/system
fi
AC_SUBST([SYSTEMD_UNIT_DIR])

dnl select example event plugin or not
OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL

Expand Down
13 changes: 13 additions & 0 deletions opensm.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Starts the OpenSM InfiniBand fabric Subnet Managers
Documentation=man:opensm(8)
Before=network.target remote-fs-pre.target
ConditionPathExists=/sys/class/infiniband_mad/abi_version

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'PORTS=$(/usr/sbin/ibstat -p); if test -z "$PORTS"; then echo "No InfiniBand ports found."; exit 0; fi; echo "Starting opensm on following ports: $PORTS"; systemctl start $(echo $PORTS | sed -r "s/(\\w+)/opensm@\\1.service/g")'
RemainAfterExit=on

[Install]
WantedBy=network-online.target
10 changes: 10 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Starts the OpenSM InfiniBand fabric Subnet Manager %I
Documentation=man:opensm(8)
Before=network.target remote-fs-pre.target
PartOf=opensm.service
ConditionPathExists=/sys/class/infiniband_mad/abi_version

[Service]
Type=simple
ExecStart=@sbindir@/opensm --guid %I --log_file /var/log/opensm.%I.log