Skip to content

sysfs: add InfiniBandDevice API#839

Open
happysnaker wants to merge 1 commit into
prometheus:masterfrom
happysnaker:feat-823-infiniband-device-api
Open

sysfs: add InfiniBandDevice API#839
happysnaker wants to merge 1 commit into
prometheus:masterfrom
happysnaker:feat-823-infiniband-device-api

Conversation

@happysnaker

Copy link
Copy Markdown

Summary

  • add FS.InfiniBandDevice(name) as a public per-device parser
  • keep InfiniBandClass() unchanged
  • add regression coverage that the single-device API matches the corresponding InfiniBandClass() entry

Why

Issue #823 describes environments where callers need to filter InfiniBand devices before reading per-port counters. Today InfiniBandClass() eagerly parses every device, so callers have no way to skip known-problematic devices before counter reads happen.

This patch takes the additive route proposed in the issue: expose the existing per-device parser as a small public API. Existing callers keep using InfiniBandClass() unchanged, while new callers can now:

  1. list /sys/class/infiniband themselves
  2. filter devices using their own policy
  3. call fs.InfiniBandDevice(name) only for devices they actually want parsed

That keeps the change narrow and avoids adding filter semantics to InfiniBandClass() itself.

Fixes #823

Signed-off-by: Shirong Lu <73147033+happysnaker@users.noreply.github.com>
@happysnaker happysnaker force-pushed the feat-823-infiniband-device-api branch from 30463d4 to 222aac8 Compare July 2, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export InfiniBandDevice parsing or add device filtering to InfiniBandClass

1 participant