Page MenuHomeFreeBSD

Add 'sesutil show'
Needs ReviewPublic

Authored by trasz on Wed, Nov 27, 10:22 AM.


Group Reviewers

Add 'sesutil show' subcommand to show enclosure and its contents
in a user-friendly way.

Diff Detail

rS FreeBSD src repository
Lint OK
No Unit Test Coverage
Build Status
Buildable 27985
Build 26148: arc lint + arc unit

Event Timeline

trasz created this revision.Wed, Nov 27, 10:22 AM
trasz updated this revision to Diff 64934.Wed, Nov 27, 10:27 AM

Drop unneeded diff.

bcr accepted this revision as: manpages.Wed, Nov 27, 10:40 AM
bcr added a subscriber: bcr.

Sounds like a cool feature to have. Thanks for working on it.
The man page looks good!

I wonder if it would make sense to try to stripe the trailing whitespace from the serial # etc. The json output looks a little silly:

"model": "HGST HUS726060AL4210    ",
"serial": "NCGY0J9S            ",
allanjude added inline comments.Thu, Nov 28, 3:20 AM

We should use humanize_number on the output size instead, so the JSON output can not humanize


Ahh, the trailing whitespace is coming from this.

You can just change this to:

xo_emit("{:description/%-8s/%s} ", e_desc.elm_desc_str, e_desc.elm_desc_str);

to skip the padding when outputing 'encoded' (json/xml etc)


We want the JSON output to have the size un-humanized, so you likely want this as something like:

xo_emit("{:size/%s/%zu}", size, mediasize);

This will use %s (size) when printing normally, and %zu (mediasize) when printing 'encoded' (JSON etc)

You'll need to change fetch_device_details to return the mediasize instead, then humanize the value into size for display.

allanjude added inline comments.Thu, Nov 28, 3:34 AM

In the "elements" array, we should add a 'type' field

Currently, you can't programmatically tell which things are disks and which are voltage/temperature sensors:

  "enc": "ses1",
  "name": "LSI SAS3x36 0601",
  "id": "500304801f14633f",
  "elements": [
      "description": "Slot00  ",
      "device_names": "da24   ",
      "model": "HGST HUH721212AL4200    ",
      "serial": "8DGNJ3DH            ",
      "size": "11T"
      "description": "Slot01  ",
      "device_names": "da25   ",
      "model": "HGST HUH721212AL4200    ",
      "serial": "8DGNEJHH            ",
      "size": "11T"
      "description": "BackPlaneLM75",
      "temperature": 36
      "description": "ChipDie",
      "temperature": 71
      "description": "5V",
      "voltage": 5.00
      "description": "12V",
      "voltage": 11.90
trasz updated this revision to Diff 65245.Wed, Dec 4, 9:07 PM

Extend the width a bit, so that "Samsung SSD 850 EVO 250GB" doesn't overflow.

oshogbo added a subscriber: oshogbo.Thu, Dec 5, 2:52 PM
trasz updated this revision to Diff 65272.Thu, Dec 5, 4:40 PM
trasz marked 4 inline comments as done.

Fixes suggested by Allan.

trasz added inline comments.Thu, Dec 5, 4:40 PM

I've decided to left humanization to libxo(3) itself; this way we don't need to link with libutil. I've also changed it to match what's actually written on the disks.

trasz updated this revision to Diff 65274.Thu, Dec 5, 4:54 PM

Some more tweaks.