Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node_guid to infiniband class #670

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion sysfs/class_infiniband.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ type InfiniBandDevice struct {
Name string
BoardID string // /sys/class/infiniband/<Name>/board_id
FirmwareVersion string // /sys/class/infiniband/<Name>/fw_ver
NodeGUID string // /sys/class/infiniband/<Name>/node_guid
HCAType string // /sys/class/infiniband/<Name>/hca_type
Ports map[uint]InfiniBandPort
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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
}
}

Expand Down
1 change: 1 addition & 0 deletions sysfs/class_infiniband_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions testdata/fixtures.ttar
Original file line number Diff line number Diff line change
Expand Up @@ -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down