Project

General

Profile

Actions

Feature #13672

closed

nvmeadm list could support parsable output

Added by Robert Mustacchi about 1 month ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Today there is no good way to get parsable output from nvmeadm list for use in shell scripting or other uses. It'd be nice if we added ofmt style support for that. This puts this together by adding options to nvmeadm list to add the normal -p and -o options. This does not add non-parsable ofmt output at this phase to this. In this mode, each namespace is listed (the set of which is still controlled by -v) with the following fields:

  • Model
  • Serial
  • Firmware Revision
  • NVMe Version
  • Namespace Size
  • Namespace Capacity
  • Namespace Used
  • The device instance (e.g. nvme4)
  • The namespace number
  • The disk name (e.g. c0t123p0)

With that, here are some examples of using this:

rm@romulus $ pfexec ./nvmeadm list -p -o model,serial,fwrev,version,capacity,size,used,instance,namespace,disk
INTEL SSDPF2KX038TZ:PHAC0466000C3P8AGN:JCV10023:1.3:3840755982336:3840755982336:3840755982336:nvme2:5cd2e46b52180300:c10t5CD2E46B52180300d0
KINGSTON SEDC1000M3840G:50026B728262B5A0:S68F0120:1.3:3840755982336:3840755982336:3840755982336:nvme3:0026b728262b5a05:c7t0026B728262B5A05d0
Micron_7300_MTFDHBE6T4TDG:20232B107C8F:95420100:1.3:6401252745216:6401252745216:6401252745216:nvme9:00a075012b107c8f:c4t00A075012B107C8Fd0
HP SSD EX950 1TB:HBSE49321201906:SS0411B:1.3:1024209543168:1024209543168:985760448512:nvme0:1:c1t1d0
HP SSD EX950 1TB:HBSE49321201988:SS0411B:1.3:1024209543168:1024209543168:987457863680:nvme1:1:c2t1d0
KINGSTON SEDC1000M3840G:50026B728262B57F:S68F0120:1.3:3840755982336:3840755982336:3840755982336:nvme5:0026b728262b57f5:c9t0026B728262B57F5d0
Micron_7300_MTFDHBE3T2TDG:19502B101423:95420100:1.3:3200631791616:3200631791616:3200631791616:nvme7:00a075012b101423:c11t00A075012B101423d0
KINGSTON SEDC1000M7680G:50026B72825CE415:S68F0120:1.3:7681501126656:7681501126656:7681501126656:nvme4:0026b72825ce4155:c6t0026B72825CE4155d0
Micron_7300_MTFDHBE3T8TDF:19462B103289:95420100:1.3:3840755982336:3840755982336:3840755982336:nvme11:00a075012b103289:c12t00A075012B103289d0
KINGSTON SEDC1000M7680G:50026B72825CE3D3:S68F0120:1.3:7681501126656:7681501126656:7681501126656:nvme6:0026b72825ce3d35:c8t0026B72825CE3D35d0
SAMSUNG MZQL23T8HCLS-00A07:S64HNE0NB00017:GDA5402Q:1.4:3840755982336:3840755982336:0:nvme8:1:c13t1d0

This then lets you chain this as:

for f in $(pfexec ./nvmeadm list -p -o instance); do pfexec ./nvmeadm identify $f; done
...

Related issues

Related to illumos gate - Bug #13690: nvmeadm get-logpage doesn't work after 13672ClosedRobert Mustacchi

Actions
Actions #1

Updated by Electric Monk about 1 month ago

  • Gerrit CR set to 1368
Actions #2

Updated by Robert Mustacchi about 1 month ago

I tested this by using it as indicated above, verifying that the normal list output still worked just fine, and invalid combinations of options. I did spot check other options still output the same thing.

Actions #3

Updated by Electric Monk about 1 month ago

  • Status changed from New to Closed
  • % Done changed from 80 to 100

git commit e4cc4004bc22385fe82642b211027316c120a5a5

commit  e4cc4004bc22385fe82642b211027316c120a5a5
Author: Robert Mustacchi <rm@fingolfin.org>
Date:   2021-03-29T17:45:14.000Z

    13672 nvmeadm list could support parsable output
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
    Approved by: Richard Lowe <richlowe@richlowe.net>

Actions #4

Updated by Robert Mustacchi about 1 month ago

  • Related to Bug #13690: nvmeadm get-logpage doesn't work after 13672 added
Actions

Also available in: Atom PDF