Compare commits

..

8 commits

Author SHA1 Message Date
Tomas Bzatek
6e6a6d49fc * Thu Dec 04 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.16-1
- Update to 2.16
2025-12-04 14:44:50 +01:00
Tomas Bzatek
3618605a76 * Fri Aug 15 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.15-2
- Fix nvme-list JSON output compatibility
- Rename 71-nvme-hpe.rules to 71-nvmf-hpe.rules
2025-08-15 18:03:23 +02:00
Tomas Bzatek
e01b55c71f * Fri Jul 25 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.15-1
- Update to 2.15
2025-07-25 23:23:42 +02:00
Fedora Release Engineering
d8a5bb174c Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 23:02:44 +00:00
Tomas Bzatek
e8eb04bafc * Wed Jul 09 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.14-1
- Update to 2.14
- Disable Persistent Discovery Controllers by default
2025-07-09 15:20:17 +02:00
Tomas Bzatek
c0028af7fa * Fri Apr 11 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.13-1
- Update to 2.13
2025-04-11 16:51:47 +02:00
Tomas Bzatek
58dfd6f0b1 * Mon Mar 17 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.12-1
- Update to 2.12
2025-03-18 15:06:01 +01:00
Tomas Bzatek
3dfbefd554 * Tue Feb 04 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.11-3
- Add systemd units scriptlets
- Reload udevd after installing udev rules

https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd
2025-02-04 16:55:22 +01:00
5 changed files with 39 additions and 214 deletions

1
.gitignore vendored
View file

@ -41,3 +41,4 @@
/nvme-cli-2.13.tar.gz
/nvme-cli-2.14.tar.gz
/nvme-cli-2.15.tar.gz
/nvme-cli-2.16.tar.gz

View file

@ -1,173 +0,0 @@
From 80ad62ba75f1f1dd5b99c6f56769141b48344485 Mon Sep 17 00:00:00 2001
From: Nilay Shroff <nilay@linux.ibm.com>
Date: Tue, 5 Aug 2025 15:50:50 +0530
Subject: [PATCH] nvme-list: make verbose JSON output backward compatible
The commit 64bed0a87a23 ("nvme-list: fix verbose JSON output for 'nvme
list' command") changed the JSON output format of the nvme list --verbose
command. While the new format is more structured, it introduced a
regression by breaking compatibility with tools and scripts relying on
the previous JSON schema.
So to restore backward compatibility, we now leverage the existing
--output-format-version option. With this patch,
1. The default --output-format-version=1 retains the original (legacy) JSON
format for nvme list --verbose.
2. If the user explicitly sets --output-format-version=2 then the newer
JSON structure introduced by commit 64bed0a87a23 ("nvme-list: fix verbose
JSON output for 'nvme list' command") is used.
This ensures that existing users and automation relying on the older format
do not break, while still supporting the newer schema for forward-looking
users.
Fixes: 64bed0a87a23 ("nvme-list: fix verbose JSON output for 'nvme list' command")
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Link: https://patch.msgid.link/20250805102055.3375272-1-nilay@linux.ibm.com
Signed-off-by: Daniel Wagner <wagi@kernel.org>
---
nvme-print-json.c | 117 ++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 113 insertions(+), 4 deletions(-)
diff --git a/nvme-print-json.c b/nvme-print-json.c
index 11b6661624..829ba718e8 100644
--- a/nvme-print-json.c
+++ b/nvme-print-json.c
@@ -4519,7 +4519,7 @@ static void json_print_detail_list(nvme_subsystem_t s, struct json_object *jss)
obj_add_obj(jss, "Controllers", jctrls);
}
-static void json_detail_list(nvme_root_t t)
+static void json_detail_list_v2(nvme_root_t t)
{
struct json_object *r = json_create_object();
struct json_object *jdev = json_create_array();
@@ -4560,6 +4560,112 @@ static void json_detail_list(nvme_root_t t)
json_print(r);
}
+static void json_detail_list(nvme_root_t t)
+{
+ struct json_object *r = json_create_object();
+ struct json_object *jdev = json_create_array();
+
+ nvme_host_t h;
+ nvme_subsystem_t s;
+ nvme_ctrl_t c;
+ nvme_path_t p;
+ nvme_ns_t n;
+
+ nvme_for_each_host(t, h) {
+ struct json_object *hss = json_create_object();
+ struct json_object *jsslist = json_create_array();
+ const char *hostid;
+
+ obj_add_str(hss, "HostNQN", nvme_host_get_hostnqn(h));
+ hostid = nvme_host_get_hostid(h);
+ if (hostid)
+ obj_add_str(hss, "HostID", hostid);
+
+ nvme_for_each_subsystem(h, s) {
+ struct json_object *jss = json_create_object();
+ struct json_object *jctrls = json_create_array();
+ struct json_object *jnss = json_create_array();
+
+ obj_add_str(jss, "Subsystem", nvme_subsystem_get_name(s));
+ obj_add_str(jss, "SubsystemNQN", nvme_subsystem_get_nqn(s));
+
+ nvme_subsystem_for_each_ctrl(s, c) {
+ struct json_object *jctrl = json_create_object();
+ struct json_object *jnss = json_create_array();
+ struct json_object *jpaths = json_create_array();
+
+ obj_add_str(jctrl, "Controller", nvme_ctrl_get_name(c));
+ obj_add_str(jctrl, "Cntlid", nvme_ctrl_get_cntlid(c));
+ obj_add_str(jctrl, "SerialNumber", nvme_ctrl_get_serial(c));
+ obj_add_str(jctrl, "ModelNumber", nvme_ctrl_get_model(c));
+ obj_add_str(jctrl, "Firmware", nvme_ctrl_get_firmware(c));
+ obj_add_str(jctrl, "Transport", nvme_ctrl_get_transport(c));
+ obj_add_str(jctrl, "Address", nvme_ctrl_get_address(c));
+ obj_add_str(jctrl, "Slot", nvme_ctrl_get_phy_slot(c));
+
+ nvme_ctrl_for_each_ns(c, n) {
+ struct json_object *jns = json_create_object();
+ int lba = nvme_ns_get_lba_size(n);
+ uint64_t nsze = nvme_ns_get_lba_count(n) * lba;
+ uint64_t nuse = nvme_ns_get_lba_util(n) * lba;
+
+ obj_add_str(jns, "NameSpace", nvme_ns_get_name(n));
+ obj_add_str(jns, "Generic", nvme_ns_get_generic_name(n));
+ obj_add_int(jns, "NSID", nvme_ns_get_nsid(n));
+ obj_add_uint64(jns, "UsedBytes", nuse);
+ obj_add_uint64(jns, "MaximumLBA", nvme_ns_get_lba_count(n));
+ obj_add_uint64(jns, "PhysicalSize", nsze);
+ obj_add_int(jns, "SectorSize", lba);
+
+ array_add_obj(jnss, jns);
+ }
+ obj_add_obj(jctrl, "Namespaces", jnss);
+
+ nvme_ctrl_for_each_path(c, p) {
+ struct json_object *jpath = json_create_object();
+
+ obj_add_str(jpath, "Path", nvme_path_get_name(p));
+ obj_add_str(jpath, "ANAState", nvme_path_get_ana_state(p));
+
+ array_add_obj(jpaths, jpath);
+ }
+ obj_add_obj(jctrl, "Paths", jpaths);
+
+ array_add_obj(jctrls, jctrl);
+ }
+ obj_add_obj(jss, "Controllers", jctrls);
+
+ nvme_subsystem_for_each_ns(s, n) {
+ struct json_object *jns = json_create_object();
+
+ int lba = nvme_ns_get_lba_size(n);
+ uint64_t nsze = nvme_ns_get_lba_count(n) * lba;
+ uint64_t nuse = nvme_ns_get_lba_util(n) * lba;
+
+ obj_add_str(jns, "NameSpace", nvme_ns_get_name(n));
+ obj_add_str(jns, "Generic", nvme_ns_get_generic_name(n));
+ obj_add_int(jns, "NSID", nvme_ns_get_nsid(n));
+ obj_add_uint64(jns, "UsedBytes", nuse);
+ obj_add_uint64(jns, "MaximumLBA", nvme_ns_get_lba_count(n));
+ obj_add_uint64(jns, "PhysicalSize", nsze);
+ obj_add_int(jns, "SectorSize", lba);
+
+ array_add_obj(jnss, jns);
+ }
+ obj_add_obj(jss, "Namespaces", jnss);
+
+ array_add_obj(jsslist, jss);
+ }
+
+ obj_add_obj(hss, "Subsystems", jsslist);
+ array_add_obj(jdev, hss);
+ }
+
+ obj_add_array(r, "Devices", jdev);
+
+ json_print(r);
+}
+
static struct json_object *json_list_item_obj(nvme_ns_t n)
{
struct json_object *r = json_create_object();
@@ -4622,9 +4728,12 @@ static void json_list_item(nvme_ns_t n)
static void json_print_list_items(nvme_root_t t)
{
- if (verbose_mode())
- json_detail_list(t);
- else
+ if (json_print_ops.flags & VERBOSE) {
+ if (nvme_cfg.output_format_ver == 2)
+ json_detail_list_v2(t);
+ else
+ json_detail_list(t);
+ } else
json_simple_list(t);
}

View file

@ -1,32 +0,0 @@
From 1141d617dfb3f50783fe80edd49728b8035a955f Mon Sep 17 00:00:00 2001
From: Daniel Wagner <wagi@kernel.org>
Date: Fri, 25 Jul 2025 13:30:19 +0200
Subject: [PATCH] udev: rename 71-nvme-hpe.rules to 71-nvmf-hpe.rules
The rules file naming is inconsistent with the other rules. Use the
nvmf- prefix.
Signed-off-by: Daniel Wagner <wagi@kernel.org>
---
meson.build | 2 +-
.../udev-rules/{71-nvme-hpe.rules.in => 71-nvmf-hpe.rules.in} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename nvmf-autoconnect/udev-rules/{71-nvme-hpe.rules.in => 71-nvmf-hpe.rules.in} (100%)
diff --git a/meson.build b/meson.build
index 1d57748605..3afd8ba3b1 100644
--- a/meson.build
+++ b/meson.build
@@ -267,7 +267,7 @@ udev_files = [
'65-persistent-net-nbft.rules',
'70-nvmf-autoconnect.rules',
'70-nvmf-keys.rules',
- '71-nvme-hpe.rules',
+ '71-nvmf-hpe.rules',
'71-nvmf-netapp.rules',
'71-nvmf-vastdata.rules',
]
diff --git a/nvmf-autoconnect/udev-rules/71-nvme-hpe.rules.in b/nvmf-autoconnect/udev-rules/71-nvmf-hpe.rules.in
similarity index 100%
rename from nvmf-autoconnect/udev-rules/71-nvme-hpe.rules.in
rename to nvmf-autoconnect/udev-rules/71-nvmf-hpe.rules.in

View file

@ -4,8 +4,8 @@
%global nmlibdir %{_prefix}/lib/NetworkManager
Name: nvme-cli
Version: 2.15
Release: 2%{?dist}
Version: 2.16
Release: 1%{?dist}
Summary: NVMe management command line interface
License: GPL-2.0-only
@ -14,11 +14,6 @@ Source0: %{url}/archive/v%{version_no_tilde}/%{name}-%{version_no_tilde}.
Source1: 99-nvme-nbft-connect.sh
Source2: 99-nvme-nbft-no-ignore-carrier.conf
# https://github.com/linux-nvme/nvme-cli/issues/2886
Patch0: nvme-cli-2.16-nvme_list_JSON_regression.patch
# https://github.com/linux-nvme/nvme-cli/pull/2880
Patch1: nvme-cli-2.16-rename_71-nvme-hpe.rules.patch
BuildRequires: meson >= 0.53
BuildRequires: gcc gcc-c++
BuildRequires: systemd-devel
@ -29,7 +24,7 @@ BuildRequires: openssl-devel
BuildRequires: kernel-headers
%endif
BuildRequires: libnvme-devel >= 1.15
BuildRequires: libnvme-devel >= 1.16.1
BuildRequires: json-c-devel >= 0.14
BuildRequires: asciidoc
@ -73,6 +68,30 @@ mv %{buildroot}%{_pkgdocdir}/nvme %{buildroot}%{_pkgdocdir}/html
rm -rf %{buildroot}%{_pkgdocdir}/nvme
%post
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd
%systemd_post nvmefc-boot-connections.service
%systemd_post nvmf-autoconnect.service
%systemd_post nvmf-connect@.service
%systemd_post nvmf-connect-nbft.service
if [ -S /run/udev/control ]; then
udevadm control --reload
udevadm trigger
fi
%preun
%systemd_preun nvmefc-boot-connections.service
%systemd_preun nvmf-autoconnect.service
%systemd_preun nvmf-connect@.service
%systemd_preun nvmf-connect-nbft.service
%postun
%systemd_postun nvmefc-boot-connections.service
%systemd_postun nvmf-autoconnect.service
%systemd_postun nvmf-connect@.service
%systemd_postun nvmf-connect-nbft.service
%files
%license LICENSE
%doc %{_pkgdocdir}
@ -100,6 +119,9 @@ rm -rf %{buildroot}%{_pkgdocdir}/nvme
%changelog
* Thu Dec 04 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.16-1
- Update to 2.16
* Fri Aug 15 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.15-2
- Fix nvme-list JSON output compatibility
- Rename 71-nvme-hpe.rules to 71-nvmf-hpe.rules
@ -107,6 +129,9 @@ rm -rf %{buildroot}%{_pkgdocdir}/nvme
* Fri Jul 25 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.15-1
- Update to 2.15
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Wed Jul 09 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.14-1
- Update to 2.14
- Disable Persistent Discovery Controllers by default
@ -117,6 +142,10 @@ rm -rf %{buildroot}%{_pkgdocdir}/nvme
* Mon Mar 17 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.12-1
- Update to 2.12
* Tue Feb 04 2025 Tomas Bzatek <tbzatek@redhat.com> - 2.11-3
- Add systemd units scriptlets
- Reload udevd after installing udev rules
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild

View file

@ -1 +1 @@
SHA512 (nvme-cli-2.15.tar.gz) = 6f4c9fe52883df5424ba28d8b66b00e61f4b6f7226d7385f026c1d3b8aeb473bdf637102d9cf7e049349c4f7e61eccbb33f7400cc09056f74be03a80b7d51c0d
SHA512 (nvme-cli-2.16.tar.gz) = 507018ff41832574bef5b88ea6a17336b9792c54f8e5c619d041bce23124e1d6d5e5e824407f46d4f1b4d6899125885eb14289f3399e61c7e7a59a603f1635e2