Whamcloud - gitweb
LU-9439 scripts: Provide a sample lnet.conf file 71/26971/7
authorGiuseppe Di Natale <dinatale2@llnl.gov>
Fri, 5 May 2017 22:24:21 +0000 (15:24 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 3 Jun 2017 03:58:45 +0000 (03:58 +0000)
Create a sample lnet.conf file that is packaged and
installed.

Move /etc/sysconfig/lnet.conf to /etc/lnet.conf. Configuration
files should not be in /etc/sysconfig.

Cleaned up the init.d lnet script.

Test-Parameters: trivial
Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Change-Id: Ie94d0c2680c0f1fd65cbf2e33b08194beee5d8be
Reviewed-on: https://review.whamcloud.com/26971
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre.spec.in
lustre/conf/Makefile.am
lustre/conf/lnet.conf [new file with mode: 0644]
lustre/scripts/Makefile.am
lustre/scripts/lnet.in [moved from lustre/scripts/lnet with 73% similarity]
lustre/scripts/systemd/Makefile.am
lustre/scripts/systemd/lnet.service.in

index af05155..64264f9 100644 (file)
@@ -443,6 +443,9 @@ echo '%{_sbindir}/wiretest' >>lustre-tests.files
 %{_datadir}/lustre
 %{_sysconfdir}/udev/rules.d/99-lustre.rules
 %config(noreplace) %{_sysconfdir}/ldev.conf
+%if %{with lnet_dlc}
+%config(noreplace) %{_sysconfdir}/lnet.conf
+%endif
 %config(noreplace) %{_sysconfdir}/modprobe.d/ko2iblnd.conf
 %if %{with lustre_utils}
 %config(noreplace) %{_sysconfdir}/lnet_routes.conf
index 06e5e6c..562a352 100644 (file)
@@ -34,7 +34,7 @@
 
 EXTRA_DIST = lustre.dtd slapd-lustre.conf lustre2ldif.xsl top.ldif \
              99-lustre.rules lustre ldev.conf ko2iblnd.conf lsvcgss \
-             lnet_routes.conf
+             lnet_routes.conf lnet.conf
 ldapconfdir = $(sysconfdir)/openldap
 
 sysconf_DATA = ldev.conf
@@ -55,5 +55,9 @@ sysconfig_DATA = lustre lsvcgss
 endif
 endif
 
+if BUILD_DLC
+sysconf_DATA += lnet.conf
+endif
+
 modprobedir = $(sysconfdir)/modprobe.d
 modprobe_DATA = ko2iblnd.conf
diff --git a/lustre/conf/lnet.conf b/lustre/conf/lnet.conf
new file mode 100644 (file)
index 0000000..d006508
--- /dev/null
@@ -0,0 +1,56 @@
+# lnet.conf - configuration file for lnet routes to be imported by lnetctl
+#
+# This configuration file is formatted as YAML and can be imported
+# by lnetctl.
+#
+# net:
+#     - net type: o2ib1
+#       local NI(s):
+#         - nid: 172.16.1.4@o2ib1
+#           interfaces:
+#               0: ib0
+#           tunables:
+#               peer_timeout: 180
+#               peer_credits: 128
+#               peer_buffer_credits: 0
+#               credits: 1024
+#           lnd tunables:
+#               peercredits_hiw: 64
+#               map_on_demand: 32
+#               concurrent_sends: 256
+#               fmr_pool_size: 2048
+#               fmr_flush_trigger: 512
+#               fmr_cache: 1
+#           CPT: "[0,1]"
+#         - nid: 172.16.2.4@o2ib1
+#           interfaces:
+#               0: ib1
+#           tunables:
+#               peer_timeout: 180
+#               peer_credits: 128
+#               peer_buffer_credits: 0
+#               credits: 1024
+#           lnd tunables:
+#               peercredits_hiw: 64
+#               map_on_demand: 32
+#               concurrent_sends: 256
+#               fmr_pool_size: 2048
+#               fmr_flush_trigger: 512
+#               fmr_cache: 1
+#           CPT: "[0,1]"
+# route:
+#     - net: o2ib
+#       gateway: 172.16.1.1@o2ib1
+#       hop: -1
+#       priority: 0
+# peer:
+#     - primary nid: 192.168.1.2@o2ib
+#       Multi-Rail: True
+#       peer ni:
+#         - nid: 192.168.1.2@o2ib
+#         - nid: 192.168.2.2@o2ib
+#     - primary nid: 172.16.1.1@o2ib1
+#       Multi-Rail: True
+#       peer ni:
+#         - nid: 172.16.1.1@o2ib1
+#         - nid: 172.16.2.1@o2ib1
index 9267a81..25b9995 100644 (file)
@@ -33,7 +33,7 @@
 #
 
 # These are scripts that are generated from .in files
-genscripts = lc_modprobe lc_net lc_hb lc_cluman lc_md lc_lvm lustre_start
+genscripts = lc_modprobe lc_net lc_hb lc_cluman lc_md lc_lvm lustre_start lnet
 
 SUBDIRS = systemd
 
@@ -77,11 +77,21 @@ endif # UTILS
 EXTRA_DIST = license-status lustre_rmmod ldev lc_mon lhbadm \
             lc_servip lustre_routes_config lustre_routes_conversion \
             $(addsuffix .in,$(genscripts)) lfs_migrate lustre_req_history \
-            lustre lnet lsvcgss lc_common haconfig Lustre.ha_v2 dkms.mkconf \
+            lustre lsvcgss lc_common haconfig Lustre.ha_v2 dkms.mkconf \
             zfsobj2fid ko2iblnd-probe
 
 CLEANFILES = $(genscripts)
 
 $(genscripts): %: %.in
-       sed -e 's#@scriptlibdir@#$(scriptlibdir)#' < $< > $@
+if BUILD_DLC
+       sed -e 's,@sysconfdir\@,$(sysconfdir),g' \
+           -e 's,@scriptlibdir\@,$(scriptlibdir),g' \
+           -e 's,@BUILD_DLC_TRUE\@,,g' \
+           -e 's,@BUILD_DLC_FALSE\@,\#,g' $< > $@
+else
+       sed -e 's,@sysconfdir\@,$(sysconfdir),g' \
+           -e 's,@scriptlibdir\@,$(scriptlibdir),g' \
+           -e 's,@BUILD_DLC_TRUE\@,\#,g' \
+           -e 's,@BUILD_DLC_FALSE\@,,g' $< > $@
+endif
        chmod +x $@
similarity index 73%
rename from lustre/scripts/lnet
rename to lustre/scripts/lnet.in
index 43ad5bf..afd7519 100644 (file)
@@ -95,44 +95,23 @@ status ()
        eval $old_nullglob
 }
 
-LUSTRE_ROUTES_CONFIG_FILE="/etc/lnet_routes.conf"
-LUSTRE_LNET_CONFIG_FILE="/etc/sysconfig/lnet.conf"
-LUSTRE_LNET_CONFIG_UTILITY="/usr/sbin/lnetctl"
-
 # See how we were called.
 case "$1" in
   start)
        run_preexec_check "start"
        touch /var/lock/subsys/lnet
        modprobe lnet || exit 1
-       # if lnet.conf file exists then use lnetctl lnet configure, since
-       # that doesn't load the networks and routes defined in the mod
-       # params.  The appropriate configuration will be picked up from
-       # the lnet.conf YAML file.
-       if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f "$LUSTRE_LNET_CONFIG_FILE" ]; then
-               $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1
-       else
-               lctl network up || exit 1
-       fi
-       # if an lnet.conf file exists then pass that to the lnetctl
-       # utility for parsing.  This will configure the items defined
-       # in YAML format in the config file.
-       if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f "$LUSTRE_LNET_CONFIG_FILE" ]; then
-               $LUSTRE_LNET_CONFIG_UTILITY import < $LUSTRE_LNET_CONFIG_FILE
-       fi
-       # if a routes config file is given then use it to configure the
-       # routes if not then default to LUSTRE_ROUTES_CONFIG_FILE
-       if [ -f "$2" ]; then
-               lustre_routes_config $2
-       elif [ -f "$LUSTRE_ROUTES_CONFIG_FILE" ]; then
-               lustre_routes_config $LUSTRE_ROUTES_CONFIG_FILE
-       fi
+       @BUILD_DLC_TRUE@lnetctl lnet configure || exit 1
+       @BUILD_DLC_TRUE@lnetctl import < "@sysconfdir@/lnet.conf"
+       @BUILD_DLC_FALSE@lctl network up || exit 1
+       @BUILD_DLC_FALSE@lustre_routes_config "@sysconfdir@/lnet_routes.conf"
        run_postexec_check "start"
        ;;
   stop)
        run_preexec_check "stop"
        lustre_rmmod ptlrpc || exit 1
-       lctl network down || exit 1
+       @BUILD_DLC_TRUE@lnetctl lnet unconfigure || exit 1
+       @BUILD_DLC_FALSE@lctl network down || exit 1
        lustre_rmmod libcfs ldiskfs || exit 1
        rm -f /var/lock/subsys/lnet
        run_postexec_check "stop"
index 0fe8057..cfda573 100644 (file)
@@ -1,6 +1,5 @@
 # These are scripts that are generated from .in files
 genunitfiles = lnet.service
-sysconfigdir = $(sysconfdir)/sysconfig
 
 if HAVE_SYSTEMD
 systemdsystemunit_DATA = lnet.service
@@ -13,13 +12,11 @@ CLEANFILES = $(genunitfiles)
 $(genunitfiles): %: %.in
 if BUILD_DLC
        sed -e 's,@sbindir\@,$(sbindir),g' \
-           -e 's,@sysconfigdir\@,$(sysconfigdir),g' \
            -e 's,@sysconfdir\@,$(sysconfdir),g' \
            -e 's,@BUILD_DLC_TRUE\@,,g' \
            -e 's,@BUILD_DLC_FALSE\@,\#,g' $< > $@
 else
        sed -e 's,@sbindir\@,$(sbindir),g' \
-           -e 's,@sysconfigdir\@,$(sysconfigdir),g' \
            -e 's,@sysconfdir\@,$(sysconfdir),g' \
            -e 's,@BUILD_DLC_TRUE\@,\#,g' \
            -e 's,@BUILD_DLC_FALSE\@,,g' $< > $@
index 1da1503..550dd75 100644 (file)
@@ -13,7 +13,7 @@ ExecStart=@sbindir@/modprobe lnet
 @BUILD_DLC_FALSE@ExecStart=@sbindir@/lctl network up
 @BUILD_DLC_FALSE@ExecStart=@sbindir@/lustre_routes_config @sysconfdir@/lnet_routes.conf
 @BUILD_DLC_TRUE@ExecStart=@sbindir@/lnetctl lnet configure
-@BUILD_DLC_TRUE@ExecStart=@sbindir@/lnetctl import < @sysconfigdir@/lnet.conf
+@BUILD_DLC_TRUE@ExecStart=@sbindir@/lnetctl import < @sysconfdir@/lnet.conf
 ExecStop=@sbindir@/lustre_rmmod ptlrpc
 @BUILD_DLC_FALSE@ExecStop=@sbindir@/lctl network down
 @BUILD_DLC_TRUE@ExecStop=@sbindir@/lnetctl lnet unconfigure