Page MenuHomeFreeBSD

Add 'sesutil show'
ClosedPublic

Authored by trasz on Nov 27 2019, 10:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 16, 9:36 AM
Unknown Object (File)
Tue, Dec 10, 5:45 AM
Unknown Object (File)
Sun, Dec 8, 7:02 AM
Unknown Object (File)
Sat, Dec 7, 11:11 AM
Unknown Object (File)
Thu, Nov 28, 11:00 AM
Unknown Object (File)
Thu, Nov 28, 11:00 AM
Unknown Object (File)
Thu, Nov 28, 11:00 AM
Unknown Object (File)
Thu, Nov 28, 11:00 AM
Subscribers

Details

Summary

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

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27964
Build 26130: arc lint + arc unit

Event Timeline

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            ",
usr.sbin/sesutil/sesutil.c
608

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

644

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)

657

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.

usr.sbin/sesutil/sesutil.c
824

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
    }
  ]
}

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

trasz marked 4 inline comments as done.

Fixes suggested by Allan.

usr.sbin/sesutil/sesutil.c
608

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.

This revision is now accepted and ready to land.Dec 12 2019, 1:36 PM
This revision now requires review to proceed.Dec 12 2019, 7:15 PM
This revision was not accepted when it landed; it landed in state Needs Review.Dec 14 2019, 10:58 AM
This revision was automatically updated to reflect the committed changes.