import OL nvme-cli-2.11-6.el9_6
This commit is contained in:
parent
5c4e4ec21e
commit
cca956e3a5
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/nvme-cli-2.6.tar.gz
|
||||
SOURCES/nvme-cli-2.11.tar.gz
|
||||
|
||||
@ -1 +1 @@
|
||||
01d2a5755d0d251eafeeefad27e739353f9e0f12 SOURCES/nvme-cli-2.6.tar.gz
|
||||
e3a599bd67057c5bb9a8e7e621d439b9fbcaf7b6 SOURCES/nvme-cli-2.11.tar.gz
|
||||
|
||||
239
SOURCES/0001-netapp-ontapdev-add-verbose-output.patch
Normal file
239
SOURCES/0001-netapp-ontapdev-add-verbose-output.patch
Normal file
@ -0,0 +1,239 @@
|
||||
From ab841e9a58688e64c5ce50e6159f34fc1a414c48 Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Mon, 11 Nov 2024 22:08:39 +0530
|
||||
Subject: [PATCH] netapp-ontapdev: add verbose output
|
||||
|
||||
Add a vebose output option to display additional information of
|
||||
ONTAP devices on the host.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
---
|
||||
plugins/netapp/netapp-nvme.c | 141 +++++++++++++++++++++++++++++++----
|
||||
1 file changed, 126 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/plugins/netapp/netapp-nvme.c b/plugins/netapp/netapp-nvme.c
|
||||
index 9f05ffc5..cebd019e 100644
|
||||
--- a/plugins/netapp/netapp-nvme.c
|
||||
+++ b/plugins/netapp/netapp-nvme.c
|
||||
@@ -119,6 +119,42 @@ static void netapp_get_ns_size(char *size, unsigned long long *lba,
|
||||
sprintf(size, "%.2f%sB", nsze, s_suffix);
|
||||
}
|
||||
|
||||
+static void netapp_get_ns_attrs(char *size, char *used, char *blk_size,
|
||||
+ char *version, unsigned long long *lba,
|
||||
+ struct nvme_id_ctrl *ctrl, struct nvme_id_ns *ns)
|
||||
+{
|
||||
+ __u8 lba_index;
|
||||
+
|
||||
+ nvme_id_ns_flbas_to_lbaf_inuse(ns->flbas, &lba_index);
|
||||
+ *lba = 1ULL << ns->lbaf[lba_index].ds;
|
||||
+
|
||||
+ /* get the namespace size */
|
||||
+ double nsze = le64_to_cpu(ns->nsze) * (*lba);
|
||||
+ const char *s_suffix = suffix_si_get(&nsze);
|
||||
+
|
||||
+ sprintf(size, "%.2f%sB", nsze, s_suffix);
|
||||
+
|
||||
+ /* get the namespace utilization */
|
||||
+ double nuse = le64_to_cpu(ns->nuse) * (*lba);
|
||||
+ const char *u_suffix = suffix_si_get(&nuse);
|
||||
+
|
||||
+ sprintf(used, "%.2f%sB", nuse, u_suffix);
|
||||
+
|
||||
+ /* get the namespace block size */
|
||||
+ long long addr = 1LL << ns->lbaf[lba_index].ds;
|
||||
+ const char *l_suffix = suffix_binary_get(&addr);
|
||||
+
|
||||
+ sprintf(blk_size, "%u%sB", (unsigned int)addr, l_suffix);
|
||||
+
|
||||
+ /* get the ontap version */
|
||||
+ int i, max = sizeof(ctrl->fr);
|
||||
+
|
||||
+ memcpy(version, ctrl->fr, sizeof(ctrl->fr));
|
||||
+ /* strip trailing whitespaces */
|
||||
+ for (i = max - 1; i >= 0 && version[i] == ' '; i--)
|
||||
+ version[i] = '\0';
|
||||
+}
|
||||
+
|
||||
static void ontap_labels_to_str(char *dst, char *src, int count)
|
||||
{
|
||||
int i;
|
||||
@@ -235,7 +271,8 @@ static void netapp_smdevice_json(struct json_object *devices, char *devname,
|
||||
|
||||
static void netapp_ontapdevice_json(struct json_object *devices, char *devname,
|
||||
char *vsname, char *nspath, int nsid, char *uuid,
|
||||
- char *size, long long lba, long long nsze)
|
||||
+ unsigned long long lba, char *version,
|
||||
+ unsigned long long nsze, unsigned long long nuse)
|
||||
{
|
||||
struct json_object *device_attrs;
|
||||
|
||||
@@ -245,9 +282,10 @@ static void netapp_ontapdevice_json(struct json_object *devices, char *devname,
|
||||
json_object_add_value_string(device_attrs, "Namespace_Path", nspath);
|
||||
json_object_add_value_int(device_attrs, "NSID", nsid);
|
||||
json_object_add_value_string(device_attrs, "UUID", uuid);
|
||||
- json_object_add_value_string(device_attrs, "Size", size);
|
||||
- json_object_add_value_int(device_attrs, "LBA_Data_Size", lba);
|
||||
- json_object_add_value_int(device_attrs, "Namespace_Size", nsze);
|
||||
+ json_object_add_value_uint64(device_attrs, "LBA_Data_Size", lba);
|
||||
+ json_object_add_value_uint64(device_attrs, "Namespace_Size", nsze);
|
||||
+ json_object_add_value_uint64(device_attrs, "UsedBytes", nuse);
|
||||
+ json_object_add_value_string(device_attrs, "Version", version);
|
||||
|
||||
json_array_add_value_object(devices, device_attrs);
|
||||
}
|
||||
@@ -410,6 +448,66 @@ out:
|
||||
json_free_object(root);
|
||||
}
|
||||
|
||||
+static void netapp_ontapdevices_print_verbose(struct ontapdevice_info *devices,
|
||||
+ int count, int format, const char *devname)
|
||||
+{
|
||||
+ char vsname[ONTAP_LABEL_LEN] = " ";
|
||||
+ char nspath[ONTAP_NS_PATHLEN] = " ";
|
||||
+ unsigned long long lba;
|
||||
+ char size[128], used[128];
|
||||
+ char blk_size[128], version[8];
|
||||
+ char uuid_str[37] = " ";
|
||||
+ int i;
|
||||
+
|
||||
+ char *formatstr = NULL;
|
||||
+ char basestr[] =
|
||||
+ "%s, Vserver %s, Path %s, NSID %d, UUID %s, %s, %s, %s, %s\n";
|
||||
+ char columnstr[] = "%-16s %-25s %-50s %-4d %-38s %-9s %-9s %-9s %-9s\n";
|
||||
+
|
||||
+ if (format == NNORMAL)
|
||||
+ formatstr = basestr;
|
||||
+ else if (format == NCOLUMN) {
|
||||
+ printf("%-16s %-25s %-50s %-4s %-38s %-9s %-9s %-9s %-9s\n",
|
||||
+ "Device", "Vserver", "Namespace Path",
|
||||
+ "NSID", "UUID", "Size", "Used",
|
||||
+ "Format", "Version");
|
||||
+ printf("%-16s %-25s %-50s %-4s %-38s %-9s %-9s %-9s %-9s\n",
|
||||
+ "----------------", "-------------------------",
|
||||
+ "--------------------------------------------------",
|
||||
+ "----", "--------------------------------------",
|
||||
+ "---------", "---------", "---------", "---------");
|
||||
+ formatstr = columnstr;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < count; i++) {
|
||||
+ if (devname && !strcmp(devname, basename(devices[i].dev))) {
|
||||
+ /* found the device, fetch and print for that alone */
|
||||
+ netapp_get_ns_attrs(size, used, blk_size, version,
|
||||
+ &lba, &devices[i].ctrl, &devices[i].ns);
|
||||
+ nvme_uuid_to_string(devices[i].uuid, uuid_str);
|
||||
+ netapp_get_ontap_labels(vsname, nspath,
|
||||
+ devices[i].log_data);
|
||||
+
|
||||
+ printf(formatstr, devices[i].dev, vsname, nspath,
|
||||
+ devices[i].nsid, uuid_str, size, used,
|
||||
+ blk_size, version);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < count; i++) {
|
||||
+ /* fetch info and print for all devices */
|
||||
+ netapp_get_ns_attrs(size, used, blk_size, version,
|
||||
+ &lba, &devices[i].ctrl, &devices[i].ns);
|
||||
+ nvme_uuid_to_string(devices[i].uuid, uuid_str);
|
||||
+ netapp_get_ontap_labels(vsname, nspath, devices[i].log_data);
|
||||
+
|
||||
+ printf(formatstr, devices[i].dev, vsname, nspath,
|
||||
+ devices[i].nsid, uuid_str, size, used,
|
||||
+ blk_size, version);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void netapp_ontapdevices_print_regular(struct ontapdevice_info *devices,
|
||||
int count, int format, const char *devname)
|
||||
{
|
||||
@@ -472,7 +570,8 @@ static void netapp_ontapdevices_print_json(struct ontapdevice_info *devices,
|
||||
char vsname[ONTAP_LABEL_LEN] = " ";
|
||||
char nspath[ONTAP_NS_PATHLEN] = " ";
|
||||
unsigned long long lba;
|
||||
- char size[128];
|
||||
+ char size[128], used[128];
|
||||
+ char blk_size[128], version[8];
|
||||
char uuid_str[37] = " ";
|
||||
int i;
|
||||
|
||||
@@ -483,28 +582,33 @@ static void netapp_ontapdevices_print_json(struct ontapdevice_info *devices,
|
||||
for (i = 0; i < count; i++) {
|
||||
if (devname && !strcmp(devname, basename(devices[i].dev))) {
|
||||
/* found the device, fetch info for that alone */
|
||||
- netapp_get_ns_size(size, &lba, &devices[i].ns);
|
||||
+ netapp_get_ns_attrs(size, used, blk_size, version,
|
||||
+ &lba, &devices[i].ctrl, &devices[i].ns);
|
||||
nvme_uuid_to_string(devices[i].uuid, uuid_str);
|
||||
- netapp_get_ontap_labels(vsname, nspath, devices[i].log_data);
|
||||
+ netapp_get_ontap_labels(vsname, nspath,
|
||||
+ devices[i].log_data);
|
||||
|
||||
netapp_ontapdevice_json(json_devices, devices[i].dev,
|
||||
vsname, nspath, devices[i].nsid,
|
||||
- uuid_str, size, lba,
|
||||
- le64_to_cpu(devices[i].ns.nsze));
|
||||
+ uuid_str, lba, version,
|
||||
+ le64_to_cpu(devices[i].ns.nsze),
|
||||
+ le64_to_cpu(devices[i].ns.nuse));
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
/* fetch info for all devices */
|
||||
- netapp_get_ns_size(size, &lba, &devices[i].ns);
|
||||
+ netapp_get_ns_attrs(size, used, blk_size, version,
|
||||
+ &lba, &devices[i].ctrl, &devices[i].ns);
|
||||
nvme_uuid_to_string(devices[i].uuid, uuid_str);
|
||||
netapp_get_ontap_labels(vsname, nspath, devices[i].log_data);
|
||||
|
||||
netapp_ontapdevice_json(json_devices, devices[i].dev,
|
||||
vsname, nspath, devices[i].nsid,
|
||||
- uuid_str, size, lba,
|
||||
- le64_to_cpu(devices[i].ns.nsze));
|
||||
+ uuid_str, lba, version,
|
||||
+ le64_to_cpu(devices[i].ns.nsze),
|
||||
+ le64_to_cpu(devices[i].ns.nuse));
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -776,6 +880,7 @@ static int netapp_ontapdevices(int argc, char **argv, struct command *command,
|
||||
int num_ontapdevices = 0;
|
||||
|
||||
struct config {
|
||||
+ bool verbose;
|
||||
char *output_format;
|
||||
};
|
||||
|
||||
@@ -784,6 +889,7 @@ static int netapp_ontapdevices(int argc, char **argv, struct command *command,
|
||||
};
|
||||
|
||||
OPT_ARGS(opts) = {
|
||||
+ OPT_FLAG("verbose", 'v', &cfg.verbose, "Increase output verbosity"),
|
||||
OPT_FMT("output-format", 'o', &cfg.output_format, "Output Format: normal|json|column"),
|
||||
OPT_END()
|
||||
};
|
||||
@@ -839,9 +945,14 @@ static int netapp_ontapdevices(int argc, char **argv, struct command *command,
|
||||
}
|
||||
|
||||
if (num_ontapdevices) {
|
||||
- if (fmt == NNORMAL || fmt == NCOLUMN)
|
||||
- netapp_ontapdevices_print_regular(ontapdevices,
|
||||
- num_ontapdevices, fmt, devname);
|
||||
+ if (fmt == NNORMAL || fmt == NCOLUMN) {
|
||||
+ if (argconfig_parse_seen(opts, "verbose"))
|
||||
+ netapp_ontapdevices_print_verbose(ontapdevices,
|
||||
+ num_ontapdevices, fmt, devname);
|
||||
+ else
|
||||
+ netapp_ontapdevices_print_regular(ontapdevices,
|
||||
+ num_ontapdevices, fmt, devname);
|
||||
+ }
|
||||
else if (fmt == NJSON)
|
||||
netapp_ontapdevices_print_json(ontapdevices,
|
||||
num_ontapdevices, devname);
|
||||
--
|
||||
2.43.5
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From 0782167f3a6709df232b746cdfa2a036c6207f7f Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Tue, 3 Oct 2023 16:05:23 +0530
|
||||
Subject: [PATCH] udev-rules: set ctrl_loss_tmo to -1 for ONTAP NVMe/TCP
|
||||
|
||||
Setting ctrl_loss_tmo to -1 for ONTAP NVMe/TCP controllers would enable
|
||||
indefinite reconnect attempts during a path loss and help avoid purging
|
||||
the path on the host, which otherwise may lead to mounted fs read-only
|
||||
behavior. So add a rule towards enabling the same.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
---
|
||||
nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in b/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in
|
||||
index 299fe2251418..99b6a8ba0bf8 100644
|
||||
--- a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in
|
||||
+++ b/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in
|
||||
@@ -1,3 +1,6 @@
|
||||
# Enable round-robin for NetApp ONTAP and NetApp E-Series
|
||||
ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp ONTAP Controller", ATTR{iopolicy}="round-robin"
|
||||
ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp E-Series", ATTR{iopolicy}="round-robin"
|
||||
+
|
||||
+# Set ctrl_loss_tmo to -1 for NetApp ONTAP NVMe/TCP
|
||||
+ACTION!="remove", SUBSYSTEM=="nvme", KERNEL=="nvme*", ATTR{transport}=="tcp", ATTR{model}=="NetApp ONTAP Controller", ATTR{ctrl_loss_tmo}="-1"
|
||||
--
|
||||
2.39.3
|
||||
|
||||
39
SOURCES/0002-netapp-ontapdev-doc-add-verbose-details.patch
Normal file
39
SOURCES/0002-netapp-ontapdev-doc-add-verbose-details.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From a8d1efcaba26dd992d89da2e60999642d7ae8eca Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Wed, 13 Nov 2024 00:14:07 +0530
|
||||
Subject: [PATCH] netapp-ontapdev-doc: add verbose details
|
||||
|
||||
Add verbose option details to the ontapdevices documentation.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
---
|
||||
Documentation/nvme-netapp-ontapdevices.txt | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/nvme-netapp-ontapdevices.txt b/Documentation/nvme-netapp-ontapdevices.txt
|
||||
index fc28947d..e56bae57 100644
|
||||
--- a/Documentation/nvme-netapp-ontapdevices.txt
|
||||
+++ b/Documentation/nvme-netapp-ontapdevices.txt
|
||||
@@ -8,7 +8,7 @@ nvme-netapp-ontapdevices - Display information about ONTAP devices
|
||||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
-'nvme netapp ontapdevices' [--output-format=<fmt> | -o <fmt>]
|
||||
+'nvme netapp ontapdevices' [--output-format=<fmt> | -o <fmt>] [--verbose | -v]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -22,6 +22,10 @@ OPTIONS
|
||||
Set the reporting format to 'normal' (default), 'column', or
|
||||
'json'. Only one output format can be used at a time.
|
||||
|
||||
+-v::
|
||||
+--verbose::
|
||||
+ Display additional information of ONTAP devices on the host.
|
||||
+
|
||||
EXAMPLES
|
||||
--------
|
||||
* Display information, in a column-based format, for ONTAP devices.
|
||||
--
|
||||
2.43.5
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
From 748a9ac050fb443b1204d06ce3b5b129b6a8afe2 Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Thu, 5 Oct 2023 12:12:46 +0530
|
||||
Subject: [PATCH] udev-rules: rename netapp udev rule
|
||||
|
||||
Rename 71-nvmf-iopolicy-netapp.rules.in to 71-nvmf-netapp.rules.in
|
||||
so as to make the name generic, since this not only sets the
|
||||
iopolicy here but also modifies the ctrl_loss_tmo.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
---
|
||||
meson.build | 2 +-
|
||||
nvme.spec.in | 2 +-
|
||||
...71-nvmf-iopolicy-netapp.rules.in => 71-nvmf-netapp.rules.in} | 0
|
||||
3 files changed, 2 insertions(+), 2 deletions(-)
|
||||
rename nvmf-autoconnect/udev-rules/{71-nvmf-iopolicy-netapp.rules.in => 71-nvmf-netapp.rules.in} (100%)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 3d3fb08541ff..310ba1f83400 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -236,7 +236,7 @@ endforeach
|
||||
|
||||
udev_files = [
|
||||
'70-nvmf-autoconnect.rules',
|
||||
- '71-nvmf-iopolicy-netapp.rules',
|
||||
+ '71-nvmf-netapp.rules',
|
||||
]
|
||||
|
||||
foreach file : udev_files
|
||||
diff --git a/nvme.spec.in b/nvme.spec.in
|
||||
index fe4675a7bb0b..3eab9ff030ff 100644
|
||||
--- a/nvme.spec.in
|
||||
+++ b/nvme.spec.in
|
||||
@@ -31,7 +31,7 @@ touch %{buildroot}@SYSCONFDIR@/nvme/hostid
|
||||
@SYSCONFDIR@/nvme/discovery.conf
|
||||
%ghost @SYSCONFDIR@/nvme/config.json
|
||||
@UDEVRULESDIR@/70-nvmf-autoconnect.rules
|
||||
-@UDEVRULESDIR@/71-nvmf-iopolicy-netapp.rules
|
||||
+@UDEVRULESDIR@/71-nvmf-netapp.rules
|
||||
@DRACUTRILESDIR@/70-nvmf-autoconnect.conf
|
||||
@SYSTEMDDIR@/nvmf-connect@.service
|
||||
@SYSTEMDDIR@/nvmefc-boot-connections.service
|
||||
diff --git a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in b/nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in
|
||||
similarity index 100%
|
||||
rename from nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in
|
||||
rename to nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in
|
||||
--
|
||||
2.39.3
|
||||
|
||||
@ -1,92 +0,0 @@
|
||||
From 5f872e9c1689078bf2c4e33108c1514da1a91497 Mon Sep 17 00:00:00 2001
|
||||
From: Maurizio Lombardi <mlombard@redhat.com>
|
||||
Date: Mon, 13 Nov 2023 10:49:35 +0100
|
||||
Subject: [PATCH] Revert "fabrics: Use corresponding hostid when hostnqn is
|
||||
generated"
|
||||
|
||||
This reverts commit 7d1c18f581e489e0cedfd9991bc97a2f8239cf82.
|
||||
---
|
||||
fabrics.c | 47 ++---------------------------------------------
|
||||
1 file changed, 2 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index 57ca927fce9a..f4fb63f0c555 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -616,43 +616,6 @@ static int nvme_read_volatile_config(nvme_root_t r)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-char *nvmf_hostid_from_hostnqn(const char *hostnqn)
|
||||
-{
|
||||
- const char *uuid;
|
||||
-
|
||||
- if (!hostnqn)
|
||||
- return NULL;
|
||||
-
|
||||
- uuid = strstr(hostnqn, "uuid:");
|
||||
- if (!uuid)
|
||||
- return NULL;
|
||||
-
|
||||
- return strdup(uuid + strlen("uuid:"));
|
||||
-}
|
||||
-
|
||||
-void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn)
|
||||
-{
|
||||
- char *hostid_from_file, *hostid_from_hostnqn;
|
||||
-
|
||||
- if (!hostid)
|
||||
- return;
|
||||
-
|
||||
- hostid_from_file = nvmf_hostid_from_file();
|
||||
- if (hostid_from_file && strcmp(hostid_from_file, hostid)) {
|
||||
- fprintf(stderr, "warning: use generated hostid instead of hostid file\n");
|
||||
- free(hostid_from_file);
|
||||
- }
|
||||
-
|
||||
- if (!hostnqn)
|
||||
- return;
|
||||
-
|
||||
- hostid_from_hostnqn = nvmf_hostid_from_hostnqn(hostnqn);
|
||||
- if (hostid_from_hostnqn && strcmp(hostid_from_hostnqn, hostid)) {
|
||||
- fprintf(stderr, "warning: use hostid which does not match uuid in hostnqn\n");
|
||||
- free(hostid_from_hostnqn);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
{
|
||||
char *subsysnqn = NVME_DISC_SUBSYS_NAME;
|
||||
@@ -729,13 +692,10 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
hostid_arg = hostid;
|
||||
if (!hostnqn)
|
||||
hostnqn = hnqn = nvmf_hostnqn_from_file();
|
||||
- if (!hostnqn) {
|
||||
+ if (!hostnqn)
|
||||
hostnqn = hnqn = nvmf_hostnqn_generate();
|
||||
- hostid = hid = nvmf_hostid_from_hostnqn(hostnqn);
|
||||
- }
|
||||
if (!hostid)
|
||||
hostid = hid = nvmf_hostid_from_file();
|
||||
- nvmf_check_hostid_and_hostnqn(hostid, hostnqn);
|
||||
h = nvme_lookup_host(r, hostnqn, hostid);
|
||||
if (!h) {
|
||||
ret = ENOMEM;
|
||||
@@ -946,13 +906,10 @@ int nvmf_connect(const char *desc, int argc, char **argv)
|
||||
|
||||
if (!hostnqn)
|
||||
hostnqn = hnqn = nvmf_hostnqn_from_file();
|
||||
- if (!hostnqn) {
|
||||
+ if (!hostnqn)
|
||||
hostnqn = hnqn = nvmf_hostnqn_generate();
|
||||
- hostid = hid = nvmf_hostid_from_hostnqn(hostnqn);
|
||||
- }
|
||||
if (!hostid)
|
||||
hostid = hid = nvmf_hostid_from_file();
|
||||
- nvmf_check_hostid_and_hostnqn(hostid, hostnqn);
|
||||
h = nvme_lookup_host(r, hostnqn, hostid);
|
||||
if (!h) {
|
||||
errno = ENOMEM;
|
||||
--
|
||||
2.39.3
|
||||
|
||||
52
SOURCES/0003-netapp-ontapdev-fix-fw-version-handling.patch
Normal file
52
SOURCES/0003-netapp-ontapdev-fix-fw-version-handling.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From 24961e9d228531f1cb60739239d7591aa70bdd53 Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Fri, 29 Nov 2024 11:04:34 +0530
|
||||
Subject: [PATCH] netapp-ontapdev: fix fw version handling
|
||||
|
||||
The string used to capture the fw version was not handled
|
||||
properly. Fix the same.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
---
|
||||
plugins/netapp/netapp-nvme.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/plugins/netapp/netapp-nvme.c b/plugins/netapp/netapp-nvme.c
|
||||
index cebd019e..76e8ddf1 100644
|
||||
--- a/plugins/netapp/netapp-nvme.c
|
||||
+++ b/plugins/netapp/netapp-nvme.c
|
||||
@@ -146,10 +146,11 @@ static void netapp_get_ns_attrs(char *size, char *used, char *blk_size,
|
||||
|
||||
sprintf(blk_size, "%u%sB", (unsigned int)addr, l_suffix);
|
||||
|
||||
- /* get the ontap version */
|
||||
+ /* get the firmware version */
|
||||
int i, max = sizeof(ctrl->fr);
|
||||
|
||||
- memcpy(version, ctrl->fr, sizeof(ctrl->fr));
|
||||
+ memcpy(version, ctrl->fr, max);
|
||||
+ version[max] = '\0';
|
||||
/* strip trailing whitespaces */
|
||||
for (i = max - 1; i >= 0 && version[i] == ' '; i--)
|
||||
version[i] = '\0';
|
||||
@@ -455,7 +456,7 @@ static void netapp_ontapdevices_print_verbose(struct ontapdevice_info *devices,
|
||||
char nspath[ONTAP_NS_PATHLEN] = " ";
|
||||
unsigned long long lba;
|
||||
char size[128], used[128];
|
||||
- char blk_size[128], version[8];
|
||||
+ char blk_size[128], version[9];
|
||||
char uuid_str[37] = " ";
|
||||
int i;
|
||||
|
||||
@@ -571,7 +572,7 @@ static void netapp_ontapdevices_print_json(struct ontapdevice_info *devices,
|
||||
char nspath[ONTAP_NS_PATHLEN] = " ";
|
||||
unsigned long long lba;
|
||||
char size[128], used[128];
|
||||
- char blk_size[128], version[8];
|
||||
+ char blk_size[128], version[9];
|
||||
char uuid_str[37] = " ";
|
||||
int i;
|
||||
|
||||
--
|
||||
2.43.5
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
From b5208a987bf85ae3f4e264e6df55a7fb9acd9907 Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Fri, 29 Nov 2024 11:10:16 +0530
|
||||
Subject: [PATCH] netapp-ontapdev: fix JSON output for nsze & nuse
|
||||
|
||||
The namespace size & utilization values printed in the JSON
|
||||
output was incorrect. Fix the same.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
---
|
||||
plugins/netapp/netapp-nvme.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/plugins/netapp/netapp-nvme.c b/plugins/netapp/netapp-nvme.c
|
||||
index 76e8ddf1..6ff428d9 100644
|
||||
--- a/plugins/netapp/netapp-nvme.c
|
||||
+++ b/plugins/netapp/netapp-nvme.c
|
||||
@@ -276,6 +276,8 @@ static void netapp_ontapdevice_json(struct json_object *devices, char *devname,
|
||||
unsigned long long nsze, unsigned long long nuse)
|
||||
{
|
||||
struct json_object *device_attrs;
|
||||
+ unsigned long long ns_size = nsze * lba;
|
||||
+ unsigned long long used_size = nuse * lba;
|
||||
|
||||
device_attrs = json_create_object();
|
||||
json_object_add_value_string(device_attrs, "Device", devname);
|
||||
@@ -283,9 +285,9 @@ static void netapp_ontapdevice_json(struct json_object *devices, char *devname,
|
||||
json_object_add_value_string(device_attrs, "Namespace_Path", nspath);
|
||||
json_object_add_value_int(device_attrs, "NSID", nsid);
|
||||
json_object_add_value_string(device_attrs, "UUID", uuid);
|
||||
- json_object_add_value_uint64(device_attrs, "LBA_Data_Size", lba);
|
||||
- json_object_add_value_uint64(device_attrs, "Namespace_Size", nsze);
|
||||
- json_object_add_value_uint64(device_attrs, "UsedBytes", nuse);
|
||||
+ json_object_add_value_uint64(device_attrs, "LBA_Size", lba);
|
||||
+ json_object_add_value_uint64(device_attrs, "Namespace_Size", ns_size);
|
||||
+ json_object_add_value_uint64(device_attrs, "UsedBytes", used_size);
|
||||
json_object_add_value_string(device_attrs, "Version", version);
|
||||
|
||||
json_array_add_value_object(devices, device_attrs);
|
||||
--
|
||||
2.43.5
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From 2f30d87d5c258fd97f78b0705bb92519d8a2498d Mon Sep 17 00:00:00 2001
|
||||
From: "da Cunha, Leonardo" <leonardo.da.cunha@solidigm.com>
|
||||
Date: Wed, 11 Oct 2023 09:01:44 -0700
|
||||
Subject: [PATCH] nvme: Fixed segmentation fault when getting host initiated
|
||||
telemetry
|
||||
|
||||
Signed-off-by: leonardo.da.cunha <leonardo.da.cunha@solidigm.com>
|
||||
---
|
||||
nvme.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/nvme.c b/nvme.c
|
||||
index b9e56a48f0a5..73d74afdfd73 100644
|
||||
--- a/nvme.c
|
||||
+++ b/nvme.c
|
||||
@@ -851,6 +851,10 @@ static int __get_telemetry_log_host(struct nvme_dev *dev,
|
||||
_cleanup_free_ struct nvme_telemetry_log *log = NULL;
|
||||
int err;
|
||||
|
||||
+ log = nvme_alloc(sizeof(*log));
|
||||
+ if (!log)
|
||||
+ return -errno;
|
||||
+
|
||||
err = nvme_cli_get_log_telemetry_host(dev, 0,
|
||||
NVME_LOG_TELEM_BLOCK_SIZE,
|
||||
log);
|
||||
--
|
||||
2.39.3
|
||||
|
||||
53
SOURCES/0005-nvme-netapp-update-err-messages.patch
Normal file
53
SOURCES/0005-nvme-netapp-update-err-messages.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From 6f1f902af071fc46b78485ce851ffaaeb444c25f Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Fri, 29 Nov 2024 11:15:23 +0530
|
||||
Subject: [PATCH] nvme-netapp: update err messages
|
||||
|
||||
Trivial fix to update a few error messages.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
---
|
||||
plugins/netapp/netapp-nvme.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/plugins/netapp/netapp-nvme.c b/plugins/netapp/netapp-nvme.c
|
||||
index 6ff428d9..aee65215 100644
|
||||
--- a/plugins/netapp/netapp-nvme.c
|
||||
+++ b/plugins/netapp/netapp-nvme.c
|
||||
@@ -816,7 +816,7 @@ static int netapp_smdevices(int argc, char **argv, struct command *command,
|
||||
|
||||
num = scandir(dev_path, &devices, netapp_nvme_filter, alphasort);
|
||||
if (num <= 0) {
|
||||
- fprintf(stderr, "No NVMe devices detected.\n");
|
||||
+ fprintf(stderr, "No NVMe devices detected\n");
|
||||
return num;
|
||||
}
|
||||
|
||||
@@ -834,7 +834,7 @@ static int netapp_smdevices(int argc, char **argv, struct command *command,
|
||||
|
||||
smdevices = calloc(num, sizeof(*smdevices));
|
||||
if (!smdevices) {
|
||||
- fprintf(stderr, "Unable to allocate memory for devices.\n");
|
||||
+ fprintf(stderr, "Unable to allocate memory for devices\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -921,13 +921,13 @@ static int netapp_ontapdevices(int argc, char **argv, struct command *command,
|
||||
|
||||
num = scandir(dev_path, &devices, netapp_nvme_filter, alphasort);
|
||||
if (num <= 0) {
|
||||
- fprintf(stderr, "No NVMe devices detected.\n");
|
||||
+ fprintf(stderr, "No NVMe devices detected\n");
|
||||
return num;
|
||||
}
|
||||
|
||||
ontapdevices = calloc(num, sizeof(*ontapdevices));
|
||||
if (!ontapdevices) {
|
||||
- fprintf(stderr, "Unable to allocate memory for devices.\n");
|
||||
+ fprintf(stderr, "Unable to allocate memory for devices\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
--
|
||||
2.43.5
|
||||
|
||||
106
SOURCES/0006-netapp-smdev-remove-redundant-code.patch
Normal file
106
SOURCES/0006-netapp-smdev-remove-redundant-code.patch
Normal file
@ -0,0 +1,106 @@
|
||||
From b8c9a3c1ee55c2477ce1ce0348014aa891dee58d Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Tue, 3 Dec 2024 13:16:17 +0530
|
||||
Subject: [PATCH] netapp-smdev: remove redundant code
|
||||
|
||||
Remove redundant code in regular and JSON functions, which is
|
||||
already invoked in a separate function.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
---
|
||||
plugins/netapp/netapp-nvme.c | 44 +++++++-----------------------------
|
||||
1 file changed, 8 insertions(+), 36 deletions(-)
|
||||
|
||||
diff --git a/plugins/netapp/netapp-nvme.c b/plugins/netapp/netapp-nvme.c
|
||||
index aee65215..f839852d 100644
|
||||
--- a/plugins/netapp/netapp-nvme.c
|
||||
+++ b/plugins/netapp/netapp-nvme.c
|
||||
@@ -300,7 +300,8 @@ static void netapp_smdevices_print_regular(struct smdevice_info *devices,
|
||||
char array_label[ARRAY_LABEL_LEN / 2 + 1];
|
||||
char volume_label[VOLUME_LABEL_LEN / 2 + 1];
|
||||
char nguid_str[33];
|
||||
- __u8 lba_index;
|
||||
+ unsigned long long lba;
|
||||
+ char size[128];
|
||||
|
||||
char *formatstr = NULL;
|
||||
char basestr[] =
|
||||
@@ -325,15 +326,7 @@ static void netapp_smdevices_print_regular(struct smdevice_info *devices,
|
||||
for (i = 0; i < count; i++) {
|
||||
if (devname && !strcmp(devname, basename(devices[i].dev))) {
|
||||
/* found the device, fetch info for that alone */
|
||||
- nvme_id_ns_flbas_to_lbaf_inuse(devices[i].ns.flbas,
|
||||
- &lba_index);
|
||||
- unsigned long long lba = 1ULL <<
|
||||
- devices[i].ns.lbaf[lba_index].ds;
|
||||
- double nsze = le64_to_cpu(devices[i].ns.nsze) * lba;
|
||||
- const char *s_suffix = suffix_si_get(&nsze);
|
||||
- char size[128];
|
||||
-
|
||||
- sprintf(size, "%.2f%sB", nsze, s_suffix);
|
||||
+ netapp_get_ns_size(size, &lba, &devices[i].ns);
|
||||
netapp_convert_string(array_label,
|
||||
(char *)&devices[i].ctrl.vs[20],
|
||||
ARRAY_LABEL_LEN / 2);
|
||||
@@ -353,14 +346,7 @@ static void netapp_smdevices_print_regular(struct smdevice_info *devices,
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
/* fetch info for all devices */
|
||||
- nvme_id_ns_flbas_to_lbaf_inuse(devices[i].ns.flbas, &lba_index);
|
||||
- unsigned long long lba = 1ULL <<
|
||||
- devices[i].ns.lbaf[lba_index].ds;
|
||||
- double nsze = le64_to_cpu(devices[i].ns.nsze) * lba;
|
||||
- const char *s_suffix = suffix_si_get(&nsze);
|
||||
- char size[128];
|
||||
-
|
||||
- sprintf(size, "%.2f%sB", nsze, s_suffix);
|
||||
+ netapp_get_ns_size(size, &lba, &devices[i].ns);
|
||||
netapp_convert_string(array_label,
|
||||
(char *)&devices[i].ctrl.vs[20],
|
||||
ARRAY_LABEL_LEN / 2);
|
||||
@@ -384,7 +370,8 @@ static void netapp_smdevices_print_json(struct smdevice_info *devices,
|
||||
char array_label[ARRAY_LABEL_LEN / 2 + 1];
|
||||
char volume_label[VOLUME_LABEL_LEN / 2 + 1];
|
||||
char nguid_str[33];
|
||||
- __u8 lba_index;
|
||||
+ unsigned long long lba;
|
||||
+ char size[128];
|
||||
|
||||
/* prepare for the json output */
|
||||
root = json_create_object();
|
||||
@@ -393,15 +380,7 @@ static void netapp_smdevices_print_json(struct smdevice_info *devices,
|
||||
for (i = 0; i < count; i++) {
|
||||
if (devname && !strcmp(devname, basename(devices[i].dev))) {
|
||||
/* found the device, fetch info for that alone */
|
||||
- nvme_id_ns_flbas_to_lbaf_inuse(devices[i].ns.flbas,
|
||||
- &lba_index);
|
||||
- unsigned long long lba = 1ULL <<
|
||||
- devices[i].ns.lbaf[lba_index].ds;
|
||||
- double nsze = le64_to_cpu(devices[i].ns.nsze) * lba;
|
||||
- const char *s_suffix = suffix_si_get(&nsze);
|
||||
- char size[128];
|
||||
-
|
||||
- sprintf(size, "%.2f%sB", nsze, s_suffix);
|
||||
+ netapp_get_ns_size(size, &lba, &devices[i].ns);
|
||||
netapp_convert_string(array_label,
|
||||
(char *)&devices[i].ctrl.vs[20],
|
||||
ARRAY_LABEL_LEN / 2);
|
||||
@@ -421,14 +400,7 @@ static void netapp_smdevices_print_json(struct smdevice_info *devices,
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
/* fetch info for all devices */
|
||||
- nvme_id_ns_flbas_to_lbaf_inuse(devices[i].ns.flbas, &lba_index);
|
||||
- unsigned long long lba = 1ULL <<
|
||||
- devices[i].ns.lbaf[lba_index].ds;
|
||||
- double nsze = le64_to_cpu(devices[i].ns.nsze) * lba;
|
||||
- const char *s_suffix = suffix_si_get(&nsze);
|
||||
- char size[128];
|
||||
-
|
||||
- sprintf(size, "%.2f%sB", nsze, s_suffix);
|
||||
+ netapp_get_ns_size(size, &lba, &devices[i].ns);
|
||||
netapp_convert_string(array_label,
|
||||
(char *)&devices[i].ctrl.vs[20],
|
||||
ARRAY_LABEL_LEN / 2);
|
||||
--
|
||||
2.43.5
|
||||
|
||||
230
SOURCES/0007-netapp-smdev-add-verbose-output.patch
Normal file
230
SOURCES/0007-netapp-smdev-add-verbose-output.patch
Normal file
@ -0,0 +1,230 @@
|
||||
From 0943fc446609996dc6acf2fae7f31a6c20c28e06 Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Wed, 4 Dec 2024 00:24:48 +0530
|
||||
Subject: [PATCH] netapp-smdev: add verbose output
|
||||
|
||||
Add a verbose option to display additional information of smdevices
|
||||
on the host. And while at it, make a few corrections/modifications
|
||||
to the JSON output as well.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
Tested-by: Clayton Skaggs <claytons@netapp.com>
|
||||
---
|
||||
plugins/netapp/netapp-nvme.c | 123 ++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 108 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/plugins/netapp/netapp-nvme.c b/plugins/netapp/netapp-nvme.c
|
||||
index f839852d..d86e93e1 100644
|
||||
--- a/plugins/netapp/netapp-nvme.c
|
||||
+++ b/plugins/netapp/netapp-nvme.c
|
||||
@@ -250,10 +250,11 @@ static void netapp_get_ontap_labels(char *vsname, char *nspath,
|
||||
|
||||
static void netapp_smdevice_json(struct json_object *devices, char *devname,
|
||||
char *arrayname, char *volname, int nsid, char *nguid,
|
||||
- char *ctrl, char *astate, char *size, long long lba,
|
||||
- long long nsze)
|
||||
+ char *ctrl, char *astate, char *version, unsigned long long lba,
|
||||
+ unsigned long long nsze, unsigned long long nuse)
|
||||
{
|
||||
struct json_object *device_attrs;
|
||||
+ unsigned long long ns_size = nsze * lba;
|
||||
|
||||
device_attrs = json_create_object();
|
||||
json_object_add_value_string(device_attrs, "Device", devname);
|
||||
@@ -263,9 +264,9 @@ static void netapp_smdevice_json(struct json_object *devices, char *devname,
|
||||
json_object_add_value_string(device_attrs, "Volume_ID", nguid);
|
||||
json_object_add_value_string(device_attrs, "Controller", ctrl);
|
||||
json_object_add_value_string(device_attrs, "Access_State", astate);
|
||||
- json_object_add_value_string(device_attrs, "Size", size);
|
||||
- json_object_add_value_int(device_attrs, "LBA_Data_Size", lba);
|
||||
- json_object_add_value_int(device_attrs, "Namespace_Size", nsze);
|
||||
+ json_object_add_value_uint64(device_attrs, "LBA_Size", lba);
|
||||
+ json_object_add_value_uint64(device_attrs, "Namespace_Size", ns_size);
|
||||
+ json_object_add_value_string(device_attrs, "Version", version);
|
||||
|
||||
json_array_add_value_object(devices, device_attrs);
|
||||
}
|
||||
@@ -293,6 +294,84 @@ static void netapp_ontapdevice_json(struct json_object *devices, char *devname,
|
||||
json_array_add_value_object(devices, device_attrs);
|
||||
}
|
||||
|
||||
+static void netapp_smdevices_print_verbose(struct smdevice_info *devices,
|
||||
+ int count, int format, const char *devname)
|
||||
+{
|
||||
+ int i, slta;
|
||||
+ char array_label[ARRAY_LABEL_LEN / 2 + 1];
|
||||
+ char volume_label[VOLUME_LABEL_LEN / 2 + 1];
|
||||
+ char nguid_str[33];
|
||||
+ unsigned long long lba;
|
||||
+ char size[128], used[128];
|
||||
+ char blk_size[128], version[9];
|
||||
+
|
||||
+ char *formatstr = NULL;
|
||||
+ char basestr[] =
|
||||
+ "%s, Array %s, Vol %s, NSID %d, ID %s, Ctrl %c, %s, %s, %s, %s\n";
|
||||
+ char columnstr[] =
|
||||
+ "%-16s %-30s %-30s %4d %32s %c %-12s %-9s %-9s %-9s\n";
|
||||
+
|
||||
+ if (format == NNORMAL)
|
||||
+ formatstr = basestr;
|
||||
+ else if (format == NCOLUMN) {
|
||||
+ /* print column headers and change the output string */
|
||||
+ printf("%-16s %-30s %-30s %-4s %-32s %-4s %-12s %-9s %-9s %-9s\n",
|
||||
+ "Device", "Array Name", "Volume Name", "NSID",
|
||||
+ "Volume ID", "Ctrl", "Access State", " Size",
|
||||
+ "Format", "Version");
|
||||
+ printf("%-16s %-30s %-30s %-4s %-32s %-4s %-12s %-9s %-9s %-9s\n",
|
||||
+ "----------------", "------------------------------",
|
||||
+ "------------------------------", "----",
|
||||
+ "--------------------------------", "----",
|
||||
+ "------------", "---------",
|
||||
+ "---------", "---------");
|
||||
+ formatstr = columnstr;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < count; i++) {
|
||||
+ if (devname && !strcmp(devname, basename(devices[i].dev))) {
|
||||
+ /* found the device, fetch info for that alone */
|
||||
+ netapp_get_ns_attrs(size, used, blk_size, version,
|
||||
+ &lba, &devices[i].ctrl, &devices[i].ns);
|
||||
+ netapp_convert_string(array_label,
|
||||
+ (char *)&devices[i].ctrl.vs[20],
|
||||
+ ARRAY_LABEL_LEN / 2);
|
||||
+ slta = devices[i].ctrl.vs[0] & 0x1;
|
||||
+ netapp_convert_string(volume_label,
|
||||
+ (char *)devices[i].ns.vs,
|
||||
+ VOLUME_LABEL_LEN / 2);
|
||||
+ netapp_nguid_to_str(nguid_str, devices[i].ns.nguid);
|
||||
+
|
||||
+ printf(formatstr, devices[i].dev, array_label,
|
||||
+ volume_label, devices[i].nsid,
|
||||
+ nguid_str,
|
||||
+ slta ? 'A' : 'B', "unknown", size,
|
||||
+ blk_size, version);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < count; i++) {
|
||||
+ /* fetch info and print for all devices */
|
||||
+ netapp_get_ns_attrs(size, used, blk_size, version,
|
||||
+ &lba, &devices[i].ctrl, &devices[i].ns);
|
||||
+ netapp_convert_string(array_label,
|
||||
+ (char *)&devices[i].ctrl.vs[20],
|
||||
+ ARRAY_LABEL_LEN / 2);
|
||||
+ slta = devices[i].ctrl.vs[0] & 0x1;
|
||||
+ netapp_convert_string(volume_label,
|
||||
+ (char *)devices[i].ns.vs,
|
||||
+ VOLUME_LABEL_LEN / 2);
|
||||
+ netapp_nguid_to_str(nguid_str, devices[i].ns.nguid);
|
||||
+
|
||||
+ printf(formatstr, devices[i].dev, array_label,
|
||||
+ volume_label, devices[i].nsid,
|
||||
+ nguid_str,
|
||||
+ slta ? 'A' : 'B', "unknown", size,
|
||||
+ blk_size, version);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void netapp_smdevices_print_regular(struct smdevice_info *devices,
|
||||
int count, int format, const char *devname)
|
||||
{
|
||||
@@ -311,7 +390,7 @@ static void netapp_smdevices_print_regular(struct smdevice_info *devices,
|
||||
if (format == NNORMAL)
|
||||
formatstr = basestr;
|
||||
else if (format == NCOLUMN) {
|
||||
- /* change output string and print column headers */
|
||||
+ /* print column headers and change the output string */
|
||||
printf("%-16s %-30s %-30s %-4s %-32s %-4s %-12s %-9s\n",
|
||||
"Device", "Array Name", "Volume Name", "NSID",
|
||||
"Volume ID", "Ctrl", "Access State", " Size");
|
||||
@@ -371,7 +450,8 @@ static void netapp_smdevices_print_json(struct smdevice_info *devices,
|
||||
char volume_label[VOLUME_LABEL_LEN / 2 + 1];
|
||||
char nguid_str[33];
|
||||
unsigned long long lba;
|
||||
- char size[128];
|
||||
+ char size[128], used[128];
|
||||
+ char blk_size[128], version[9];
|
||||
|
||||
/* prepare for the json output */
|
||||
root = json_create_object();
|
||||
@@ -380,7 +460,8 @@ static void netapp_smdevices_print_json(struct smdevice_info *devices,
|
||||
for (i = 0; i < count; i++) {
|
||||
if (devname && !strcmp(devname, basename(devices[i].dev))) {
|
||||
/* found the device, fetch info for that alone */
|
||||
- netapp_get_ns_size(size, &lba, &devices[i].ns);
|
||||
+ netapp_get_ns_attrs(size, used, blk_size, version,
|
||||
+ &lba, &devices[i].ctrl, &devices[i].ns);
|
||||
netapp_convert_string(array_label,
|
||||
(char *)&devices[i].ctrl.vs[20],
|
||||
ARRAY_LABEL_LEN / 2);
|
||||
@@ -392,15 +473,18 @@ static void netapp_smdevices_print_json(struct smdevice_info *devices,
|
||||
netapp_smdevice_json(json_devices, devices[i].dev,
|
||||
array_label, volume_label,
|
||||
devices[i].nsid, nguid_str,
|
||||
- slta ? "A" : "B", "unknown", size, lba,
|
||||
- le64_to_cpu(devices[i].ns.nsze));
|
||||
+ slta ? "A" : "B", "unknown",
|
||||
+ version, lba,
|
||||
+ le64_to_cpu(devices[i].ns.nsze),
|
||||
+ le64_to_cpu(devices[i].ns.nuse));
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
/* fetch info for all devices */
|
||||
- netapp_get_ns_size(size, &lba, &devices[i].ns);
|
||||
+ netapp_get_ns_attrs(size, used, blk_size, version,
|
||||
+ &lba, &devices[i].ctrl, &devices[i].ns);
|
||||
netapp_convert_string(array_label,
|
||||
(char *)&devices[i].ctrl.vs[20],
|
||||
ARRAY_LABEL_LEN / 2);
|
||||
@@ -412,7 +496,9 @@ static void netapp_smdevices_print_json(struct smdevice_info *devices,
|
||||
netapp_smdevice_json(json_devices, devices[i].dev,
|
||||
array_label, volume_label, devices[i].nsid,
|
||||
nguid_str, slta ? "A" : "B", "unknown",
|
||||
- size, lba, le64_to_cpu(devices[i].ns.nsze));
|
||||
+ version, lba,
|
||||
+ le64_to_cpu(devices[i].ns.nsze),
|
||||
+ le64_to_cpu(devices[i].ns.nuse));
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -764,6 +850,7 @@ static int netapp_smdevices(int argc, char **argv, struct command *command,
|
||||
int num_smdevices = 0;
|
||||
|
||||
struct config {
|
||||
+ bool verbose;
|
||||
char *output_format;
|
||||
};
|
||||
|
||||
@@ -772,6 +859,7 @@ static int netapp_smdevices(int argc, char **argv, struct command *command,
|
||||
};
|
||||
|
||||
OPT_ARGS(opts) = {
|
||||
+ OPT_FLAG("verbose", 'v', &cfg.verbose, "Increase output verbosity"),
|
||||
OPT_FMT("output-format", 'o', &cfg.output_format, "Output Format: normal|json|column"),
|
||||
OPT_END()
|
||||
};
|
||||
@@ -826,9 +914,14 @@ static int netapp_smdevices(int argc, char **argv, struct command *command,
|
||||
}
|
||||
|
||||
if (num_smdevices) {
|
||||
- if (fmt == NNORMAL || fmt == NCOLUMN)
|
||||
- netapp_smdevices_print_regular(smdevices,
|
||||
- num_smdevices, fmt, devname);
|
||||
+ if (fmt == NNORMAL || fmt == NCOLUMN) {
|
||||
+ if (argconfig_parse_seen(opts, "verbose"))
|
||||
+ netapp_smdevices_print_verbose(smdevices,
|
||||
+ num_smdevices, fmt, devname);
|
||||
+ else
|
||||
+ netapp_smdevices_print_regular(smdevices,
|
||||
+ num_smdevices, fmt, devname);
|
||||
+ }
|
||||
else if (fmt == NJSON)
|
||||
netapp_smdevices_print_json(smdevices,
|
||||
num_smdevices, devname);
|
||||
--
|
||||
2.43.5
|
||||
|
||||
40
SOURCES/0008-netapp-smdev-doc-add-verbose-details.patch
Normal file
40
SOURCES/0008-netapp-smdev-doc-add-verbose-details.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From cd69ccb4d51b4c0b1f772f9fef42fbf441e4a7f2 Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Tue, 3 Dec 2024 13:26:56 +0530
|
||||
Subject: [PATCH] netapp-smdev-doc: add verbose details
|
||||
|
||||
Add verbose option details to the smdevices documentation.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
Tested-by: Clayton Skaggs <claytons@netapp.com>
|
||||
---
|
||||
Documentation/nvme-netapp-smdevices.txt | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/nvme-netapp-smdevices.txt b/Documentation/nvme-netapp-smdevices.txt
|
||||
index cb68acf7..c135ff0c 100644
|
||||
--- a/Documentation/nvme-netapp-smdevices.txt
|
||||
+++ b/Documentation/nvme-netapp-smdevices.txt
|
||||
@@ -8,7 +8,7 @@ nvme-netapp-smdevices - Display information for each NVMe path to an E-Series vo
|
||||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
-'nvme netapp smdevices' [--output-format=<fmt> | -o <fmt>]
|
||||
+'nvme netapp smdevices' [--output-format=<fmt> | -o <fmt>] [--verbose | -v]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -23,6 +23,10 @@ OPTIONS
|
||||
Set the reporting format to 'normal' (default), 'column', or
|
||||
'json'. Only one output format can be used at a time.
|
||||
|
||||
+-v::
|
||||
+--verbose::
|
||||
+ Display additional information of E-Series devices on the host.
|
||||
+
|
||||
EXAMPLES
|
||||
--------
|
||||
* Display information, in a column-based format, for each path to an E-Series
|
||||
--
|
||||
2.43.5
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
From 7057e6c50639fb05d0997eaa6fac48ece3cb38bc Mon Sep 17 00:00:00 2001
|
||||
From: Bryan Gurney <bgurney@redhat.com>
|
||||
Date: Tue, 21 Jan 2025 12:20:34 -0500
|
||||
Subject: [PATCH] nvme: set eds to true if controller supports 128 bit hostid
|
||||
|
||||
A controller that uses a 128-bit Host Identifier may result in the
|
||||
"nvme resv-report" command failing with a "Host Identifier Inconsistent
|
||||
Format" error that suggests the "simultaneous use of 64-bit and
|
||||
128-bit Host Identifier values on different controllers".
|
||||
|
||||
This error can be avoided if the "--eds" option is used, to request
|
||||
the extended data structure. However, the controller's ctratt
|
||||
value indicates whether the Host Identifier is 64 bits or 128 bits.
|
||||
Therefore, check the ctratt flag, and set eds to true if the
|
||||
controller indicates a 128-bit Host Identifier.
|
||||
|
||||
Signed-off-by: Bryan Gurney <bgurney@redhat.com>
|
||||
---
|
||||
nvme.c | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/nvme.c b/nvme.c
|
||||
index a65873b2..2ed4ee92 100644
|
||||
--- a/nvme.c
|
||||
+++ b/nvme.c
|
||||
@@ -7740,6 +7740,7 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin
|
||||
const char *eds = "request extended data structure";
|
||||
|
||||
_cleanup_free_ struct nvme_resv_status *status = NULL;
|
||||
+ _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL;
|
||||
_cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
|
||||
nvme_print_flags_t flags;
|
||||
int err, size;
|
||||
@@ -7792,6 +7793,19 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin
|
||||
|
||||
size = (cfg.numd + 1) << 2;
|
||||
|
||||
+ ctrl = nvme_alloc(sizeof(*ctrl));
|
||||
+ if (!ctrl)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ err = nvme_cli_identify_ctrl(dev, ctrl);
|
||||
+ if (err) {
|
||||
+ nvme_show_error("identify-ctrl: %s", nvme_strerror(errno));
|
||||
+ return -errno;
|
||||
+ }
|
||||
+
|
||||
+ if (ctrl->ctratt & NVME_CTRL_CTRATT_128_ID)
|
||||
+ cfg.eds = true;
|
||||
+
|
||||
status = nvme_alloc(size);
|
||||
if (!status)
|
||||
return -ENOMEM;
|
||||
--
|
||||
2.43.5
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
From 48263a3e9e26f8cf1941d6cff7f6afa48952ebf2 Mon Sep 17 00:00:00 2001
|
||||
From: Martin George <marting@netapp.com>
|
||||
Date: Fri, 31 Jan 2025 22:00:29 +0530
|
||||
Subject: [PATCH] udev-rules-ontap: switch to queue-depth iopolicy
|
||||
|
||||
The queue_depth based iopolicy suits ONTAP NVMe controllers better.
|
||||
So switch to the same.
|
||||
|
||||
Signed-off-by: Martin George <marting@netapp.com>
|
||||
---
|
||||
nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in b/nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in
|
||||
index 99b6a8ba..c76a3c43 100644
|
||||
--- a/nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in
|
||||
+++ b/nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in
|
||||
@@ -1,5 +1,5 @@
|
||||
-# Enable round-robin for NetApp ONTAP and NetApp E-Series
|
||||
-ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp ONTAP Controller", ATTR{iopolicy}="round-robin"
|
||||
+# Set appropriate iopolicy for NetApp ONTAP and NetApp E-Series
|
||||
+ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp ONTAP Controller", ATTR{iopolicy}="queue-depth"
|
||||
ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp E-Series", ATTR{iopolicy}="round-robin"
|
||||
|
||||
# Set ctrl_loss_tmo to -1 for NetApp ONTAP NVMe/TCP
|
||||
--
|
||||
2.43.5
|
||||
|
||||
5
SOURCES/99-nvme-nbft-connect.sh
Normal file
5
SOURCES/99-nvme-nbft-connect.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ "$1" == nbft* ]] && [[ "$2" == "up" ]]; then
|
||||
systemctl start nvmf-connect-nbft.service
|
||||
fi
|
||||
15
SOURCES/99-nvme-nbft-no-ignore-carrier.conf
Normal file
15
SOURCES/99-nvme-nbft-no-ignore-carrier.conf
Normal file
@ -0,0 +1,15 @@
|
||||
# Boot from NVMe over TCP (NBFT)
|
||||
#
|
||||
# For NVMe/TCP connections that provide namespaces containing rootfs
|
||||
# it is crucial to react on carrier events and reconnect any missing
|
||||
# NVMe/TCP connections as defined in the ACPI NBFT table. A custom
|
||||
# /usr/lib/NetworkManager/dispatcher.d/99-nvme-nbft-connect.sh hook
|
||||
# will respawn nvmf-connect-nbft.service on such occasion.
|
||||
|
||||
[device-nbft-no-ignore-carrier]
|
||||
|
||||
# only affects nbft0, nbft1, ... interfaces
|
||||
match-device=interface-name:nbft*
|
||||
|
||||
# react on link up/down events
|
||||
ignore-carrier=no
|
||||
@ -1,19 +1,28 @@
|
||||
#%%global commit0 bdbb4da0979fbdc079cf98410cdb31cf799e83b3
|
||||
#%%global shortcommit0 %%(c=%%{commit0}; echo ${c:0:7})
|
||||
|
||||
%global nmlibdir %{_prefix}/lib/NetworkManager
|
||||
|
||||
Name: nvme-cli
|
||||
Version: 2.6
|
||||
Release: 5%{?dist}
|
||||
Version: 2.11
|
||||
Release: 6%{?dist}
|
||||
Summary: NVMe management command line interface
|
||||
|
||||
License: GPL-2.0-only
|
||||
URL: https://github.com/linux-nvme/nvme-cli
|
||||
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch0: 0001-udev-rules-set-ctrl_loss_tmo-to-1-for-ONTAP-NVMe-TCP.patch
|
||||
Patch1: 0002-udev-rules-rename-netapp-udev-rule.patch
|
||||
Patch2: 0003-Revert-fabrics-Use-corresponding-hostid-when-hostnqn.patch
|
||||
Patch3: 0004-nvme-Fixed-segmentation-fault-when-getting-host-init.patch
|
||||
Source1: 99-nvme-nbft-connect.sh
|
||||
Source2: 99-nvme-nbft-no-ignore-carrier.conf
|
||||
Patch0: 0001-netapp-ontapdev-add-verbose-output.patch
|
||||
Patch1: 0002-netapp-ontapdev-doc-add-verbose-details.patch
|
||||
Patch2: 0003-netapp-ontapdev-fix-fw-version-handling.patch
|
||||
Patch3: 0004-netapp-ontapdev-fix-JSON-output-for-nsze-nuse.patch
|
||||
Patch4: 0005-nvme-netapp-update-err-messages.patch
|
||||
Patch5: 0006-netapp-smdev-remove-redundant-code.patch
|
||||
Patch6: 0007-netapp-smdev-add-verbose-output.patch
|
||||
Patch7: 0008-netapp-smdev-doc-add-verbose-details.patch
|
||||
Patch8: 0009-nvme-set-eds-to-true-if-controller-supports-128-bit-.patch
|
||||
Patch9: 0010-udev-rules-ontap-switch-to-queue-depth-iopolicy.patch
|
||||
|
||||
BuildRequires: meson >= 0.50.0
|
||||
BuildRequires: gcc gcc-c++
|
||||
@ -21,10 +30,11 @@ BuildRequires: libuuid-devel
|
||||
BuildRequires: systemd-devel
|
||||
BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: libnvme-devel >= 1.6-1
|
||||
BuildRequires: libnvme-devel >= 1.11-1
|
||||
BuildRequires: json-c-devel >= 0.14
|
||||
BuildRequires: asciidoc
|
||||
BuildRequires: xmlto
|
||||
BuildRequires: kernel-headers >= 5.14.0-542
|
||||
|
||||
Requires: util-linux
|
||||
|
||||
@ -32,13 +42,7 @@ Requires: util-linux
|
||||
nvme-cli provides NVM-Express user space tooling for Linux.
|
||||
|
||||
%prep
|
||||
#%%setup -qn %%{name}-%%{commit0}
|
||||
%setup -q
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%autosetup -p1 -n %{name}-%{version}
|
||||
|
||||
%build
|
||||
%meson -Dudevrulesdir=%{_udevrulesdir} -Dsystemddir=%{_unitdir} -Ddocs=all -Ddocs-build=true -Dhtmldir=%{_pkgdocdir}
|
||||
@ -46,6 +50,10 @@ nvme-cli provides NVM-Express user space tooling for Linux.
|
||||
|
||||
%install
|
||||
%meson_install
|
||||
mkdir -p $RPM_BUILD_ROOT%{nmlibdir}/dispatcher.d
|
||||
mkdir -p $RPM_BUILD_ROOT%{nmlibdir}/conf.d
|
||||
%{__install} -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{nmlibdir}/dispatcher.d/
|
||||
%{__install} -pm 644 %{SOURCE2} $RPM_BUILD_ROOT%{nmlibdir}/conf.d/
|
||||
|
||||
# Do not install the dracut rule yet. See rhbz 1742764
|
||||
# Do we want to keep this here? Now that we have boot support for nvme/fc + tcp?
|
||||
@ -67,13 +75,18 @@ rm -rf %{buildroot}%{_pkgdocdir}/nvme
|
||||
%config(noreplace) %{_sysconfdir}/nvme/discovery.conf
|
||||
%{_unitdir}/nvmefc-boot-connections.service
|
||||
%{_unitdir}/nvmf-autoconnect.service
|
||||
%{_unitdir}/nvmf-connect-nbft.service
|
||||
%{_unitdir}/nvmf-connect.target
|
||||
%{_unitdir}/nvmf-connect@.service
|
||||
%{_udevrulesdir}/65-persistent-net-nbft.rules
|
||||
%{_udevrulesdir}/70-nvmf-autoconnect.rules
|
||||
%{_udevrulesdir}/70-nvmf-keys.rules
|
||||
%{_udevrulesdir}/71-nvmf-netapp.rules
|
||||
# Do not install the dracut rule yet. See rhbz 1742764
|
||||
# Is this still true? Now that we support nvme-of boot, do we want to install this file?
|
||||
# /usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf
|
||||
%{nmlibdir}/dispatcher.d/99-nvme-nbft-connect.sh
|
||||
%{nmlibdir}/conf.d/99-nvme-nbft-no-ignore-carrier.conf
|
||||
|
||||
%post
|
||||
if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
|
||||
@ -94,6 +107,49 @@ if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Wed Jun 04 2025 Maurizio Lombardi <mlombard@redhat.com> - 2.11-6
|
||||
- Fix for RHEL-95009
|
||||
|
||||
* Thu Feb 13 2025 Maurizio Lombardi <mlombard@redhat.com> - 2.11-5
|
||||
- Fix for RHEL-10433
|
||||
|
||||
* Fri Jan 24 2025 Maurizio Lombardi <mlombard@redhat.com> - 2.11-4
|
||||
- Add kernel-headers to BuildRequires (RHEL-70856)
|
||||
|
||||
* Thu Jan 16 2025 Maurizio Lombardi <mlombard@redhat.com> - 2.11-3
|
||||
- NetApp fixes for RHEL-71521
|
||||
|
||||
* Fri Nov 15 2024 Maurizio Lombardi <mlombard@redhat.com> - 2.11-2
|
||||
- Rebuild for RHEL-67144
|
||||
|
||||
* Tue Nov 12 2024 Maurizio Lombardi <mlombard@redhat.com> - 2.11-1
|
||||
- Update to version v2.11 RHEL-67144
|
||||
|
||||
* Mon Oct 07 2024 Maurizio Lombardi <mlombard@redhat.com> - 2.10.2-1
|
||||
- Update to version 2.10.2 RHEL-60536
|
||||
|
||||
* Thu Aug 22 2024 Tomas Bzatek <tbzatek@redhat.com> - 2.9.1-6
|
||||
- Install NetworkManager override for nbft interfaces
|
||||
- Rename reconnect NetworkManager hook to 99-nvme-nbft-connect.sh
|
||||
|
||||
* Tue Aug 06 2024 Maurizio Lombardi <mlombard@redhat.com> - 2.9.1-5
|
||||
- Fix RHEL-38372
|
||||
|
||||
* Wed Jul 24 2024 Tomas Bzatek <tbzatek@redhat.com> - 2.9.1-4
|
||||
- Backport NBFT discovery support (RHEL-37601)
|
||||
|
||||
* Wed June 19 2024 Maurizio Lombardi <mlombard@redhat.com> - 2.9.1-3
|
||||
- Fix RHEL-36139
|
||||
|
||||
* Tue May 07 2024 Tomas Bzatek <tbzatek@redhat.com> - 2.9.1-2
|
||||
- Install custom nvmf-connect-nbft.sh NetworkManager hook (RHEL-18912)
|
||||
|
||||
* Tue May 07 2024 Maurizio Lombardi <mlombard@redhat.com> - 2.9.1-1
|
||||
- Update to version 2.9.1
|
||||
|
||||
* Wed Apr 03 2024 Maurizio Lombardi <mlombard@redhat.com> - 2.8-1
|
||||
- Update to version 2.8
|
||||
|
||||
* Thu Feb 22 2024 Maurizio Lombardi <mlombard@redhat.com> - 2.6-5
|
||||
- Fix for RHEL-13107
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user