Skip to content

Commit

Permalink
add support to address switches by LID
Browse files Browse the repository at this point in the history
  • Loading branch information
kcgthb committed May 5, 2020
1 parent e1f22e6 commit e786f7f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,24 @@ temperatures, and monitor the switches more closely.

### Preparation

`ibswinfo` operates on virtual devices created by MST, the Mellanox Software
Tools service. Once MFT has been installed, you can start the `mst` service
and populate entries in `/dev/mst` with:
`ibswinfo` can address switches by using the virtual devices created by MST,
the Mellanox Software Tools service, or by LID.

```
# mst start
# mst ib add
```
* to use the MST virtual devices, you can start the `mst` service and populate
entries in `/dev/mst` with:

```
# mst start
# mst ib add
```
Check that `/dev/mst` contains entries for your unmanaged switches (they
should look like `/dev/mst/SW_*`), and you can run `ibswinfo` like this:
`./ibswinfo.sh -d /dev/mst/SW`
Check that `/dev/mst` contains entries for your unmanaged switches (they should
look like `/dev/mst/SW_*`).
* to address switches by LID, starting the `mst` service is not required. You
can get currently assigned LIDs with `ibswitches`, and run `ibswinfo`
directly like this: `./ibswinfo.sh -d lid-16`
## Supported hardware
Expand Down Expand Up @@ -82,11 +89,10 @@ we'll complete the list._
## Usage
```
# ./ibswinfo/ibswinfo.sh -h
Usage: ibswinfo.sh -d <device> [-T] [-o <inventory|vitals|status>]

-d <device> MST device name.
Run "mst status" to get the devices list
-d <device> MST device path ("mst status" shows devices list)
or LID (eg. "-d lid-44")
-o <output_category> Only display inventory|vitals|status information
-T get QSFP modules temperature

Expand Down
13 changes: 7 additions & 6 deletions ibswinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ usage() {
cat << EOU
Usage: ${0##*/} -d <device> [-T] [-o <$outputs>]
-d <device> MST device name.
Run "mst status" to get the devices list
-d <device> MST device path ("mst status" shows devices list)
or LID (eg. "-d lid-44")
-o <output_category> Only display $outputs information
-T get QSFP modules temperature
Expand Down Expand Up @@ -180,10 +180,11 @@ req="4.14.0"

# device
[[ $dev == "" ]] && err "missing device argument"
[[ ${dev:0:8} == '/dev/mst' ]] && dev=${dev/\/dev\/mst\//}
[[ ${dev:0:3} == "SW_" ]] || err "$dev doesn't look like a switch device name"
[[ -r /dev/mst/$dev ]] || err "$dev not found in /dev/mst, is mst started?"

[[ ${dev:0:4} != "lid-" ]] && {
[[ ${dev:0:8} == '/dev/mst' ]] && dev=${dev/\/dev\/mst\//}
[[ ${dev:0:3} == "SW_" ]] || err "$dev doesn't look like a switch device name"
[[ -r /dev/mst/$dev ]] || err "$dev not found in /dev/mst, is mst started?"
}


## -- data --------------------------------------------------------------------
Expand Down

0 comments on commit e786f7f

Please sign in to comment.