Skip to content

fix(nvmf): parse json output from "nvme list-subsys"#2447

Closed
stuarthayes wants to merge 1 commit into
dracut-ng:mainfrom
stuarthayes:nvmf-parse-subsys-json
Closed

fix(nvmf): parse json output from "nvme list-subsys"#2447
stuarthayes wants to merge 1 commit into
dracut-ng:mainfrom
stuarthayes:nvmf-parse-subsys-json

Conversation

@stuarthayes

Copy link
Copy Markdown

Modify code that parses the output of "nvme list-subsys" to set up rd.nvmf.discover parameter to use the json output of nvme rather than the human-readable output.

A recent commit to nvme-cli changed the human-readable output to only print the transport address rather than the address line that includes all of the needed information, but the json output still contains the needed information.

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

@stuarthayes
stuarthayes requested a review from a team as a code owner May 15, 2026 19:16
@github-actions github-actions Bot added modules Issue tracker for all modules nvmf Issues related to the nvmf module labels May 15, 2026
@devkontrol

Copy link
Copy Markdown
Collaborator

CC @mwilck

@mwilck mwilck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good in general, but it conflicts with #2249 which I'd like to resolve first.

Comment thread modules.d/74nvmf/module-setup.sh Outdated
| .Address as $a
| ($a | capture("traddr=(?<traddr>[^,]*)(,trsvcid=(?<trsvcid>[^,]*))?(,host_traddr=(?<host_traddr>[^,]*))?")) as $m
| if $m.traddr == null and $m.trsvcid == null and $m.host_traddr == null
then .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is advanced jq usage which may need some commenting. What exactly does the . in line 118 produce? Is it the empty string?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But a recent commit to nvme-cli (linux-nvme/nvme-cli#3413) changed the JSON output of "nvme list-subsys" in a way that will break this patch, so I will need to work on that...

Modify code that parses the output of "nvme list-subsys" to set up
rd.nvmf.discover parameter to use the json output of nvme rather than the
human-readable output.

A recent commit to nvme-cli changed the human-readable output to only
print the transport address rather than the address line that includes all
of the needed information, but the json output still contains the needed
information.

An even more recent commit to nvme-cli changed the json output (it moved
some details from the "Address" value to an "AddressDetails" object), so
support that as well as the previous format.

Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
@stuarthayes
stuarthayes force-pushed the nvmf-parse-subsys-json branch from 5d1e740 to 3d242b0 Compare June 8, 2026 18:26
@stuarthayes

Copy link
Copy Markdown
Author

@mwilck I modified the patch to also work with the recent changes to nvme-cli, but I realize this will conflict with dracut patches you are working on. I can rework this when your patches are in (or feel free to pull this into your patches, if you like).

@tbzatek

tbzatek commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

FYI, I'll be breaking the nvme nbft show -o json output in nvme-cli-3.0. For dracut use it's going to be about flags, perhaps most other keys will remain untouched. The development version of nvme-cli is currently volatile in terms of the output format and will take time to settle down.

@mwilck

mwilck commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

FYI, I'll be breaking the nvme nbft show -o json output in nvme-cli-3.0.

It won't hurt as long as you just add fields. But if this is going to be volatile for some time to come, we should probably add a "version" field.

@devkontrol

Copy link
Copy Markdown
Collaborator

I believe this PR can be closed now that #2496 landed.

Please reopen (and rebase) if still needed.

@devkontrol devkontrol closed this Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modules Issue tracker for all modules nvmf Issues related to the nvmf module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants