Skip to content

Commit

Permalink
rdma-ndd: add rdma-ndd from infiniband-diags
Browse files Browse the repository at this point in the history
rdma-ndd updates the node description sysfs attribute with a user settable
value, notably it can keep it in sync with the system's hostname.

This functionality will be removed from infiniband-diags when this
is accepted.

Signed-off-by: Ira Weiny <[email protected]>
  • Loading branch information
weiny2 committed Nov 16, 2016
1 parent 1b9b57d commit 4910f1e
Show file tree
Hide file tree
Showing 10 changed files with 553 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ add_subdirectory(libibcm/examples)
add_subdirectory(libibumad/tests)
add_subdirectory(libibverbs/examples)
add_subdirectory(librdmacm/examples)
if (UDEV_FOUND)
add_subdirectory(rdma-ndd)
endif()
add_subdirectory(srp_daemon)

rdma_finalize_libs()
Expand Down
4 changes: 4 additions & 0 deletions debian/rdma-core.install
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
lib/systemd/system/rdma-ndd.service
lib/udev/rules.d/rdma-ndd.rules
usr/sbin/rdma-ndd
usr/share/doc/rdma-core/MAINTAINERS
usr/share/doc/rdma-core/README.md
usr/share/man/man8/rdma-ndd.8
21 changes: 21 additions & 0 deletions rdma-ndd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# COPYRIGHT (c) 2016 Intel Corporation. See COPYING file

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")

rdma_sbin_executable(rdma-ndd
rdma-ndd.c
)

target_link_libraries(rdma-ndd LINK_PRIVATE ${UDEV_LIBRARIES})

# FIXME Autogenerate from the .rst
rdma_man_pages(
rdma-ndd.8.in
)

install(FILES "rdma-ndd.rules" DESTINATION "${CMAKE_INSTALL_UDEV_RULESDIR}")

rdma_subst_install(FILES "rdma-ndd.service.in"
DESTINATION "${CMAKE_INSTALL_SYSTEMD_SERVICEDIR}"
RENAME "rdma-ndd.service")

88 changes: 88 additions & 0 deletions rdma-ndd/rdma-ndd.8.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
.\" Man page generated from reStructuredText.
.
.TH RDMA-NDD 8 "@BUILD_DATE@" "" "OpenIB Diagnostics"
.SH NAME
RDMA-NDD \- RDMA device Node Description update daemon
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.SH SYNOPSIS
.sp
rdma\-ndd <options>
.SH DESCRIPTION
.sp
rdma\-ndd is a system daemon which watches for rdma device changes and/or
hostname changes and updates the Node Description of the rdma devices based on
those changes.
.SH DETAILS
.sp
Full operation of this daemon requires kernels which support polling of the
procfs hostname file as well as libudev.
.sp
If your system does not support either of these features, the daemon will set
the Node Descriptions at start up and then sleep forever.
.SS Node Description configuration
.sp
The daemon uses the environment variable RDMA_NDD_ND_FORMAT to set the node
description. The following wild cards can be specified for more dynamic
control.
.sp
%h \-\- replace with the current hostname (not including domain)
.sp
%d \-\- replace with the device name (for example mlx4_0, qib0, etc.)
.sp
If not specified the default is "%h %d".
.sp
NOTE: At startup, and on new device detection, the Node Description is always
written to ensure the SM and rdma\-ndd are in sync. Subsequent events will only
write the Node Description on a device if it has changed.
.SS Using systemd
.sp
Setting the environment variable for the daemon is normally be done via a
systemd drop in unit. For example the following could be added to a file named
/etc/systemd/system/rdma\-ndd.service.d/nd\-format.conf to use only the
hostname as your node description.
.sp
[Service]
Environment="RDMA_NDD_ND_FORMAT=%%h"
.sp
NOTE: Systemd requires an extra \(aq%\(aq.
.SH OPTIONS
.sp
\fB\-f, \-\-foreground\fP
Run in the foreground instead of as a daemon
.sp
\fB\-d, \-\-debugging\fP
Log additional debugging information to syslog
.SH AUTHOR
.INDENT 0.0
.TP
.B Ira Weiny
< \fI\%[email protected]\fP >
.UNINDENT
.\" Generated by docutils manpage writer.
.
82 changes: 82 additions & 0 deletions rdma-ndd/rdma-ndd.8.in.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
========
RDMA-NDD
========

------------------------------------------
RDMA device Node Description update daemon
------------------------------------------

:Date: @BUILD_DATE@
:Manual section: 8
:Manual group: OpenIB Diagnostics


SYNOPSIS
========

rdma-ndd <options>

DESCRIPTION
===========

rdma-ndd is a system daemon which watches for rdma device changes and/or
hostname changes and updates the Node Description of the rdma devices based on
those changes.


DETAILS
=======

Full operation of this daemon requires kernels which support polling of the
procfs hostname file as well as libudev.

If your system does not support either of these features, the daemon will set
the Node Descriptions at start up and then sleep forever.


Node Description configuration
------------------------------

The daemon uses the environment variable RDMA_NDD_ND_FORMAT to set the node
description. The following wild cards can be specified for more dynamic
control.

%h -- replace with the current hostname (not including domain)

%d -- replace with the device name (for example mlx4_0, qib0, etc.)

If not specified the default is "%h %d".

NOTE: At startup, and on new device detection, the Node Description is always
written to ensure the SM and rdma-ndd are in sync. Subsequent events will only
write the Node Description on a device if it has changed.

Using systemd
-------------

Setting the environment variable for the daemon is normally be done via a
systemd drop in unit. For example the following could be added to a file named
/etc/systemd/system/rdma-ndd.service.d/nd-format.conf to use only the
hostname as your node description.

[Service]
Environment="RDMA_NDD_ND_FORMAT=%%h"

NOTE: Systemd requires an extra '%'.


OPTIONS
=======

**-f, --foreground**
Run in the foreground instead of as a daemon

**-d, --debugging**
Log additional debugging information to syslog


AUTHOR
======

Ira Weiny
< [email protected] >
Loading

0 comments on commit 4910f1e

Please sign in to comment.