infiniband-diags: add rdma-ndd daemon
Subsystems (2)
PATCH v3 1/1 infiniband-diags: add rdma-ndd daemon
From: Ira Weiny <[email protected]>
rdma-ndd is a system daemon which watches the procfs hostname file as well as monitoring for InfiniBand libudev device changes.
Upon detecting changes it will update the Node Descriptions of the RDMA devices in the system.
This deamon is intended to work with kernels which support polling of the procfs hostname. If your kernel does not support this feature the daemon will set the Node Descriptions to the hostname at start up only.
ibdiag.conf can be used to specify a node description format with the following format specifier support.
%h == current hostname
%d == device name
Regardless of previous settings, all NDs are written at startup and individually when a new device is detected. Otherwise the ND is compared to the existing one and not written if it has not changed.
---
Changes from V2:
Kernel Node Description change support is no longer required Node Description format specifiers can be set via ibdiags.conf libudev is now required to detect device adds
Use rst man page processing to include ibdiags.conf documentation Minor code clean ups
Makefile.am | 8 +- configure.ac | 23 +++ doc/man/rdma-ndd.8.in | 102 ++++++++++++ doc/rst/rdma-ndd.8.in.rst | 85 ++++++++++ etc/ibdiag.conf | 3 + etc/rdma-ndd.init.in | 137 ++++++++++++++++ include/ibdiag_common.h | 1 + infiniband-diags.spec.in | 40 ++++- src/ibdiag_common.c | 4 + src/rdma-ndd.c | 400 ++++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 799 insertions(+), 4 deletions(-) create mode 100644 doc/man/rdma-ndd.8.in create mode 100644 doc/rst/rdma-ndd.8.in.rst create mode 100644 etc/rdma-ndd.init.in create mode 100644 src/rdma-ndd.c
Makefile.am +7 -1
@@ -16,7 +16,8 @@ sbin_PROGRAMS = src/ibaddr src/ibnetdiscover src/ibping src/ibportstate \ src/saquery src/vendstat src/iblinkinfo \ src/ibqueryerrors src/ibcacheedit src/ibccquery \ src/ibccconfig \ - src/dump_fts + src/dump_fts \ + src/rdma-ndd if ENABLE_TEST_UTILS sbin_PROGRAMS += src/ibsendtrap src/mcm_rereg_test
@@ -70,6 +71,7 @@ man_MANS = doc/man/ibaddr.8 \ doc/man/smpquery.8 \ doc/man/vendstat.8 \ doc/man/infiniband-diags.8 \ + doc/man/rdma-ndd.8 \ man/dump_lfts.8 \ man/dump_mfts.8
@@ -158,3 +160,7 @@ install-data-hook: $(top_srcdir)/config/install-sh -c -m 444 $(top_srcdir)/scripts/IBswcountlimits.pm $(DESTDIR)/$(PERL_INSTALLDIR)/IBswcountlimits.pm $(top_srcdir)/config/install-sh -c -m 444 $(top_srcdir)/etc/error_thresholds $(DESTDIR)/$(sysconfdir)/infiniband-diags $(top_srcdir)/config/install-sh -c -m 400 $(top_srcdir)/etc/ibdiag.conf $(DESTDIR)/$(sysconfdir)/infiniband-diags + +install-exec-hook: + $(top_srcdir)/config/install-sh -m 755 -d $(DESTDIR)/$(sysconfdir)/init.d + $(top_srcdir)/config/install-sh -m 755 $(top_srcdir)/etc/rdma-ndd.init $(DESTDIR)/$(sysconfdir)/init.d/rdma-ndd
configure.ac +23 -0
@@ -180,6 +180,27 @@ fi AC_SUBST(ibnetdisc_api_version) dnl End libibnetdisc stuff +dnl configures for rdma-ndd startup script +default_rdma_service=openibd +AC_ARG_WITH([rdma_service], + AC_HELP_STRING([--with-rdma-service=name], + [name of the RDMA service: "rdma" when using /etc/init.d/rdma to start RDMA services; "openibd" when using /etc/init.d/openibd to start RDMA services [default=${default_rdma_service}]])) +AC_SUBST(RDMA_SERVICE, ${with_rdma_service:-${default_rdma_service}}) + +if { rpm -q sles-release || rpm -q openSUSE-release; } >/dev/null 2>&1; then + default_stop="0 1 4 6" +else + default_stop="0 1 6" +fi + +default_start="null" + +AC_SUBST(DEFAULT_START, $default_start) +AC_SUBST(DEFAULT_STOP, $default_stop) + +AC_CHECK_HEADER(libudev.h, with_udev="yes", with_udev="no") +AC_CHECK_LIB(udev, udev_monitor_ref, [], AC_MSG_ERROR(libudev is required for rdma-ndd...)) + dnl Generate doc/man/*.in files if possible DOC_DATE="`date +%Y-%m-%d`" AC_SUBST(BUILD_DATE)
@@ -253,6 +274,8 @@ AC_CONFIG_FILES([\ doc/man/smpquery.8 \ doc/man/vendstat.8 \ doc/man/infiniband-diags.8 \ + doc/man/rdma-ndd.8 \ + etc/rdma-ndd.init \ libibnetdisc/Makefile \ ]) AC_OUTPUT
doc/man/rdma-ndd.8.in new file +102 -0
102 lines not on this page · raw message
doc/rst/rdma-ndd.8.in.rst new file +85 -0
85 lines not on this page · raw message
etc/ibdiag.conf +3 -0
@@ -20,3 +20,6 @@ # default smkey to be used for SA requests #sa_key=0x00 + +# Set the Node Description format to be used by rdma-ndd +#nd_format=%h %d
etc/rdma-ndd.init.in new file +137 -0
137 lines not on this page · raw message
include/ibdiag_common.h +1 -0
@@ -54,6 +54,7 @@ extern uint32_t ibd_ibnetdisc_flags;extern uint64_t ibd_mkey;extern uint64_t ibd_sakey;extern int show_keys; +extern char *ibd_nd_format;/*========================================================*/ /* External interface */
infiniband-diags.spec.in +37 -3
@@ -11,8 +11,8 @@ Group: System Environment/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Source: http://www.openfabrics.org/downloads/management/@TARBALL@ Url: http://openfabrics.org/ -BuildRequires: libibmad-devel, opensm-devel, libibumad-devel, glib2-devel -Requires: libibmad, opensm-libs, libibumad, glib2 +BuildRequires: libibmad-devel, opensm-devel, libibumad-devel, glib2-devel, libudev-devel +Requires: libibmad, opensm-libs, libibumad, glib2, libudev Provides: perl(IBswcountlimits) Obsoletes: openib-diags
@@ -129,6 +129,8 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/ibccconfig.8.gz %{_sbindir}/dump_fts %{_mandir}/man8/dump_fts.8.gz +%{_sbindir}/rdma-ndd +%{_mandir}/man8/rdma-ndd.8.gz # scripts here %{_sbindir}/ibhosts
@@ -164,9 +166,41 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/infiniband/*.h %define _perldir %(perl -e 'use Config; $T=$Config{installvendorlib}; print $T;') %{_perldir}/* -%{_sysconfdir}/* +%{_sysconfdir}/infiniband-diags/* +%{_sysconfdir}/init.d/rdma-ndd %doc README COPYING ChangeLog + +%post +if [ $1 = 1 ]; then + if [ -e /sbin/chkconfig ]; then + /sbin/chkconfig --add rdma-ndd + /sbin/chkconfig rdma-ndd on + elif [ -e /usr/sbin/update-rc.d ]; then + /usr/sbin/update-rc.d rdma-ndd defaults + else + /usr/lib/lsb/install_initd /etc/init.d/rdma-ndd + fi + if type systemctl >/dev/null 2>&1; then + systemctl --system daemon-reload + fi +else + /etc/init.d/rdma-ndd condrestart +fi + +%preun +if [ $1 = 0 ]; then + /etc/init.d/rdma-ndd stop + if [ -e /sbin/chkconfig ]; then + /sbin/chkconfig --del rdma-ndd + elif [ -e /usr/sbin/update-rc.d ]; then + /usr/sbin/update-rc.d -f rdma-ndd remove + else + /usr/lib/lsb/remove_initd /etc/init.d/rdma-ndd + fi +fi + + %changelog * Mon Mar 03 2008 Albert Chu <[email protected]> - 1.3.5 - Add check_lft_balance script.
src/ibdiag_common.c +4 -0
@@ -74,6 +74,7 @@ uint32_t ibd_ibnetdisc_flags = IBND_CONFIG_MLX_EPI;uint64_t ibd_mkey;uint64_t ibd_sakey =0 ;int show_keys =0 ; +char *ibd_nd_format =NULL ;static const char *prog_name;static const char *prog_args;
@@ -163,6 +164,9 @@ void read_ibdiag_config(const char *file) }else if (strncmp (name,"sa_key" ,strlen ("sa_key" )) ==0 ) { ibd_sakey =strtoull (val_str,0 ,0 ); + }else if (strncmp (name,"nd_format" , +strlen ("nd_format" )) ==0 ) { + ibd_nd_format =strdup (val_str); } }
src/rdma-ndd.c new file +400 -0
400 lines not on this page · raw message
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html