diff --git a/sysfs/class_infiniband.go b/sysfs/class_infiniband.go index 7892c69a..39c97a26 100644 --- a/sysfs/class_infiniband.go +++ b/sysfs/class_infiniband.go @@ -124,6 +124,7 @@ type InfiniBandDevice struct { Name string BoardID string // /sys/class/infiniband//board_id FirmwareVersion string // /sys/class/infiniband//fw_ver + NodeGUID string // /sys/class/infiniband//node_guid HCAType string // /sys/class/infiniband//hca_type Ports map[uint]InfiniBandPort } @@ -171,7 +172,7 @@ func (fs FS) parseInfiniBandDevice(name string) (*InfiniBandDevice, error) { device.FirmwareVersion = value // Not all InfiniBand drivers expose all of these. - for _, f := range [...]string{"board_id", "hca_type"} { + for _, f := range [...]string{"board_id", "hca_type", "node_guid"} { name := filepath.Join(path, f) value, err := util.SysReadFile(name) if err != nil { @@ -186,6 +187,8 @@ func (fs FS) parseInfiniBandDevice(name string) (*InfiniBandDevice, error) { device.BoardID = value case "hca_type": device.HCAType = value + case "node_guid": + device.NodeGUID = value } } diff --git a/sysfs/class_infiniband_test.go b/sysfs/class_infiniband_test.go index 461e2805..c61e8bfb 100644 --- a/sysfs/class_infiniband_test.go +++ b/sysfs/class_infiniband_test.go @@ -272,6 +272,7 @@ func TestInfiniBandClass(t *testing.T) { BoardID: "SM_2001000001034", FirmwareVersion: "14.28.2006", HCAType: "MT4118", + NodeGUID: "0a7f:bc12:45ef:d23b", Ports: map[uint]InfiniBandPort{ 1: { Name: "mlx5_0", diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index f2bd5e56..9f05da58 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -5525,6 +5525,11 @@ Lines: 1 MT4118 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx5_0/node_guid +Lines: 1 +0a7f:bc12:45ef:d23bEOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/infiniband/mlx5_0/ports Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -