nvme: move id, ns, recv, nvme-mi, dir, io-mgtm, security, firmware commands into a plugins - #3824
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reorganizes a large set of previously top-level nvme CLI commands into dedicated plugins to reduce command clutter and shrink the size/complexity of src/nvme.c, while keeping deprecated “trampoline” aliases for migration.
Changes:
- Introduces new core plugins (
id,ns,resv,nvme-mi,io-mgmt,dir,security,fw) and wires them into the Meson build. - Updates tests to use the new subcommand spellings (e.g.,
nvme id ns,nvme ns get-id) and adjusts expected emitted metadata. - Updates/creates manpages for the new commands and marks the old top-level command names as deprecated aliases.
Reviewed changes
Copilot reviewed 140 out of 141 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/py/test_command_metadata_schema.py | Updates command expectations/examples for reorganized command set. |
| tests/e2e/nvme_qpif_test.py | Updates e2e invocations to new id subcommands. |
| tests/e2e/nvme_id_ns_test.py | Updates Identify Namespace test to nvme id ns. |
| tests/e2e/nvme_id_ctrl_test.py | Updates Identify Controller test wording for nvme id ctrl. |
| tests/e2e/nvme_format_test.py | Updates format test to use nvme id ns. |
| tests/e2e/nvme_copy_test.py | Updates helper invocations to nvme ns get-id and nvme id .... |
| plugins/security/security-plugin.h | Adds security plugin command registration. |
| plugins/security/security-plugin.c | Implements Security Send/Receive in plugin form. |
| plugins/resv/resv-plugin.h | Adds resv plugin command registration. |
| plugins/nvme-mi/nvme-mi-plugin.h | Adds nvme-mi plugin command registration. |
| plugins/nvme-mi/nvme-mi-plugin.c | Implements NVMe-MI send/recv in plugin form. |
| plugins/ns/ns-plugin.h | Adds ns plugin command registration. |
| plugins/meson.build | Adds new plugins to the build. |
| plugins/io-mgmt/io-mgmt-plugin.h | Adds io-mgmt plugin command registration. |
| plugins/io-mgmt/io-mgmt-plugin.c | Implements I/O Management send/recv in plugin form. |
| plugins/id/id-plugin.h | Adds id plugin command registration for Identify subcommands. |
| plugins/fw/fw-plugin.h | Adds fw plugin command registration. |
| plugins/dir/dir-plugin.h | Adds dir plugin command registration. |
| NEWS.md | Documents command moves to plugins and deprecation plan. |
| meson_options.txt | Updates plugin choice list for new plugins. |
| Documentation/nvme-telemetry-log.txt | Marks old top-level command as deprecated alias and points to nvme log telemetry. |
| Documentation/nvme-supported-cap-config-log.txt | Marks old top-level command as deprecated alias and points to nvme log supported-cap-config. |
| Documentation/nvme-smart-log.txt | Marks old top-level command as deprecated alias and points to nvme log smart. |
| Documentation/nvme-self-test-log.txt | Marks old top-level command as deprecated alias and points to nvme log self-test. |
| Documentation/nvme-security-send.txt | Updates synopsis to nvme security send and documents deprecated alias. |
| Documentation/nvme-security-recv.txt | Updates synopsis to nvme security recv and documents deprecated alias. |
| Documentation/nvme-sanitize-log.txt | Marks old top-level command as deprecated alias and points to nvme log sanitize. |
| Documentation/nvme-rotational-media-info-log.txt | Marks old top-level command as deprecated alias and points to nvme log rotational-media-info. |
| Documentation/nvme-resv-report.txt | Updates synopsis to nvme resv report and documents deprecated alias. |
| Documentation/nvme-resv-release.txt | Updates synopsis to nvme resv release and documents deprecated alias. |
| Documentation/nvme-resv-register.txt | Updates synopsis to nvme resv register and documents deprecated alias. |
| Documentation/nvme-resv-notif-log.txt | Marks old top-level command as deprecated alias and points to nvme log resv-notif. |
| Documentation/nvme-resv-acquire.txt | Updates synopsis to nvme resv acquire and documents deprecated alias. |
| Documentation/nvme-reachability-groups-log.txt | Marks old top-level command as deprecated alias and points to nvme log reachability-groups. |
| Documentation/nvme-reachability-associations-log.txt | Marks old top-level command as deprecated alias and points to nvme log reachability-associations. |
| Documentation/nvme-primary-ctrl-caps.txt | Marks old top-level command as deprecated alias and points to nvme id primary-ctrl-caps. |
| Documentation/nvme-predictable-lat-log.txt | Marks old top-level command as deprecated alias and points to nvme log predictable-lat. |
| Documentation/nvme-pred-lat-event-agg-log.txt | Marks old top-level command as deprecated alias and points to nvme log pred-lat-event-agg. |
| Documentation/nvme-phy-rx-eom-log.txt | Marks old top-level command as deprecated alias and points to nvme log phy-rx-eom. |
| Documentation/nvme-persistent-event-log.txt | Marks old top-level command as deprecated alias and points to nvme log persistent-event. |
| Documentation/nvme-nvme-mi-send.txt | Updates synopsis to nvme nvme-mi send and documents deprecated alias. |
| Documentation/nvme-nvme-mi-recv.txt | Updates synopsis to nvme nvme-mi recv and documents deprecated alias. |
| Documentation/nvme-nvm-id-ns.txt | Marks old top-level command as deprecated alias and points to nvme id nvm-ns. |
| Documentation/nvme-nvm-id-ns-lba-format.txt | Marks old top-level command as deprecated alias and points to nvme id nvm-ns-lba-format. |
| Documentation/nvme-nvm-id-ctrl.txt | Marks old top-level command as deprecated alias and points to nvme id nvm-ctrl. |
| Documentation/nvme-ns-get-id.txt | Adds manpage for nvme ns get-id. |
| Documentation/nvme-ns-detach.txt | Adds manpage for nvme ns detach. |
| Documentation/nvme-ns-descs.txt | Marks old top-level command as deprecated alias and points to nvme id ns-descs. |
| Documentation/nvme-ns-delete.txt | Adds manpage for nvme ns delete. |
| Documentation/nvme-ns-create.txt | Adds manpage for nvme ns create. |
| Documentation/nvme-ns-attach.txt | Adds manpage for nvme ns attach. |
| Documentation/nvme-mi-cmd-support-effects-log.txt | Marks old top-level command as deprecated alias and points to nvme log mi-cmd-support-effects. |
| Documentation/nvme-mgmt-addr-list-log.txt | Marks old top-level command as deprecated alias and points to nvme log mgmt-addr-list. |
| Documentation/nvme-media-unit-stat-log.txt | Marks old top-level command as deprecated alias and points to nvme log media-unit-stat. |
| Documentation/nvme-log-telemetry.txt | Adds manpage for nvme log telemetry. |
| Documentation/nvme-log-supported-cap-config.txt | Adds manpage for nvme log supported-cap-config. |
| Documentation/nvme-log-smart.txt | Adds manpage for nvme log smart. |
| Documentation/nvme-log-self-test.txt | Adds manpage for nvme log self-test. |
| Documentation/nvme-log-sanitize.txt | Adds manpage for nvme log sanitize. |
| Documentation/nvme-log-rotational-media-info.txt | Adds manpage for nvme log rotational-media-info. |
| Documentation/nvme-log-resv-notif.txt | Adds manpage for nvme log resv-notif. |
| Documentation/nvme-log-reachability-groups.txt | Adds manpage for nvme log reachability-groups. |
| Documentation/nvme-log-reachability-associations.txt | Adds manpage for nvme log reachability-associations. |
| Documentation/nvme-log-predictable-lat.txt | Adds manpage for nvme log predictable-lat. |
| Documentation/nvme-log-pred-lat-event-agg.txt | Adds manpage for nvme log pred-lat-event-agg. |
| Documentation/nvme-log-phy-rx-eom.txt | Adds manpage for nvme log phy-rx-eom. |
| Documentation/nvme-log-persistent-event.txt | Adds manpage for nvme log persistent-event. |
| Documentation/nvme-log-mi-cmd-support-effects.txt | Adds manpage for nvme log mi-cmd-support-effects. |
| Documentation/nvme-log-mgmt-addr-list.txt | Adds manpage for nvme log mgmt-addr-list. |
| Documentation/nvme-log-media-unit-stat.txt | Adds manpage for nvme log media-unit-stat. |
| Documentation/nvme-log-lba-status.txt | Adds manpage for nvme log lba-status. |
| Documentation/nvme-log-host-discovery.txt | Adds manpage for nvme log host-discovery. |
| Documentation/nvme-log-fw.txt | Adds manpage for nvme log fw. |
| Documentation/nvme-log-fid-support-effects.txt | Adds manpage for nvme log fid-support-effects. |
| Documentation/nvme-log-error.txt | Adds manpage for nvme log error. |
| Documentation/nvme-log-endurance.txt | Adds manpage for nvme log endurance. |
| Documentation/nvme-log-endurance-event-agg.txt | Adds manpage for nvme log endurance-event-agg. |
| Documentation/nvme-log-effects.txt | Adds manpage for nvme log effects. |
| Documentation/nvme-log-dispersed-ns-participating-nss.txt | Adds manpage for nvme log dispersed-ns-participating-nss. |
| Documentation/nvme-log-changed-ns-list.txt | Adds manpage for nvme log changed-ns-list. |
| Documentation/nvme-log-changed-alloc-ns-list.txt | Adds manpage for nvme log changed-alloc-ns-list. |
| Documentation/nvme-log-boot-part.txt | Adds manpage for nvme log boot-part. |
| Documentation/nvme-log-ave-discovery.txt | Adds manpage for nvme log ave-discovery. |
| Documentation/nvme-log-ana.txt | Adds manpage for nvme log ana. |
| Documentation/nvme-list-secondary.txt | Marks old top-level command as deprecated alias and points to nvme id secondary-ctrl-list. |
| Documentation/nvme-list-ns.txt | Marks old top-level command as deprecated alias and points to nvme id ns-list. |
| Documentation/nvme-list-endgrp.txt | Marks old top-level command as deprecated alias and points to nvme id endgrp-list. |
| Documentation/nvme-list-ctrl.txt | Marks old top-level command as deprecated alias and points to nvme id ctrl-list. |
| Documentation/nvme-lba-status-log.txt | Marks old top-level command as deprecated alias and points to nvme log lba-status. |
| Documentation/nvme-io-mgmt-send.txt | Updates synopsis to nvme io-mgmt send and documents deprecated alias. |
| Documentation/nvme-io-mgmt-recv.txt | Updates synopsis to nvme io-mgmt recv and documents deprecated alias. |
| Documentation/nvme-id-uuid.txt | Updates synopsis to nvme id uuid and documents deprecated alias. |
| Documentation/nvme-id-secondary-ctrl-list.txt | Adds manpage for nvme id secondary-ctrl-list. |
| Documentation/nvme-id-primary-ctrl-caps.txt | Adds manpage for nvme id primary-ctrl-caps. |
| Documentation/nvme-id-nvmset.txt | Updates synopsis to nvme id nvmset and documents deprecated alias. |
| Documentation/nvme-id-nvm-ns.txt | Adds manpage for nvme id nvm-ns. |
| Documentation/nvme-id-nvm-ns-lba-format.txt | Adds manpage for nvme id nvm-ns-lba-format. |
| Documentation/nvme-id-nvm-ctrl.txt | Adds manpage for nvme id nvm-ctrl. |
| Documentation/nvme-id-ns.txt | Updates synopsis to nvme id ns and documents deprecated alias. |
| Documentation/nvme-id-ns-list.txt | Adds manpage for nvme id ns-list. |
| Documentation/nvme-id-ns-lba-format.txt | Updates synopsis to nvme id ns-lba-format and documents deprecated alias. |
| Documentation/nvme-id-ns-ind.txt | Adds manpage for nvme id ns-ind. |
| Documentation/nvme-id-ns-granularity.txt | Updates synopsis to nvme id ns-granularity and documents deprecated alias. |
| Documentation/nvme-id-ns-descs.txt | Adds manpage for nvme id ns-descs. |
| Documentation/nvme-id-iocs.txt | Updates synopsis to nvme id iocs and documents deprecated alias. |
| Documentation/nvme-id-endgrp-list.txt | Adds manpage for nvme id endgrp-list. |
| Documentation/nvme-id-domain.txt | Updates synopsis to nvme id domain and documents deprecated alias. |
| Documentation/nvme-id-ctrl.txt | Updates synopsis to nvme id ctrl and documents deprecated alias. |
| Documentation/nvme-id-ctrl-list.txt | Adds manpage for nvme id ctrl-list. |
| Documentation/nvme-host-discovery-log.txt | Marks old top-level command as deprecated alias and points to nvme log host-discovery. |
| Documentation/nvme-get-ns-id.txt | Marks old top-level command as deprecated alias and points to nvme ns get-id. |
| Documentation/nvme-fw-log.txt | Marks old top-level command as deprecated alias and points to nvme log fw. |
| Documentation/nvme-fw-download.txt | Updates synopsis to nvme fw download and documents deprecated alias. |
| Documentation/nvme-fw-commit.txt | Updates synopsis to nvme fw commit and documents deprecated alias. |
| Documentation/nvme-fid-support-effects-log.txt | Marks old top-level command as deprecated alias and points to nvme log fid-support-effects. |
| Documentation/nvme-error-log.txt | Marks old top-level command as deprecated alias and points to nvme log error. |
| Documentation/nvme-endurance-log.txt | Marks old top-level command as deprecated alias and points to nvme log endurance. |
| Documentation/nvme-endurance-event-agg-log.txt | Marks old top-level command as deprecated alias and points to nvme log endurance-event-agg. |
| Documentation/nvme-effects-log.txt | Marks old top-level command as deprecated alias and points to nvme log effects. |
| Documentation/nvme-dispersed-ns-participating-nss-log.txt | Marks old top-level command as deprecated alias and points to nvme log dispersed-ns-participating-nss. |
| Documentation/nvme-dir-send.txt | Updates synopsis to nvme dir send and documents deprecated alias. |
| Documentation/nvme-dir-receive.txt | Updates synopsis to nvme dir receive and documents deprecated alias. |
| Documentation/nvme-detach-ns.txt | Marks old top-level command as deprecated alias and points to nvme ns detach. |
| Documentation/nvme-delete-ns.txt | Marks old top-level command as deprecated alias and points to nvme ns delete. |
| Documentation/nvme-create-ns.txt | Marks old top-level command as deprecated alias and points to nvme ns create. |
| Documentation/nvme-cmdset-ind-id-ns.txt | Marks old top-level command as deprecated alias and points to nvme id ns-ind. |
| Documentation/nvme-changed-ns-list-log.txt | Marks old top-level command as deprecated alias and points to nvme log changed-ns-list. |
| Documentation/nvme-changed-alloc-ns-list-log.txt | Marks old top-level command as deprecated alias and points to nvme log changed-alloc-ns-list. |
| Documentation/nvme-boot-part-log.txt | Marks old top-level command as deprecated alias and points to nvme log boot-part. |
| Documentation/nvme-ave-discovery-log.txt | Marks old top-level command as deprecated alias and points to nvme log ave-discovery. |
| Documentation/nvme-attach-ns.txt | Marks old top-level command as deprecated alias and points to nvme ns attach. |
| Documentation/nvme-ana-log.txt | Marks old top-level command as deprecated alias and points to nvme log ana. |
Suppressed comments (6)
plugins/security/security-plugin.c:142
- nvme_init_mi_cmd_flags() takes a bool, but this passes the string variable
ish(always true). Also when --ish is used on a non-MI handle this only prints an error but continues, silently ignoring the requested behavior.
plugins/security/security-plugin.c:228 - In sec_recv(), nvme_init_mi_cmd_flags() is called before nvme_init_security_receive(); nvme_init_security_receive() memset()s the cmd and clears cmd->flags, so --ish has no effect. The call also passes the string
ishinstead of cfg.ish (bool).
plugins/io-mgmt/io-mgmt-plugin.c:87 - cfg.file is treated as a boolean (
if (cfg.file)) but OPT_FILE commonly sets it to an empty string when not provided. This will try to open "" as a path. Use a non-empty check instead.
plugins/io-mgmt/io-mgmt-plugin.c:94 - On read(2) failure this returns the raw -1 from read() instead of -errno, which breaks the convention used elsewhere in nvme-cli (negative errno) and loses the real failure reason.
plugins/io-mgmt/io-mgmt-plugin.c:131 - io_mgmt_recv() also leaves most of
cfguninitialized (only .mos is set), which can lead to unpredictable nsid/mo/data_len/file values.
plugins/io-mgmt/io-mgmt-plugin.c:174 - io_mgmt_recv() uses
if (cfg.file)to decide whether to write to a file, but OPT_FILE commonly yields an empty string when not set; this will try to create/open "". Use a non-empty check instead.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There are too many top-level commands cluttering the space. Move the id commands into a plugin, e.g., nvme id-ctrl -> nvme id ctrl Signed-off-by: Daniel Wagner <dwagner@suse.com>
There are too many top-level commands cluttering the space. Move the namespace commands into a plugin, e.g., nvme delete-ns -> nvme ns delete Signed-off-by: Daniel Wagner <dwagner@suse.com>
There are too many top-level commands cluttering the space. Move the reservation commands into a plugin, e.g., nvme resv-acquire -> nvme resv acquire Signed-off-by: Daniel Wagner <dwagner@suse.com>
There are too many top-level commands cluttering the space. Move the nvme-mi commands into a plugin, e.g., nvme nmve-mi-send -> nvme mi send Signed-off-by: Daniel Wagner <dwagner@suse.com>
There are too many top-level commands cluttering the space. Move the dir commands into a plugin, e.g., nvme dir-receive -> nvme dir receive Signed-off-by: Daniel Wagner <dwagner@suse.com>
There are too many top-level commands cluttering the space. Move the io-mgmt commands into a plugin, e.g., nvme io-mgmt-recv -> nvme io-mgmt recv Signed-off-by: Daniel Wagner <dwagner@suse.com>
There are too many top-level commands cluttering the space. Move the security commands into a plugin, e.g., nvme security-send -> nvme security send Signed-off-by: Daniel Wagner <dwagner@suse.com>
There are too many top-level commands cluttering the space. Move the firmware commands into a plugin, e.g., nvme fw-commit -> nvme fw commit Signed-off-by: Daniel Wagner <dwagner@suse.com>
The ns, recv, nvme-mi, dir, io-mgmt, security and fw commands have been moved to plugins. Update the documenation accordingly. Signed-off-by: Daniel Wagner <dwagner@suse.com>
The id, ns, resv, nvme-mi, io-mgmt, dir, security, and fw commands have moved into plugins across the preceding commits. Record all of these moves in a single NEWS.md update. Signed-off-by: Daniel Wagner <dwagner@suse.com>
Validate the input size argument and handle the error handling correclty. Signed-off-by: Daniel Wagner <dwagner@suse.com>
Initialize all fields so not random values from the stack are used. Signed-off-by: Daniel Wagner <dwagner@suse.com>
perror is not aware of the output format, thus use nvme_show_perror. While at it also return the error code. Signed-off-by: Daniel Wagner <dwagner@suse.com>
With the recent code move commands into plugins, the testing document needs to be updated accordingly. Signed-off-by: Daniel Wagner <dwagner@suse.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are too many top-level commands cluttering the space. Move some commands into a plugins. Also install trampoline commands so users have a migration time frame. We can then remove the deprecated top level commands in the next major release.
Besides making the 'help' text more useful, it also moves a lot of code out of the way too big
src/nvme.cfile.