Skip to content

Commit 61fb25b

Browse files
authored
Add node_guid to infiniband class (#665) (#670)
Signed-off-by: Diego Sonaglia <[email protected]>
1 parent ee6ea54 commit 61fb25b

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

sysfs/class_infiniband.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ type InfiniBandDevice struct {
125125
Name string
126126
BoardID string // /sys/class/infiniband/<Name>/board_id
127127
FirmwareVersion string // /sys/class/infiniband/<Name>/fw_ver
128+
NodeGUID string // /sys/class/infiniband/<Name>/node_guid
128129
HCAType string // /sys/class/infiniband/<Name>/hca_type
129130
Ports map[uint]InfiniBandPort
130131
}
@@ -172,7 +173,7 @@ func (fs FS) parseInfiniBandDevice(name string) (*InfiniBandDevice, error) {
172173
device.FirmwareVersion = value
173174

174175
// Not all InfiniBand drivers expose all of these.
175-
for _, f := range [...]string{"board_id", "hca_type"} {
176+
for _, f := range [...]string{"board_id", "hca_type", "node_guid"} {
176177
name := filepath.Join(path, f)
177178
value, err := util.SysReadFile(name)
178179
if err != nil {
@@ -187,6 +188,8 @@ func (fs FS) parseInfiniBandDevice(name string) (*InfiniBandDevice, error) {
187188
device.BoardID = value
188189
case "hca_type":
189190
device.HCAType = value
191+
case "node_guid":
192+
device.NodeGUID = value
190193
}
191194
}
192195

sysfs/class_infiniband_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ func TestInfiniBandClass(t *testing.T) {
272272
BoardID: "SM_2001000001034",
273273
FirmwareVersion: "14.28.2006",
274274
HCAType: "MT4118",
275+
NodeGUID: "0a7f:bc12:45ef:d23b",
275276
Ports: map[uint]InfiniBandPort{
276277
1: {
277278
Name: "mlx5_0",

testdata/fixtures.ttar

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6033,6 +6033,11 @@ Lines: 1
60336033
MT4118
60346034
Mode: 644
60356035
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6036+
Path: fixtures/sys/class/infiniband/mlx5_0/node_guid
6037+
Lines: 1
6038+
0a7f:bc12:45ef:d23bEOF
6039+
Mode: 644
6040+
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
60366041
Directory: fixtures/sys/class/infiniband/mlx5_0/ports
60376042
Mode: 755
60386043
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

0 commit comments

Comments
 (0)