fix(nvmf): parse json output from "nvme list-subsys"#2447
Conversation
|
CC @mwilck |
| | .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 . |
There was a problem hiding this comment.
This is advanced jq usage which may need some commenting. What exactly does the . in line 118 produce? Is it the empty string?
There was a problem hiding this comment.
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>
5d1e740 to
3d242b0
Compare
|
@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). |
|
FYI, I'll be breaking the |
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. |
|
I believe this PR can be closed now that #2496 landed. Please reopen (and rebase) if still needed. |
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