aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2018-04-03 15:16:01 +0200
committerBryn M. Reeves <bmr@redhat.com>2018-05-22 15:34:57 +0100
commit0eb9153e3d357824acd5e008e6c6e1290c9c2f66 (patch)
treebea0719d8f5740e0b37547c1e462093d9b9dd60c
parent2d35d11fd767cf2ad525a46f5cb87e9697e760d4 (diff)
downloadsos-0eb9153e3d357824acd5e008e6c6e1290c9c2f66.tar.gz
[infiniband] collect info from all active ports of all IB devices
currently just the very first active port is checked Resolves: #1262 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/infiniband.py46
1 files changed, 42 insertions, 4 deletions
diff --git a/sos/plugins/infiniband.py b/sos/plugins/infiniband.py
index d70c5670..4484892f 100644
--- a/sos/plugins/infiniband.py
+++ b/sos/plugins/infiniband.py
@@ -14,6 +14,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
@@ -37,15 +38,52 @@ class Infiniband(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
self.add_cmd_output([
"ibv_devices",
- "ibv_devinfo",
+ "ibv_devinfo -v",
"ibstat",
- "ibstatus",
+ "ibstatus"
+ ])
+
+ # run below commands for every IB device and its active port
+ ports_cmds = [
"ibhosts",
"iblinkinfo",
"sminfo",
"perfquery"
- ])
+ ]
+ IB_SYS_DIR = "/sys/class/infiniband/"
+ ibs = os.listdir(IB_SYS_DIR)
+ for ib in ibs:
+ """
+ Skip OPA hardware, as infiniband-diags tools does not understand
+ OPA specific MAD sent by opa-fm. Intel provides OPA specific tools
+ for OPA fabric diagnose.
+ """
+ if ib.startswith("hfi"):
+ continue
+
+ for port in os.listdir(IB_SYS_DIR + ib + "/ports"):
+ # skip IWARP and RoCE devices
+ try:
+ p = open(IB_SYS_DIR + ib + "/ports/" + port +
+ "/link_layer")
+ except:
+ continue
+ link_layer = p.readline()
+ p.close()
+ if link_layer != "InfiniBand\n":
+ continue
+
+ try:
+ s = open(IB_SYS_DIR + ib + "/ports/" + port + "/state")
+ except:
+ continue
+ state = s.readline()
+ s.close()
+
+ if not state.endswith(": ACTIVE\n"):
+ continue
- return
+ opts = "-C %s -P %s" % (ib, port)
+ self.add_cmd_output(["%s %s" % (c, opts) for c in port_cmds])
# vim: set et ts=4 sw=4 :