Skip to content

nvme: move get-log page commands into a plugin - #3818

Merged
igaw merged 5 commits into
linux-nvme:masterfrom
dwsuse:log-plugin
Aug 12, 2026
Merged

nvme: move get-log page commands into a plugin#3818
igaw merged 5 commits into
linux-nvme:masterfrom
dwsuse:log-plugin

Conversation

@dwsuse

@dwsuse dwsuse commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

There are too many top-level commands cluttering the space. Move the specialized get-log page commands into a plugin, e.g.,

nvme smart-log -> nvme log smart

The main command 'nvme get-log' remains available at the top level.

@dwsuse

dwsuse commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

I do like this here:

$ nvme log
nvme-3.0-b.5
usage: nvme log <command> [<device>] [<args>]

The '<device>' may be either an NVMe controller device (ex: /dev/nvme0), an
nvme namespace device (ex: /dev/nvme0n1), or a mctp address in the form
mctp:<net>,<eid>[:ctrl-id]

Retrieve and show NVMe log pages

The following are all implemented sub-commands:
  smart                            Retrieve SMART Log, show it
  ana                              Retrieve ANA Log, show it
  telemetry                        Retrieve FW Telemetry log write to file
  fw                               Retrieve FW Log, show it
  endurance                        Retrieve Endurance Group Log, show it
  effects                          Retrieve Command Effects Log, show it
  error                            Retrieve Error Log, show it
  changed-ns-list                  Retrieve Changed Attached Namespace List, show it
  changed-alloc-ns-list            Retrieve Changed Allocated Namespace List, show it
  predictable-lat                  Retrieve Predictable Latency per Nvmset Log, show it
  pred-lat-event-agg               Retrieve Predictable Latency Event Aggregate Log, show it
  persistent-event                 Retrieve Persistent Event Log, show it
  endurance-event-agg              Retrieve Endurance Group Event Aggregate Log, show it
  lba-status                       Retrieve LBA Status Information Log, show it
  resv-notif                       Retrieve Reservation Notification Log, show it
  boot-part                        Retrieve Boot Partition Log, show it
  phy-rx-eom                       Retrieve Physical Interface Receiver Eye Opening Measurement, show it
  self-test                        Retrieve the SELF-TEST Log, show it
  fid-support-effects              Retrieve FID Support and Effects log and show it
  mi-cmd-support-effects           Retrieve MI Command Support and Effects log and show it
  media-unit-stat                  Retrieve the configuration and wear of media units, show it
  supported-cap-config             Retrieve the list of Supported Capacity Configuration Descriptors
  mgmt-addr-list                   Retrieve Management Address List Log, show it
  rotational-media-info            Retrieve Rotational Media Information Log, show it
  dispersed-ns-participating-nss   Retrieve Dispersed Namespace Participating NVM Subsystems Log, show it
  reachability-groups              Retrieve Reachability Groups Log, show it
  reachability-associations        Retrieve Reachability Associations Log, show it
  host-discovery                   Retrieve Host Discovery Log, show it
  ave-discovery                    Retrieve AVE Discovery Log, show it
  pull-model-ddc-req               Retrieve Pull Model DDC Request Log, show it
  power-measurement                Retrieve Power Measurement Log, show it
  sanitize                         Retrieve sanitize log, show it
  version                          Shows the program version
  help                             Display this help

Though this makes it inconsistent IMO. There are some more candidates which could go into a plugin, e.g. the identify commands or namespace commands...

$ nvme help
  list                   List all NVMe devices and namespaces on machine
  list-subsys            List nvme subsystems
  id-ctrl                Send NVMe Identify Controller
  id-ns                  Send NVMe Identify Namespace, display structure
  id-ns-granularity      Send NVMe Identify Namespace Granularity List, display structure
  id-ns-lba-format       Send NVMe Identify Namespace for the specified LBA Format index, display structure
  list-ns                Send NVMe Identify List, display structure
  list-ctrl              Send NVMe Identify Controller List, display structure
  nvm-id-ctrl            Send NVMe Identify Controller NVM Command Set, display structure
  nvm-id-ns              Send NVMe Identify Namespace NVM Command Set, display structure
  nvm-id-ns-lba-format   Send NVMe Identify Namespace NVM Command Set for the specified LBA Format index, display structure
  primary-ctrl-caps      Send NVMe Identify Primary Controller Capabilities
  list-secondary         List Secondary Controllers associated with a Primary Controller
  cmdset-ind-id-ns       I/O Command Set Independent Identify Namespace
  ns-descs               Send NVMe Namespace Descriptor List, display structure
  id-nvmset              Send NVMe Identify NVM Set List, display structure
  id-uuid                Send NVMe Identify UUID List, display structure
  id-iocs                Send NVMe Identify I/O Command Set, display structure
  id-domain              Send NVMe Identify Domain List, display structure
  list-endgrp            Send NVMe Identify Endurance Group List, display structure
  create-ns              Creates a namespace with the provided parameters
  delete-ns              Deletes a namespace from the controller
  attach-ns              Attaches a namespace to requested controller(s)
  detach-ns              Detaches a namespace from requested controller(s)
  get-ns-id              Retrieve the namespace ID of opened block device
  get-log                Generic NVMe get log, returns log in raw format
  get-feature            Get feature and show the resulting value
  device-self-test       Perform the necessary tests to observe the performance
  supported-log-pages    Retrieve the Supported Log pages details, show it
  set-feature            Set a feature and show the resulting value
  set-property           Set a property and show the resulting value
  get-property           Get a property and show the resulting value
  format                 Format namespace with new block format
  fw-commit              Verify and commit firmware to a specific slot (fw-activate in old version < 1.2)
  fw-download            Download new firmware
  admin-passthru         Submit an arbitrary admin command, return results
  io-passthru            Submit an arbitrary IO command, return results
  security-send          Submit a Security Send command, return results
  security-recv          Submit a Security Receive command, return results
  get-lba-status         Submit a Get LBA Status command, return results
  capacity-mgmt          Submit Capacity Management Command, return results
  resv-acquire           Submit a Reservation Acquire, return results
  resv-register          Submit a Reservation Register, return results
  resv-release           Submit a Reservation Release, return results
  resv-report            Submit a Reservation Report, return results
  dsm                    Submit a Data Set Management command, return results
  copy                   Submit a Simple Copy command, return results
  flush                  Submit a Flush command, return results
  compare                Submit a Compare command, return results
  read                   Submit a read command, return results
  write                  Submit a write command, return results
  write-zeroes           Submit a write zeroes command, return results
  write-uncor            Submit a write uncorrectable command, return results
  verify                 Submit a verify command, return results
  sanitize               Submit a sanitize command
  sanitize-ns            Submit a sanitize namespace command
  reset                  Resets the controller
  subsystem-reset        Resets the subsystem
  ns-rescan              Rescans the NVME namespaces
  show-regs              Shows the controller registers or properties. Requires character device
  set-reg                Set a register and show the resulting value
  get-reg                Get a register and show the resulting value
  top                    nvme top
  discover               Discover NVMeoF subsystems
  connect-all            Discover and Connect to NVMeoF subsystems
  connect                Connect to NVMeoF subsystem
  disconnect             Disconnect from NVMeoF subsystem
  disconnect-all         Disconnect from all connected NVMeoF subsystems
  dim                    Send Discovery Information Management command to a Discovery Controller
  gen-hostnqn            Generate NVMeoF host NQN
  show-hostnqn           Show NVMeoF host NQN
  dir-receive            Submit a Directive Receive command, return results
  dir-send               Submit a Directive Send command, return results
  virt-mgmt              Manage Flexible Resources between Primary and Secondary Controller
  rpmb                   Replay Protection Memory Block commands
  lockdown               Submit a Lockdown command,return result
  show-topology          Show the topology
  io-mgmt-recv           I/O Management Receive
  io-mgmt-send           I/O Management Send
  nvme-mi-recv           Submit a NVMe-MI Receive command, return results
  nvme-mi-send           Submit a NVMe-MI Send command, return results
  version                Shows the program version
  help                   Display this help

So in other words just moving the *-log commands into a plugin doesn't really make sense to me. WDYT

@dwsuse

dwsuse commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

One idea I had is to enable deprecated commands per default, but move them out of the main list section and show them under 'deprecated commands'. While doing this, the plugins could also be split into two types, like spec plugins (zns, fdp, ...) and the vendor extensions.

Furthermore issue an info that these are deprecated commands are going to be remove in the next major version update. This will allow people some time to transition.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR restructures nvme-cli’s log-page-related CLI surface by moving the specialized *-log commands into a new core nvme log plugin (while keeping nvme get-log at top level), and introduces explicit handling for “core” vs “vendor” plugins plus a separate deprecated-commands help section.

Changes:

  • Introduces a new core log plugin (nvme log <page>) and converts legacy top-level *-log commands into optional deprecated aliases.
  • Extends plugin/command metadata to track core plugins and deprecated commands, and updates nvme help output to list them in separate sections.
  • Updates unit/e2e tests and documentation to reflect the new command paths and default build settings for deprecated commands.

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/py/test_command_metadata_schema.py Updates help-scraping logic to match new “core/vendor plugin” help sections and adjusts expected builtin commands.
tests/nvme_test.py Updates wrappers to use nvme log smart / nvme log error instead of legacy top-level commands.
tests/e2e/plugins/micron/micron_vs_temperature_stats_test.py Switches SMART log invocations and expected error text to nvme log smart.
tests/e2e/nvme_lba_status_log_test.py Switches lba-status-log to nvme log lba-status.
tests/e2e/nvme_fw_log_test.py Switches fw-log to nvme log fw.
src/plugin.h Adds core and deprecated flags to plugin/command structs.
src/plugin.c Updates nvme help output to separate core vs vendor plugins and to list deprecated subcommands separately.
src/nvme-regs.h Adds new register-mapping helper header used by log plugin functionality.
src/nvme-regs.c Adds register mmap/munmap helpers for CAP/CSS inspection.
src/nvme-builtin.h Moves many *-log commands behind deprecated-alias gating and updates help strings with migration hints.
src/meson.build Adds src/nvme-regs.c to the build.
src/cmd_handler.h Adds NAME_CORE and ENTRY_DEPRECATED macro machinery to support new flags.
plugins/zns/zns.h Marks plugin as core via NAME_CORE.
plugins/utils/utils.h Marks plugin as core via NAME_CORE.
plugins/sed/sed.h Marks plugin as core via NAME_CORE.
plugins/registry/registry-nvme.h Marks plugin as core via NAME_CORE.
plugins/ocp/ocp-nvme.h Marks plugin as core via NAME_CORE.
plugins/nbft/nbft-plugin.h Marks plugin as core via NAME_CORE.
plugins/meson.build Adds the new log plugin to the plugin build list.
plugins/log/log-plugin.h Declares the new log plugin command set mapping former *-log commands to nvme log <name>.
plugins/log/log-plugin.c Implements nvme log ... commands and shared log-page retrieval logic in the new plugin.
plugins/lm/lm-nvme.h Marks plugin as core via NAME_CORE.
plugins/keys/keys-plugin.h Marks plugin as core via NAME_CORE.
plugins/feat/feat-nvme.h Marks plugin as core via NAME_CORE.
plugins/fdp/fdp.h Marks plugin as core via NAME_CORE.
plugins/exclusion/exclusion-nvme.h Marks plugin as core via NAME_CORE.
plugins/config/config-nvme.h Marks plugin as core via NAME_CORE.
NEWS.md Documents the command move to nvme log, deprecated-alias behavior, and new default build setting.
meson_options.txt Enables deprecated commands by default and adds log to the selectable plugins list.
Suppressed comments (1)

plugins/log/log-plugin.c:2457

  • The --rae option is not honored for the initial Host Discovery log fetch: libnvme_get_log() is called with false, so the first request won’t set RAE even when requested (and may clear AEN state).
	nvme_init_get_log_host_discovery(&cmd, rae, log, log_len);
	err = libnvme_get_log(hdl, &cmd, false, log_len);
	if (err)
		goto err_free;

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread plugins/log/log-plugin.c Outdated
Comment thread plugins/log/log-plugin.c Outdated
Comment thread plugins/log/log-plugin.c Outdated
Comment thread src/nvme-regs.c
dwsuse added 5 commits August 12, 2026 11:28
There are too many top-level commands cluttering the space. Move the
specialized get-log page commands into a plugin, e.g.,

  nvme smart-log -> nvme log smart

The main command 'nvme get-log' remains available at the top level.

Signed-off-by: Daniel Wagner <dwagner@suse.com>
The more user friendly approach is to give time to migrate to the new
commands instead having a flag day update. Thus enabled deprecated
commands per default but move them out of the main sections when showing
the available commands.

Update the info that these commands will be removed in the next major
version.

Signed-off-by: Daniel Wagner <dwagner@suse.com>
The core plugins implement the spec and key part of the nvme-cli, thus
should be listed before the vendor plugins.

Signed-off-by: Daniel Wagner <dwagner@suse.com>
Avoid buffer overflows by using asprintf instead of fixed buffers.

Signed-off-by: Daniel Wagner <dwagner@suse.com>
When in-lining the helper functions into the caller some of the
arguments got mixed up. Fix those.
@igaw
igaw merged commit 64131d0 into linux-nvme:master Aug 12, 2026
32 of 33 checks passed
@dwsuse
dwsuse deleted the log-plugin branch August 12, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants