Daniel Wagner [Thu, 31 Aug 2023 14:26:11 +0000 (16:26 +0200)]
build: use latest container instead fixed version
We control the build containers so there is little risk
that these randomly break. So let's go with the latest
version and avoid updating the build files all the time.
fabrics: Use corresponding hostid when hostnqn is generated
After the kernel commit ae8bd606e09b ("nvme-fabrics: prevent overriding
of existing host"), kernel ensures hostid and hostnqn maintain 1:1
mapping and "non 1:1 mapping will be rejected". This makes 'nvme
discover' and 'nvme connect' commands fail when they generate hostnqn,
since it does not use corresponding hostid.
To avoid the failures, prepare and use corresponding hostid to the
generated hostnqn, taking the hostid from the hostnqn string. Also add
checks for prepared hostnqn and hostid. If the hostid taken from the
generated hostnqn is different from the hostid from file, print a
warning message. Also, if the prepared hostnqn are inconsistent with the
prepared hostid, print a warning.
Martin Belanger [Thu, 3 Aug 2023 17:15:28 +0000 (13:15 -0400)]
json: fix seg. fault converting NULL to JSON string
The function json_object_new_string() seg. faults when passed a
NULL pointer. This can happen, for example, when parameters retuned
by a controller (e.g. Firmware, Model Number, Serial Number, etc.)
are undefined and therefore NULL. This will cause the following
command to crash:
Keith Busch [Thu, 27 Jul 2023 08:14:37 +0000 (10:14 +0200)]
nvme-cli: fix extended metadata size calculation
With commit 8a2bfa5be4d3 ("nvme: fix block count and data size logic")
we are rounding the request size up. And later we are adding the
extended metadata on top. Thus first figure out if extended metadata is
used and then do the rounding.
Daniel Wagner [Wed, 26 Jul 2023 13:46:55 +0000 (15:46 +0200)]
nvme-print-stdout: Do not show non reachable ns in namespace topology
If the host is connected to the target with two different hostnqn we can
have the situation where a namespace is only reachable via one ctrl and
a second namespace only by a different controller. Thus we should only
show a namespace in the topology if there is a path.
Vincent Fu [Tue, 25 Jul 2023 18:17:17 +0000 (18:17 +0000)]
nvme-print-stdout: fix storage tag size label
The NVM Command Set Extended LBA Format Data Structure has Protection
Information Format (pif) and Storage Tag Size (sts) fields. The sts
field is incorrectly labeled in the non-verbose normal output. Fix the
label.
Martin George [Wed, 19 Jul 2023 06:55:54 +0000 (12:25 +0530)]
nvme-print: fix counter while looping through uuid_list
While iterating through the uuid_list in json_nvme_id_uuid_list()
as part of the 'id-uuid' json output, it always misses out
displaying the first uuid entry here due to wrongly initialized
counter value. Fix it.
And while we are at it, remove the respective comment in
stdout_id_uuid_list() as well where this counter is already
properly initiatlized.
Caleb Sander [Wed, 28 Jun 2023 20:35:24 +0000 (14:35 -0600)]
fabrics: only look for matching ctrl on same host
With the lookup_ctrl() check to prevent duplicate connections,
identical connections from different hosts are no longer possible.
Fix lookup_ctrl() to only look for matching controllers
on the same host that is being connected.
This restores the ability for multiple hosts on the same machine
to connect to the same transport addresses on the same subsystem.
Fixes: 07d6b91 ("fabrics: Do not attempt to reconnect to already
connected ctrls") Signed-off-by: Caleb Sander <[email protected]>
nvme_show_ana_log() and nvme_show_boot_part_log() are being called
with their "length" and "flags" arguments swapped.
Fix this so their output is displayed correctly.
Daniel Wagner [Fri, 23 Jun 2023 06:45:26 +0000 (08:45 +0200)]
nvme-print: Remove left overs from refactoring
The refactoring of the printing code left some code in the original
place. Remove it now
Fixes: 1d583b7856db ("nvme-print-stdout: Refactor stdout print code to use print_ops") Fixes: 73dfe8a2d227 ("nvme-print-binary: Refactor binary print code to use print_ops") Signed-off-by: Daniel Wagner <[email protected]>
Daniel Wagner [Fri, 23 Jun 2023 06:40:59 +0000 (08:40 +0200)]
nvme-print: Move num argument parsing into callbacks
The goal for the libnvme type print function is only to use
the types from the library as argument. The num argument can be
parsed from the ctrl_list thus move it the callbacks directly.
Daniel Wagner [Wed, 14 Jun 2023 12:10:51 +0000 (14:10 +0200)]
fabrics: Add support for volatile configuration
The fabric resources are global resources and as such should only
modified by one component. So far nvme-cli was the only component
managing connections. With the introduction of nvme-stas we need to
coordinate the access to these resources.
Introduce access coordination feature which allows the external software
to drop volatile configurations files into the /var/nvme directory.
When nvme-cli ls executed(e.g. via the udev rules), the execution
context is evaluated and only resources which belong the application are
considered.
Daniel Wagner [Wed, 14 Jun 2023 12:03:53 +0000 (14:03 +0200)]
fabrics: Do not print device on connect per default
During the print code refactoring, the show connect message was enabled
per default. To avoid any regressions in application restore the old
behavior and print only the result when the '-o' option is used.
Fixes: 0576d84bf4aa ("fabrics: Move printing functions to the print files") Signed-off-by: Daniel Wagner <[email protected]>
Daniel Wagner [Wed, 14 Jun 2023 11:57:35 +0000 (13:57 +0200)]
fabrics: Revert 'fabrics: prevent 'nvme connect' to well-known discovery
NQN'
Unfortunately, blktests nvme/003 depends on this feature. To avoid
any regression in the testsuite revert the change. After this has
been address in blktests we can add it back.
Fixes: 9077d042c04a ("fabrics: prevent 'nvme connect' to well-known discovery NQN") Signed-off-by: Daniel Wagner <[email protected]>
Sagi Grimberg [Mon, 12 Jun 2023 15:34:06 +0000 (18:34 +0300)]
nvme-print: fix wrong list-subsys output when ns are attached to different ctrls
If we list subsystem controllers not for a specific ns (user did not pass
a namespace device node), we cannot look at the first ns in the subsystem
to list because it may not be attached to all subsystem controllers.
We incorrectly assumes that subsystem namespaces (or at least the first of
them) are attached to all subsystem controllers.
Fix that by showing the multipath subsystem-list flavor only when the user
passed a specific namespace, and fallback to a simple controller list otherwise.
Fixes: cdeaab8fca6e ("nvme-print: Show ANA state only for one namespace") Fixes: 7435ed9ae6a6 ("nvme-print: Show paths from the first namespace only") Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Daniel Wagner <[email protected]>
Daniel Wagner [Tue, 6 Jun 2023 15:21:55 +0000 (17:21 +0200)]
nvme: Use correct data buffer size
The submit_io command is using the buffer size provided by the
user. But this size argument might be updated and the correct length
for the buffer is buffer_size. Thus use this value and not the
initial length.
plugins/zns: Fix zns.c linux kernel check patch errors and warnings
Note: Still the remaining warning messages are not fixed as same with nvme.c.
WARNING: quoted string split across lines
+ const char *desc = "Send a ZNS specific Identify Controller command to "
+ "the given device and report information about the specified "
WARNING: quoted string split across lines
+ "the given device and report information about the specified "
+ "controller in various formats.";
WARNING: quoted string split across lines
+ const char *desc = "Send a ZNS specific Identify Namespace command to "
+ "the given device and report information about the specified "
WARNING: quoted string split across lines
+ "the given device and report information about the specified "
+ "namespace in varios formats.";
WARNING: quoted string split across lines
+ const char *desc = "The zone append command is used to write to a zone "
+ "using the slba of the zone, and the write will be appended from the "
WARNING: quoted string split across lines
+ "using the slba of the zone, and the write will be appended from the "
+ "write pointer of the zone";
plugins/shannon: Fix shannon-nvme.c linux kernel check patch errors and warnings
Note: Still the remaining warning messages are not fixed as same with nvme.c.
WARNING: quoted string split across lines
+ const char *desc = "Read operating parameters of the "
+ "specified controller. Operating parameters are grouped "
...
WARNING: quoted string split across lines
+ "are vendor-specific and not changeable. Use set-feature to "
+ "change saveable Features.\n\n"
WARNING: quoted string split across lines
+ const char *desc = "Modify the saveable or changeable "
+ "current operating parameters of the controller. Operating "
...
WARNING: quoted string split across lines
+ "Use get-feature to determine which Features are supported by "
+ "the controller and are saveable/changeable.\n\n"
plugins/seagate: Fix seagate-nvme.c linux kernel check patch warnings
Note: Still the remaining warning messages are not fixed as same with nvme.c.
WARNING: quoted string split across lines
+ const char *log_specific = "1 - controller shall capture Data representing the internal "
+ "state of the controller at the time the command is processed. "
WARNING: quoted string split across lines
+ "state of the controller at the time the command is processed. "
+ "0 - controller shall not update the Telemetry Host Initiated Data.";
plugins/micron: Fix micron-nvme.c linux kernel check patch errors and warnings
Note: Still the remaining warning messages are not fixed as same with nvme.c.
WARNING: quoted string split across lines
+ "This performs a selective firmware download, which allows the user to "
+ "select which firmware binary to update for 9200 devices. This requires "
WARNING: quoted string split across lines
+ "select which firmware binary to update for 9200 devices. This requires "
+ "a power cycle once the update completes. The options available are:\n\n"
plugins/memblaze: Fix memblaze-nvme.c linux kernel check patch errors and warnings
Note: Still the remaining warning messages are not fixed as same with nvme.c.
WARNING: quoted string split across lines
+ "This performs a selective firmware download, which allows the user to "
+ "select which firmware binary to update for 9200 devices. This requires a power cycle once the "
WARNING: quoted string split across lines
+ "select which firmware binary to update for 9200 devices. This requires a power cycle once the "
+ "update completes. The options available are:\n\n"
Daniel Wagner [Mon, 5 Jun 2023 15:13:29 +0000 (17:13 +0200)]
nvme: Use correct metadata buffer size
The submit_io command is using the metadata buffer size provided by the
user. But this size argument might be updated and the correct length
for the mbuffer is mbuffer_size. Thus use this value and not the
initial length.
Fixes: 18de3a6d61a7 ("Convert to libnvme") Signed-off-by: Daniel Wagner <[email protected]>
Daniel Wagner [Fri, 19 May 2023 16:33:29 +0000 (18:33 +0200)]
print: Introduce print ops structure
Introduce callbacks for printing the nvme data structures. With this we
are able to split the two printing types (stdout and json) and just use
the ops the user selects ('-o json' for example).