Accepting request 669055 from home:hreinecke:branches:Base:System

- Update to version 1.7
- Drop obsolete patches:
  - 0001-Use-tnvmcap-register-for-creating-namespace.patch
  - 0002-don-t-execute-a-command-if-dry-run-is-supplied.patch
  - 0003-Remove-trailing-n-so-that-the-output-is-valid-json.patch
  - 0004-nvme-cli-remove-unnecessary-assignments.patch
  - 0005-nvme-print.c-fix-ns-descs-JSON-output.patch
  - 0006-nvme-cli-fix-typo-in-json_print_list_items.patch
  - 0007-nvme-get-property-Add-documentation.patch
  - 0008-fabrics-write-ctrl_loss_tmo-to-fabrics-device-on-con.patch
  - 0009-fabrics-write-keep-alive-timeout-to-fabrics-device-o.patch
  - 0010-nvme-models.c-search-for-pci.ids.patch
  - 0011-nvme-cli-add-ns-write-protect-feature-support.patch
  - 0012-nvme-cli-add-minimal-ana-log-page-support.patch
  - 0013-nvme-cli-add-ana-log-documentation.patch
  - 0014-Fix-print-format-specifier-for-64-bit.patch
  - 0015-nvme-ana-log-fixup-compiler-warning-in-show_ana_log.patch
  - 0016-nvme-vendor-fixup-c99-declaration-in-huawei-plugin.patch
  - 0017-nvme-discover-sanitize-options.patch
  - 0018-Fix-nvme-id-namespace-struct.patch
  - 0019-nvme-cli-make-show_registers_cap-static.patch
  - 0020-nvme-cli-wdc-plugin-mark-array-static-declaration.patch
  - 0021-nvme-cli-fix-sparse-warnings-for-declaration.patch
  - 0022-nvme-cli-don-t-use-unsigned-for-fd-in-lnvm-nvme.c.patch
  - 0023-nvme-cli-remove-always-true-condition-for-u8.patch
  - 0024-nvme-cli-fix-dead-code-nvmf-log-page-discovery.patch
  - 0025-nvme-cli-code-cleanup-for-passthru-handlers.patch
  - 0026-nvme-cli-fix-scaandir-return-value.patch
  - 0027-nvme-cli-netapp-plugin-handle-empty-strings.patch
  - 0028-nvme-cli-Fix-the-displayed-metadata-length-value-on-.patch

OBS-URL: https://build.opensuse.org/request/show/669055
OBS-URL: https://build.opensuse.org/package/show/Base:System/nvme-cli?expand=0&rev=64
This commit is contained in:
Johannes Thumshirn 2019-01-28 12:12:59 +00:00 committed by Git OBS Bridge
parent 98423b95f3
commit 9ad7da5103
11 changed files with 4308 additions and 6 deletions

View File

@ -0,0 +1,783 @@
From 502986eb3d8a818e28a19d37565e86ea82fec197 Mon Sep 17 00:00:00 2001
From: Dong Ho <Dong.Ho@wdc.com>
Date: Fri, 11 Jan 2019 00:37:06 +0000
Subject: [PATCH] wdc: Change device capability checking
Changes the way device VID and type are checked for compatibility
purposes. Other minor changes for command names, update the respective
documentation file names, and remove deprecated C1 log functionality.
---
... => nvme-wdc-clear-pcie-correctable-errors.txt} | 12 +-
...t-add-log.txt => nvme-wdc-vs-smart-add-log.txt} | 14 +-
plugins/wdc/wdc-nvme.c | 444 +++++++--------------
plugins/wdc/wdc-nvme.h | 6 +-
4 files changed, 165 insertions(+), 311 deletions(-)
rename Documentation/{nvme-wdc-clear-pcie-corr.txt => nvme-wdc-clear-pcie-correctable-errors.txt} (66%)
rename Documentation/{nvme-wdc-smart-add-log.txt => nvme-wdc-vs-smart-add-log.txt} (95%)
diff --git a/Documentation/nvme-wdc-clear-pcie-corr.txt b/Documentation/nvme-wdc-clear-pcie-correctable-errors.txt
similarity index 66%
rename from Documentation/nvme-wdc-clear-pcie-corr.txt
rename to Documentation/nvme-wdc-clear-pcie-correctable-errors.txt
index a65978e..4788f1f 100644
--- a/Documentation/nvme-wdc-clear-pcie-corr.txt
+++ b/Documentation/nvme-wdc-clear-pcie-correctable-errors.txt
@@ -1,18 +1,18 @@
-nvme-wdc-clear-pcie-corr(1)
-===========================
+nvme-wdc-clear-pcie-correctable-errors(1)
+=========================================
NAME
----
-nvme-wdc-clear-pcie-corr - Clears the pcie correctable errors field returned in the smart-log-add command.
+nvme-wdc-clear-pcie-correctable-errors - Clears the pcie correctable errors field returned in the smart-log-add command.
SYNOPSIS
--------
[verse]
-'nvme wdc clear-pcie-corr' <device>
+'nvme wdc clear-pcie-correctable-errors' <device>
DESCRIPTION
-----------
-For the NVMe device given, sends the wdc vendor unique clear pcie
+For the NVMe device given, sends the wdc vendor unique clear pcie
correctable errors command.
The <device> parameter is mandatory and may be either the NVMe
@@ -31,7 +31,7 @@ EXAMPLES
* Clears the PCIe Correctable Error Count field returned in the smart-log-add command:
+
------------
-# nvme wdc clear-pcie-corr /dev/nvme0
+# nvme wdc clear-pcie-correctable-errors /dev/nvme0
------------
diff --git a/Documentation/nvme-wdc-smart-add-log.txt b/Documentation/nvme-wdc-vs-smart-add-log.txt
similarity index 95%
rename from Documentation/nvme-wdc-smart-add-log.txt
rename to Documentation/nvme-wdc-vs-smart-add-log.txt
index e82debf..a9c4ead 100644
--- a/Documentation/nvme-wdc-smart-add-log.txt
+++ b/Documentation/nvme-wdc-vs-smart-add-log.txt
@@ -1,18 +1,18 @@
-nvme-wdc-smart-add-log(1)
-=========================
+nvme-wdc-vs-smart-add-log(1)
+============================
NAME
----
-nvme-wdc-smart-add-log - Send NVMe WDC smart-add-log Vendor Unique Command, return result
+nvme-wdc-vs-smart-add-log - Send NVMe WDC vs-smart-add-log Vendor Unique Command, return result
SYNOPSIS
--------
[verse]
-'nvme wdc smart-add-log' <device> [--interval=<NUM>, -i <NUM>] [--output-format=<normal|json> -o <normal|json>]
+'nvme wdc vs-smart-add-log' <device> [--interval=<NUM>, -i <NUM>] [--output-format=<normal|json> -o <normal|json>]
DESCRIPTION
-----------
-For the NVMe device given, send a Vendor Unique WDC smart-add-log command and
+For the NVMe device given, send a Vendor Unique WDC vs-smart-add-log command and
provide the additional smart log. The --interval option will return performance
statistics from the specified reporting interval.
@@ -257,10 +257,10 @@ a detrimental effect on the overall performance of the device.
EXAMPLES
--------
-* Has the program issue WDC smart-add-log Vendor Unique Command with default interval (14) :
+* Has the program issue WDC vs-smart-add-log Vendor Unique Command with default interval (14) :
+
------------
-# nvme wdc smart-add-log /dev/nvme0
+# nvme wdc vs-smart-add-log /dev/nvme0
------------
NVME
diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c
index 5ef965d..d198571 100644
--- a/plugins/wdc/wdc-nvme.c
+++ b/plugins/wdc/wdc-nvme.c
@@ -52,18 +52,33 @@
#define WDC_NVME_LOG_SIZE_HDR_LEN 0x08
/* Device Config */
-#define WDC_NVME_VID 0x1c58
-#define WDC_NVME_SN100_DEV_ID 0x0003
-#define WDC_NVME_SN200_DEV_ID 0x0023
-#define WDC_NVME_VID_2 0x1b96
-#define WDC_NVME_SN310_DEV_ID 0x2200
-#define WDC_NVME_SN510_DEV_ID 0x2300
-
-#define WDC_NVME_SNDK_VID 0x15b7
-#define WDC_NVME_SXSLCL_DEV_ID 0x2001
-#define WDC_NVME_SN520_DEV_ID_1 0x5003
-#define WDC_NVME_SN520_DEV_ID_2 0x5005
-#define WDC_NVME_SN720_DEV_ID 0x5002
+#define WDC_NVME_VID 0x1c58
+#define WDC_NVME_VID_2 0x1b96
+#define WDC_NVME_SNDK_VID 0x15b7
+
+#define WDC_NVME_SN100_DEV_ID 0x0003
+#define WDC_NVME_SN200_DEV_ID 0x0023
+#define WDC_NVME_SN630_DEV_ID 0x2200
+#define WDC_NVME_SN630_DEV_ID_1 0x2201
+#define WDC_NVME_SN840_DEV_ID 0x2300
+#define WDC_NVME_SN640_DEV_ID 0x2400
+#define WDC_NVME_SN640_DEV_ID_1 0x2401
+#define WDC_NVME_SN640_DEV_ID_2 0x2402
+#define WDC_NVME_SXSLCL_DEV_ID 0x2001
+#define WDC_NVME_SN520_DEV_ID 0x5003
+#define WDC_NVME_SN520_DEV_ID_1 0x5004
+#define WDC_NVME_SN520_DEV_ID_2 0x5005
+#define WDC_NVME_SN720_DEV_ID 0x5002
+
+#define WDC_DRIVE_CAP_CAP_DIAG 0x0000000000000001
+#define WDC_DRIVE_CAP_INTERNAL_LOG 0x0000000000000002
+#define WDC_DRIVE_CAP_CA_LOG_PAGE 0x0000000000000008
+#define WDC_DRIVE_CAP_DRIVE_STATUS 0x0000000000000020
+#define WDC_DRIVE_CAP_CLEAR_ASSERT 0x0000000000000040
+#define WDC_DRIVE_CAP_CLEAR_PCIE 0x0000000000000080
+
+#define WDC_DRIVE_CAP_DRIVE_ESSENTIALS 0x0000000100000000
+#define WDC_DRIVE_CAP_DUI_DATA 0x0000000200000000
/* Capture Diagnostics */
#define WDC_NVME_CAP_DIAG_HEADER_TOC_SIZE WDC_NVME_LOG_SIZE_DATA_LEN
@@ -323,7 +338,7 @@ static int wdc_purge(int argc, char **argv,
static int wdc_purge_monitor(int argc, char **argv,
struct command *command, struct plugin *plugin);
static int wdc_nvme_check_supported_log_page(int fd, __u8 log_id);
-static int wdc_clear_pcie_corr(int argc, char **argv, struct command *command,
+static int wdc_clear_pcie_correctable_errors(int argc, char **argv, struct command *command,
struct plugin *plugin);
static int wdc_do_drive_essentials(int fd, char *dir, char *key);
static int wdc_drive_essentials(int argc, char **argv, struct command *command,
@@ -427,17 +442,6 @@ struct __attribute__((__packed__)) wdc_ssd_ca_perf_stats {
__le32 rsvd2; /* 0x7C - Reserved */
};
-static double safe_div_fp(double numerator, double denominator)
-{
- return denominator ? numerator / denominator : 0;
-}
-
-static double calc_percent(uint64_t numerator, uint64_t denominator)
-{
- return denominator ?
- (uint64_t)(((double)numerator / (double)denominator) * 100) : 0;
-}
-
static int wdc_get_pci_ids(int *device_id, int *vendor_id)
{
int fd, ret = -1;
@@ -525,40 +529,85 @@ static bool wdc_check_device(int fd)
supported = false;
- /* WDC : Use PCI Vendor and Device ID's to identify WDC Devices */
- if ((le32_to_cpu(read_vendor_id) == WDC_NVME_VID) &&
- ((le32_to_cpu(read_device_id) == WDC_NVME_SN100_DEV_ID) ||
- (le32_to_cpu(read_device_id) == WDC_NVME_SN200_DEV_ID)))
- supported = true;
- else if ((le32_to_cpu(read_vendor_id) == WDC_NVME_SNDK_VID) &&
- (le32_to_cpu(read_device_id) == WDC_NVME_SXSLCL_DEV_ID))
- supported = true;
- else if ((le32_to_cpu(read_vendor_id) == WDC_NVME_VID_2) &&
- ((le32_to_cpu(read_device_id) == WDC_NVME_SN310_DEV_ID) ||
- (le32_to_cpu(read_device_id) == WDC_NVME_SN510_DEV_ID)))
+ if ((le32_to_cpu(read_vendor_id) == WDC_NVME_VID) ||
+ (le32_to_cpu(read_vendor_id) == WDC_NVME_VID_2) ||
+ (le32_to_cpu(read_vendor_id) == WDC_NVME_SNDK_VID))
supported = true;
else
- fprintf(stderr, "WARNING : WDC not supported, Vendor ID = 0x%x, Device ID = 0x%x\n",
+ fprintf(stderr, "ERROR : WDC: unsupported WDC device, Vendor ID = 0x%x, Device ID = 0x%x\n",
le32_to_cpu(read_vendor_id), le32_to_cpu(read_device_id));
return supported;
}
-static bool wdc_check_device_match(int fd, int vendor_id, int device_id)
-{
+static __u64 wdc_get_drive_capabilities(int fd) {
int ret;
int read_device_id, read_vendor_id;
+ __u64 capabilities = 0;
ret = wdc_get_pci_ids((int *)&read_device_id, (int *)&read_vendor_id);
if (ret < 0)
- return false;
+ return capabilities;
- /* WDC : Use PCI Vendor and Device ID's to identify WDC Devices */
- if ((le32_to_cpu(read_vendor_id) == vendor_id) &&
- (le32_to_cpu(read_device_id) == device_id))
- return true;
- else
- return false;
+ switch (read_vendor_id) {
+ case WDC_NVME_VID:
+ switch (read_device_id) {
+ case WDC_NVME_SN100_DEV_ID:
+ capabilities = (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG);
+ break;
+ case WDC_NVME_SN200_DEV_ID:
+ capabilities = (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG |
+ WDC_DRIVE_CAP_CA_LOG_PAGE);
+ break;
+ default:
+ capabilities = 0;
+ }
+ break;
+ case WDC_NVME_VID_2:
+ switch (read_device_id) {
+ case WDC_NVME_SN630_DEV_ID:
+ /* FALLTHRU */
+ case WDC_NVME_SN630_DEV_ID_1:
+ /* FALLTHRU */
+ case WDC_NVME_SN640_DEV_ID:
+ /* FALLTHRU */
+ case WDC_NVME_SN640_DEV_ID_1:
+ /* FALLTHRU */
+ case WDC_NVME_SN640_DEV_ID_2:
+ /* FALLTHRU */
+ case WDC_NVME_SN840_DEV_ID:
+ capabilities = (WDC_DRIVE_CAP_CAP_DIAG | WDC_DRIVE_CAP_INTERNAL_LOG |
+ WDC_DRIVE_CAP_CA_LOG_PAGE | WDC_DRIVE_CAP_DRIVE_STATUS |
+ WDC_DRIVE_CAP_CLEAR_ASSERT);
+ break;
+ default:
+ capabilities = 0;
+ }
+ break;
+ case WDC_NVME_SNDK_VID:
+ switch (read_device_id) {
+ case WDC_NVME_SXSLCL_DEV_ID:
+ capabilities = WDC_DRIVE_CAP_DRIVE_ESSENTIALS;
+ break;
+ case WDC_NVME_SN520_DEV_ID:
+ /* FALLTHRU */
+ case WDC_NVME_SN520_DEV_ID_1:
+ /* FALLTHRU */
+ case WDC_NVME_SN520_DEV_ID_2:
+ /* FALLTHRU */
+ case WDC_NVME_SN720_DEV_ID:
+ capabilities = WDC_DRIVE_CAP_DUI_DATA;
+ break;
+ default:
+ capabilities = 0;
+ }
+
+ break;
+ default:
+ capabilities = 0;
+ }
+
+ return capabilities;
}
static int wdc_get_serial_name(int fd, char *file, size_t len, const char *suffix)
@@ -585,12 +634,11 @@ static int wdc_get_serial_name(int fd, char *file, size_t len, const char *suffi
ctrl.sn[i] = '\0';
i--;
}
-
if (ctrl.sn[sizeof (ctrl.sn) - 1] == '\0') {
ctrl_sn_len = strlen(ctrl.sn);
}
- res_len = snprintf(file, len, "%s%.*s%s.bin", orig, ctrl_sn_len, ctrl.sn, suffix);
+ res_len = snprintf(file, len, "%s%.*s%s", orig, ctrl_sn_len, ctrl.sn, suffix);
if (len <= res_len) {
fprintf(stderr, "ERROR : WDC : cannot format serial number due to data "
"of unexpected length\n");
@@ -957,6 +1005,7 @@ static int wdc_cap_diag(int argc, char **argv, struct command *command,
char f[PATH_MAX] = {0};
__u32 xfer_size = 0;
int fd;
+ __u64 capabilities = 0;
struct config {
char *file;
@@ -969,10 +1018,10 @@ static int wdc_cap_diag(int argc, char **argv, struct command *command,
};
const struct argconfig_commandline_options command_line_options[] = {
- {"output-file", 'o', "FILE", CFG_STRING, &cfg.file, required_argument, file},
- {"transfer-size", 's', "NUM", CFG_POSITIVE, &cfg.xfer_size, required_argument, size},
- { NULL, '\0', NULL, CFG_NONE, NULL, no_argument, desc},
- {NULL}
+ {"output-file", 'o', "FILE", CFG_STRING, &cfg.file, required_argument, file},
+ {"transfer-size", 's', "NUM", CFG_POSITIVE, &cfg.xfer_size, required_argument, size},
+ { NULL, '\0', NULL, CFG_NONE, NULL, no_argument, desc},
+ {NULL}
};
fd = parse_and_open(argc, argv, desc, command_line_options, NULL, 0);
@@ -990,19 +1039,17 @@ static int wdc_cap_diag(int argc, char **argv, struct command *command,
return -1;
}
- if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN100_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN200_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID_2, WDC_NVME_SN310_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID_2, WDC_NVME_SN510_DEV_ID)) {
+ capabilities = wdc_get_drive_capabilities(fd);
+ if ((capabilities & WDC_DRIVE_CAP_CAP_DIAG) == WDC_DRIVE_CAP_CAP_DIAG) {
+ snprintf(f + strlen(f), PATH_MAX, "%s", ".bin");
return wdc_do_cap_diag(fd, f, xfer_size);
- } else {
- fprintf(stderr, "ERROR : WDC: unsupported device for cap-diag command\n");
- }
+ } else
+ fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
return 0;
}
-static int wdc_internal_fw_log(int argc, char **argv, struct command *command,
+static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command,
struct plugin *plugin)
{
char *desc = "Internal Firmware Log.";
@@ -1014,6 +1061,7 @@ static int wdc_internal_fw_log(int argc, char **argv, struct command *command,
int fd;
UtilsTimeInfo timeInfo;
__u8 timeStamp[MAX_PATH_LEN];
+ __u64 capabilities = 0;
struct config {
char *file;
@@ -1036,6 +1084,8 @@ static int wdc_internal_fw_log(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
+ if (!wdc_check_device(fd))
+ return -1;
if (cfg.xfer_size != 0) {
xfer_size = cfg.xfer_size;
}
@@ -1057,13 +1107,12 @@ static int wdc_internal_fw_log(int argc, char **argv, struct command *command,
}
fprintf(stderr, "%s: filename = %s\n", __func__, f);
- if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN100_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN200_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID_2, WDC_NVME_SN310_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID_2, WDC_NVME_SN510_DEV_ID)) {
+ capabilities = wdc_get_drive_capabilities(fd);
+ if ((capabilities & WDC_DRIVE_CAP_INTERNAL_LOG) == WDC_DRIVE_CAP_INTERNAL_LOG) {
+ snprintf(f + strlen(f), PATH_MAX, "%s", ".bin");
return wdc_do_cap_diag(fd, f, xfer_size);
} else {
- fprintf(stderr, "ERROR : WDC: unsupported device for internal_fw_log command\n");
+ fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
return -1;
}
}
@@ -1226,7 +1275,8 @@ static int wdc_drive_log(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
- wdc_check_device(fd);
+ if (!wdc_check_device(fd))
+ return -1;
if (cfg.file != NULL) {
strncpy(f, cfg.file, PATH_MAX - 1);
}
@@ -1243,6 +1293,7 @@ static int wdc_get_crash_dump(int argc, char **argv, struct command *command,
const char *desc = "Get Crash Dump.";
const char *file = "Output file pathname.";
int fd;
+ int ret;
struct config {
char *file;
};
@@ -1261,21 +1312,22 @@ static int wdc_get_crash_dump(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
- if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN100_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN200_DEV_ID) ) {
- return wdc_crash_dump(fd, cfg.file, WDC_NVME_CRASH_DUMP_TYPE);
- } else {
- fprintf(stderr, "ERROR : WDC: unsupported device for get-crash-dump command\n");
+ if (!wdc_check_device(fd))
return -1;
+ ret = wdc_crash_dump(fd, cfg.file, WDC_NVME_CRASH_DUMP_TYPE);
+ if (ret != 0) {
+ fprintf(stderr, "ERROR : WDC : failed to read crash dump\n");
}
+ return ret;
}
static int wdc_get_pfail_dump(int argc, char **argv, struct command *command,
- struct plugin *plugin)
+ struct plugin *plugin)
{
char *desc = "Get Pfail Crash Dump.";
char *file = "Output file pathname.";
int fd;
+ int ret;
struct config {
char *file;
};
@@ -1294,13 +1346,13 @@ static int wdc_get_pfail_dump(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
- if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN100_DEV_ID) ||
- wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN200_DEV_ID) ) {
- return wdc_crash_dump(fd, cfg.file, WDC_NVME_PFAIL_DUMP_TYPE);
- } else {
- fprintf(stderr, "ERROR : WDC: unsupported device for get-pfail-dump command\n");
+ if (!wdc_check_device(fd))
return -1;
+ ret = wdc_crash_dump(fd, cfg.file, WDC_NVME_PFAIL_DUMP_TYPE);
+ if (ret != 0) {
+ fprintf(stderr, "ERROR : WDC : failed to read pfail crash dump\n");
}
+ return ret;
}
static void wdc_do_id_ctrl(__u8 *vs, struct json_object *root)
@@ -1372,7 +1424,8 @@ static int wdc_purge(int argc, char **argv,
if (fd < 0)
return fd;
- wdc_check_device(fd);
+ if (!wdc_check_device(fd))
+ return -1;
ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd);
if (ret > 0) {
switch (ret) {
@@ -1419,7 +1472,8 @@ static int wdc_purge_monitor(int argc, char **argv,
if (fd < 0)
return fd;
- wdc_check_device(fd);
+ if (!wdc_check_device(fd))
+ return -1;
ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd);
if (ret == 0) {
mon = (struct wdc_nvme_purge_monitor_data *) output;
@@ -1436,136 +1490,6 @@ static int wdc_purge_monitor(int argc, char **argv,
return ret;
}
-static void wdc_print_log_normal(struct wdc_ssd_perf_stats *perf)
-{
- printf(" C1 Log Page Performance Statistics :- \n");
- printf(" Host Read Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hr_cmds));
- printf(" Host Read Blocks %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hr_blks));
- printf(" Average Read Size %20lf\n",
- safe_div_fp((le64_to_cpu(perf->hr_blks)), (le64_to_cpu(perf->hr_cmds))));
- printf(" Host Read Cache Hit Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hr_ch_cmds));
- printf(" Host Read Cache Hit_Percentage %20"PRIu64"%%\n",
- (uint64_t) calc_percent(le64_to_cpu(perf->hr_ch_cmds), le64_to_cpu(perf->hr_cmds)));
- printf(" Host Read Cache Hit Blocks %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hr_ch_blks));
- printf(" Average Read Cache Hit Size %20f\n",
- safe_div_fp((le64_to_cpu(perf->hr_ch_blks)), (le64_to_cpu(perf->hr_ch_cmds))));
- printf(" Host Read Commands Stalled %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hr_st_cmds));
- printf(" Host Read Commands Stalled Percentage %20"PRIu64"%%\n",
- (uint64_t)calc_percent((le64_to_cpu(perf->hr_st_cmds)), le64_to_cpu(perf->hr_cmds)));
- printf(" Host Write Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hw_cmds));
- printf(" Host Write Blocks %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hw_blks));
- printf(" Average Write Size %20f\n",
- safe_div_fp((le64_to_cpu(perf->hw_blks)), (le64_to_cpu(perf->hw_cmds))));
- printf(" Host Write Odd Start Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hw_os_cmds));
- printf(" Host Write Odd Start Commands Percentage %20"PRIu64"%%\n",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_os_cmds)), (le64_to_cpu(perf->hw_cmds))));
- printf(" Host Write Odd End Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hw_oe_cmds));
- printf(" Host Write Odd End Commands Percentage %20"PRIu64"%%\n",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_oe_cmds)), (le64_to_cpu((perf->hw_cmds)))));
- printf(" Host Write Commands Stalled %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->hw_st_cmds));
- printf(" Host Write Commands Stalled Percentage %20"PRIu64"%%\n",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_st_cmds)), (le64_to_cpu(perf->hw_cmds))));
- printf(" NAND Read Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->nr_cmds));
- printf(" NAND Read Blocks Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->nr_blks));
- printf(" Average NAND Read Size %20f\n",
- safe_div_fp((le64_to_cpu(perf->nr_blks)), (le64_to_cpu((perf->nr_cmds)))));
- printf(" Nand Write Commands %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->nw_cmds));
- printf(" NAND Write Blocks %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->nw_blks));
- printf(" Average NAND Write Size %20f\n",
- safe_div_fp((le64_to_cpu(perf->nw_blks)), (le64_to_cpu(perf->nw_cmds))));
- printf(" NAND Read Before Write %20"PRIu64"\n",
- (uint64_t)le64_to_cpu(perf->nrbw));
-}
-
-static void wdc_print_log_json(struct wdc_ssd_perf_stats *perf)
-{
- struct json_object *root;
-
- root = json_create_object();
- json_object_add_value_int(root, "Host Read Commands", le64_to_cpu(perf->hr_cmds));
- json_object_add_value_int(root, "Host Read Blocks", le64_to_cpu(perf->hr_blks));
- json_object_add_value_int(root, "Average Read Size",
- safe_div_fp((le64_to_cpu(perf->hr_blks)), (le64_to_cpu(perf->hr_cmds))));
- json_object_add_value_int(root, "Host Read Cache Hit Commands",
- (uint64_t)le64_to_cpu(perf->hr_ch_cmds));
- json_object_add_value_int(root, "Host Read Cache Hit Percentage",
- (uint64_t) calc_percent(le64_to_cpu(perf->hr_ch_cmds), le64_to_cpu(perf->hr_cmds)));
- json_object_add_value_int(root, "Host Read Cache Hit Blocks",
- (uint64_t)le64_to_cpu(perf->hr_ch_blks));
- json_object_add_value_int(root, "Average Read Cache Hit Size",
- safe_div_fp((le64_to_cpu(perf->hr_ch_blks)), (le64_to_cpu(perf->hr_ch_cmds))));
- json_object_add_value_int(root, "Host Read Commands Stalled",
- (uint64_t)le64_to_cpu(perf->hr_st_cmds));
- json_object_add_value_int(root, "Host Read Commands Stalled Percentage",
- (uint64_t)calc_percent((le64_to_cpu(perf->hr_st_cmds)), le64_to_cpu(perf->hr_cmds)));
- json_object_add_value_int(root, "Host Write Commands",
- (uint64_t)le64_to_cpu(perf->hw_cmds));
- json_object_add_value_int(root, "Host Write Blocks",
- (uint64_t)le64_to_cpu(perf->hw_blks));
- json_object_add_value_int(root, "Average Write Size",
- safe_div_fp((le64_to_cpu(perf->hw_blks)), (le64_to_cpu(perf->hw_cmds))));
- json_object_add_value_int(root, "Host Write Odd Start Commands",
- (uint64_t)le64_to_cpu(perf->hw_os_cmds));
- json_object_add_value_int(root, "Host Write Odd Start Commands Percentage",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_os_cmds)), (le64_to_cpu(perf->hw_cmds))));
- json_object_add_value_int(root, "Host Write Odd End Commands",
- (uint64_t)le64_to_cpu(perf->hw_oe_cmds));
- json_object_add_value_int(root, "Host Write Odd End Commands Percentage",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_oe_cmds)), (le64_to_cpu((perf->hw_cmds)))));
- json_object_add_value_int(root, "Host Write Commands Stalled",
- (uint64_t)le64_to_cpu(perf->hw_st_cmds));
- json_object_add_value_int(root, "Host Write Commands Stalled Percentage",
- (uint64_t)calc_percent((le64_to_cpu(perf->hw_st_cmds)), (le64_to_cpu(perf->hw_cmds))));
- json_object_add_value_int(root, "NAND Read Commands",
- (uint64_t)le64_to_cpu(perf->nr_cmds));
- json_object_add_value_int(root, "NAND Read Blocks Commands",
- (uint64_t)le64_to_cpu(perf->nr_blks));
- json_object_add_value_int(root, "Average NAND Read Size",
- safe_div_fp((le64_to_cpu(perf->nr_blks)), (le64_to_cpu((perf->nr_cmds)))));
- json_object_add_value_int(root, "Nand Write Commands",
- (uint64_t)le64_to_cpu(perf->nw_cmds));
- json_object_add_value_int(root, "NAND Write Blocks",
- (uint64_t)le64_to_cpu(perf->nw_blks));
- json_object_add_value_int(root, "Average NAND Write Size",
- safe_div_fp((le64_to_cpu(perf->nw_blks)), (le64_to_cpu(perf->nw_cmds))));
- json_object_add_value_int(root, "NAND Read Before Written",
- (uint64_t)le64_to_cpu(perf->nrbw));
- json_print_object(root, NULL);
- printf("\n");
- json_free_object(root);
-}
-
-static int wdc_print_log(struct wdc_ssd_perf_stats *perf, int fmt)
-{
- if (!perf) {
- fprintf(stderr, "ERROR : WDC : Invalid buffer to read perf stats\n");
- return -1;
- }
- switch (fmt) {
- case NORMAL:
- wdc_print_log_normal(perf);
- break;
- case JSON:
- wdc_print_log_json(perf);
- break;
- }
- return 0;
-}
-
static void wdc_print_ca_log_normal(struct wdc_ssd_ca_perf_stats *perf)
{
uint64_t converted = 0;
@@ -1709,7 +1633,8 @@ static int wdc_get_ca_log_page(int fd, char *format)
struct wdc_ssd_ca_perf_stats *perf;
- wdc_check_device(fd);
+ if (!wdc_check_device(fd))
+ return -1;
fmt = validate_output_format(format);
if (fmt < 0) {
fprintf(stderr, "ERROR : WDC : invalid output format\n");
@@ -1746,70 +1671,14 @@ static int wdc_get_ca_log_page(int fd, char *format)
return ret;
}
-static int wdc_get_c1_log_page(int fd, char *format, uint8_t interval)
-{
- int ret = 0;
- int fmt = -1;
- __u8 *data;
- __u8 *p;
- int i;
- int skip_cnt = 4;
- int total_subpages;
- struct wdc_log_page_header *l;
- struct wdc_log_page_subpage_header *sph;
- struct wdc_ssd_perf_stats *perf;
-
- wdc_check_device(fd);
- fmt = validate_output_format(format);
- if (fmt < 0) {
- fprintf(stderr, "ERROR : WDC : invalid output format\n");
- return fmt;
- }
-
- if (interval < 1 || interval > 15) {
- fprintf(stderr, "ERROR : WDC : interval out of range [1-15]\n");
- return -1;
- }
-
- if ((data = (__u8*) malloc(sizeof (__u8) * WDC_ADD_LOG_BUF_LEN)) == NULL) {
- fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno));
- return -1;
- }
- memset(data, 0, sizeof (__u8) * WDC_ADD_LOG_BUF_LEN);
-
- ret = nvme_get_log(fd, 0x01, WDC_NVME_ADD_LOG_OPCODE,
- false, WDC_ADD_LOG_BUF_LEN, data);
- if (strcmp(format, "json"))
- fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
- if (ret == 0) {
- l = (struct wdc_log_page_header*)data;
- total_subpages = l->num_subpages + WDC_NVME_GET_STAT_PERF_INTERVAL_LIFETIME - 1;
- for (i = 0, p = data + skip_cnt; i < total_subpages; i++, p += skip_cnt) {
- sph = (struct wdc_log_page_subpage_header *) p;
- if (sph->spcode == WDC_GET_LOG_PAGE_SSD_PERFORMANCE) {
- if (sph->pcset == interval) {
- perf = (struct wdc_ssd_perf_stats *) (p + 4);
- ret = wdc_print_log(perf, fmt);
- break;
- }
- }
- skip_cnt = le32_to_cpu(sph->subpage_length) + 4;
- }
- if (ret) {
- fprintf(stderr, "ERROR : WDC : Unable to read data from buffer\n");
- }
- }
- free(data);
- return ret;
-}
-
-static int wdc_smart_add_log(int argc, char **argv, struct command *command,
+static int wdc_vs_smart_add_log(int argc, char **argv, struct command *command,
struct plugin *plugin)
{
const char *desc = "Retrieve additional performance statistics.";
const char *interval = "Interval to read the statistics from [1, 15].";
int fd;
int ret;
+ __u64 capabilities = 0;
struct config {
uint8_t interval;
@@ -1832,38 +1701,20 @@ static int wdc_smart_add_log(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
-
- if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN100_DEV_ID)) {
- // Get the C1 Log Page
- ret = wdc_get_c1_log_page(fd, cfg.output_format, cfg.interval);
-
- if (ret) {
- fprintf(stderr, "ERROR : WDC : Unable to read C1 Log Page data from buffer\n");
- return ret;
- }
- }
- else if (wdc_check_device_match(fd, WDC_NVME_VID, WDC_NVME_SN200_DEV_ID)) {
- // Get the CA and C1 Log Page
+ capabilities = wdc_get_drive_capabilities(fd);
+ if ((capabilities & (WDC_DRIVE_CAP_CA_LOG_PAGE)) == (WDC_DRIVE_CAP_CA_LOG_PAGE)) {
+ // Get the CA Log Page
ret = wdc_get_ca_log_page(fd, cfg.output_format);
if (ret) {
- fprintf(stderr, "ERROR : WDC : Unable to read CA Log Page data from buffer\n");
+ fprintf(stderr, "ERROR : WDC : Unable to read CA Log Page\n");
return ret;
}
-
- ret = wdc_get_c1_log_page(fd, cfg.output_format, cfg.interval);
- if (ret) {
- fprintf(stderr, "ERROR : WDC : Unable to read C1 Log Page data from buffer\n");
- return ret;
- }
- }
- else {
- fprintf(stderr, "INFO : WDC : Command not supported in this device\n");
- }
-
+ } else
+ fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
return 0;
}
-static int wdc_clear_pcie_corr(int argc, char **argv, struct command *command,
+static int wdc_clear_pcie_correctable_errors(int argc, char **argv, struct command *command,
struct plugin *plugin)
{
char *desc = "Clear PCIE Correctable Errors.";
@@ -1879,7 +1730,8 @@ static int wdc_clear_pcie_corr(int argc, char **argv, struct command *command,
if (fd < 0)
return fd;
- wdc_check_device(fd);
+ if (!wdc_check_device(fd))
+ return -1;
memset(&admin_cmd, 0, sizeof (admin_cmd));
admin_cmd.opcode = WDC_NVME_CLEAR_PCIE_CORR_OPCODE;
@@ -2610,13 +2462,15 @@ static int wdc_drive_essentials(int argc, char **argv, struct command *command,
{ NULL, '\0', NULL, CFG_NONE, NULL, no_argument, desc},
{NULL}
};
+ __u64 capabilities = 0;
fd = parse_and_open(argc, argv, desc, command_line_options, NULL, 0);
if (fd < 0)
return fd;
- if (!wdc_check_device_match(fd, WDC_NVME_SNDK_VID, WDC_NVME_SXSLCL_DEV_ID)) {
- fprintf(stderr, "WARNING : WDC : Device not supported\n");
+ capabilities = wdc_get_drive_capabilities(fd);
+ if ((capabilities & WDC_DRIVE_CAP_DRIVE_ESSENTIALS) != WDC_DRIVE_CAP_DRIVE_ESSENTIALS) {
+ fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
return -1;
}
diff --git a/plugins/wdc/wdc-nvme.h b/plugins/wdc/wdc-nvme.h
index c2d892b..4fcc33b 100644
--- a/plugins/wdc/wdc-nvme.h
+++ b/plugins/wdc/wdc-nvme.h
@@ -15,9 +15,9 @@ PLUGIN(NAME("wdc", "Western Digital vendor specific extensions"),
ENTRY("id-ctrl", "WDC identify controller", wdc_id_ctrl)
ENTRY("purge", "WDC Purge", wdc_purge)
ENTRY("purge-monitor", "WDC Purge Monitor", wdc_purge_monitor)
- ENTRY("vs-internal-log", "WDC Internal Firmware Log", wdc_internal_fw_log)
- ENTRY("smart-add-log", "WDC Additional Smart Log", wdc_smart_add_log)
- ENTRY("clear-pcie-corr", "WDC Clear PCIe Correctable Error Count", wdc_clear_pcie_corr)
+ ENTRY("vs-internal-log", "WDC Internal Firmware Log", wdc_vs_internal_fw_log)
+ ENTRY("vs-smart-add-log", "WDC Additional Smart Log", wdc_vs_smart_add_log)
+ ENTRY("clear-pcie-correctable-errors", "WDC Clear PCIe Correctable Error Count", wdc_clear_pcie_correctable_errors)
ENTRY("drive-essentials", "WDC Drive Essentials", wdc_drive_essentials)
)
);
--
2.13.7

View File

@ -0,0 +1,327 @@
From 47384b5e28a13cd060dddbf24d18cf0a8c11fd03 Mon Sep 17 00:00:00 2001
From: Dong Ho <Dong.Ho@wdc.com>
Date: Fri, 11 Jan 2019 00:37:09 +0000
Subject: [PATCH] wdc: Add additional device for vs-internal-log
Add support for SN730 device to vs-internal-log.
Reviewed-by Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
plugins/wdc/wdc-nvme.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 266 insertions(+)
diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c
index d198571..88c5c76 100644
--- a/plugins/wdc/wdc-nvme.c
+++ b/plugins/wdc/wdc-nvme.c
@@ -69,6 +69,8 @@
#define WDC_NVME_SN520_DEV_ID_1 0x5004
#define WDC_NVME_SN520_DEV_ID_2 0x5005
#define WDC_NVME_SN720_DEV_ID 0x5002
+#define WDC_NVME_SN730_DEV_ID 0x3714
+#define WDC_NVME_SN730_DEV_ID_1 0x3734
#define WDC_DRIVE_CAP_CAP_DIAG 0x0000000000000001
#define WDC_DRIVE_CAP_INTERNAL_LOG 0x0000000000000002
@@ -80,6 +82,21 @@
#define WDC_DRIVE_CAP_DRIVE_ESSENTIALS 0x0000000100000000
#define WDC_DRIVE_CAP_DUI_DATA 0x0000000200000000
+#define WDC_SN730_CAP_VUC_LOG 0x0000000400000000
+
+/* SN730 Get Log Capabilities */
+#define SN730_NVME_GET_LOG_OPCODE 0xc2
+#define SN730_GET_FULL_LOG_LENGTH 0x00080009
+#define SN730_GET_KEY_LOG_LENGTH 0x00090009
+#define SN730_GET_COREDUMP_LOG_LENGTH 0x00120009
+#define SN730_GET_EXTENDED_LOG_LENGTH 0x00420009
+
+#define SN730_GET_FULL_LOG_SUBOPCODE 0x00010009
+#define SN730_GET_KEY_LOG_SUBOPCODE 0x00020009
+#define SN730_GET_CORE_LOG_SUBOPCODE 0x00030009
+#define SN730_GET_EXTEND_LOG_SUBOPCODE 0x00040009
+#define SN730_LOG_CHUNK_SIZE 0x1000
+
/* Capture Diagnostics */
#define WDC_NVME_CAP_DIAG_HEADER_TOC_SIZE WDC_NVME_LOG_SIZE_DATA_LEN
#define WDC_NVME_CAP_DIAG_OPCODE 0xE6
@@ -277,6 +294,18 @@ typedef struct _WDC_DE_CSA_FEATURE_ID_LIST
__u8 featureName[WDC_DE_GENERIC_BUFFER_SIZE];
} WDC_DE_CSA_FEATURE_ID_LIST;
+typedef struct tarfile_metadata {
+ char fileName[MAX_PATH_LEN];
+ int8_t bufferFolderPath[MAX_PATH_LEN];
+ char bufferFolderName[MAX_PATH_LEN];
+ char tarFileName[MAX_PATH_LEN];
+ char tarFiles[MAX_PATH_LEN];
+ char tarCmd[MAX_PATH_LEN+MAX_PATH_LEN];
+ char currDir[MAX_PATH_LEN];
+ UtilsTimeInfo timeInfo;
+ uint8_t* timeString[MAX_PATH_LEN];
+} tarfile_metadata;
+
static WDC_DE_CSA_FEATURE_ID_LIST deFeatureIdList[] =
{
{0x00 , "Dummy Placeholder"},
@@ -580,6 +609,11 @@ static __u64 wdc_get_drive_capabilities(int fd) {
WDC_DRIVE_CAP_CA_LOG_PAGE | WDC_DRIVE_CAP_DRIVE_STATUS |
WDC_DRIVE_CAP_CLEAR_ASSERT);
break;
+ case WDC_NVME_SN730_DEV_ID:
+ /* FALLTHRU */
+ case WDC_NVME_SN730_DEV_ID_1:
+ capabilities = WDC_SN730_CAP_VUC_LOG;
+ break;
default:
capabilities = 0;
}
@@ -1049,6 +1083,236 @@ static int wdc_cap_diag(int argc, char **argv, struct command *command,
return 0;
}
+static int wdc_do_get_sn730_log_len(int fd, uint32_t *len_buf, uint32_t subopcode)
+{
+ int ret;
+ uint32_t *output = NULL;
+ struct nvme_admin_cmd admin_cmd;
+
+ if ((output = (uint32_t*)malloc(sizeof(uint32_t))) == NULL) {
+ fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno));
+ return -1;
+ }
+ memset(output, 0, sizeof (uint32_t));
+ memset(&admin_cmd, 0, sizeof (struct nvme_admin_cmd));
+
+ admin_cmd.data_len = 8;
+ admin_cmd.opcode = SN730_NVME_GET_LOG_OPCODE;
+ admin_cmd.addr = (uintptr_t)output;
+ admin_cmd.cdw12 = subopcode;
+ admin_cmd.cdw10 = SN730_LOG_CHUNK_SIZE / 4;
+
+ ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd);
+ if (ret == 0)
+ *len_buf = *output;
+ free(output);
+ return ret;
+}
+
+static int wdc_do_get_sn730_log(int fd, void * log_buf, uint32_t offset, uint32_t subopcode)
+{
+ int ret;
+ uint8_t *output = NULL;
+ struct nvme_admin_cmd admin_cmd;
+
+ if ((output = (uint8_t*)calloc(SN730_LOG_CHUNK_SIZE, sizeof(uint8_t))) == NULL) {
+ fprintf(stderr, "ERROR : WDC : calloc : %s\n", strerror(errno));
+ return -1;
+ }
+ memset(&admin_cmd, 0, sizeof (struct nvme_admin_cmd));
+ admin_cmd.data_len = SN730_LOG_CHUNK_SIZE;
+ admin_cmd.opcode = SN730_NVME_GET_LOG_OPCODE;
+ admin_cmd.addr = (uintptr_t)output;
+ admin_cmd.cdw12 = subopcode;
+ admin_cmd.cdw13 = offset;
+ admin_cmd.cdw10 = SN730_LOG_CHUNK_SIZE / 4;
+
+ ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd);
+ if (!ret)
+ memcpy(log_buf, output, SN730_LOG_CHUNK_SIZE);
+ return ret;
+}
+
+static int get_sn730_log_chunks(int fd, uint8_t* log_buf, uint32_t log_len, uint32_t subopcode)
+{
+ int ret = 0;
+ uint8_t* chunk_buf = NULL;
+ int remaining = log_len;
+ int curr_offset = 0;
+
+ if ((chunk_buf = (uint8_t*) malloc(sizeof (uint8_t) * SN730_LOG_CHUNK_SIZE)) == NULL) {
+ fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno));
+ ret = -1;
+ goto out;
+ }
+
+ while (remaining > 0) {
+ memset(chunk_buf, 0, SN730_LOG_CHUNK_SIZE);
+ ret = wdc_do_get_sn730_log(fd, chunk_buf, curr_offset, subopcode);
+ if (!ret) {
+ if (remaining >= SN730_LOG_CHUNK_SIZE) {
+ memcpy(log_buf + (curr_offset * SN730_LOG_CHUNK_SIZE),
+ chunk_buf, SN730_LOG_CHUNK_SIZE);
+ } else {
+ memcpy(log_buf + (curr_offset * SN730_LOG_CHUNK_SIZE),
+ chunk_buf, remaining);
+ }
+ remaining -= SN730_LOG_CHUNK_SIZE;
+ curr_offset += 1;
+ } else
+ goto out;
+ }
+out:
+ free(chunk_buf);
+ return ret;
+}
+
+static int wdc_do_sn730_get_and_tar(int fd, char * outputName)
+{
+ int ret = 0;
+ void *retPtr;
+ uint8_t* full_log_buf = NULL;
+ uint8_t* key_log_buf = NULL;
+ uint8_t* core_dump_log_buf = NULL;
+ uint8_t* extended_log_buf = NULL;
+ uint32_t full_log_len = 0;
+ uint32_t key_log_len = 0;
+ uint32_t core_dump_log_len = 0;
+ uint32_t extended_log_len = 0;
+ tarfile_metadata* tarInfo = NULL;
+
+ tarInfo = (struct tarfile_metadata*) malloc(sizeof(tarfile_metadata));
+ if (tarInfo == NULL) {
+ fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno));
+ ret = -1;
+ goto free_buf;
+ }
+ memset(tarInfo, 0, sizeof(tarfile_metadata));
+
+ /* Create Logs directory */
+ wdc_UtilsGetTime(&tarInfo->timeInfo);
+ memset(tarInfo->timeString, 0, sizeof(tarInfo->timeString));
+ wdc_UtilsSnprintf((char*)tarInfo->timeString, MAX_PATH_LEN, "%02u%02u%02u_%02u%02u%02u",
+ tarInfo->timeInfo.year, tarInfo->timeInfo.month, tarInfo->timeInfo.dayOfMonth,
+ tarInfo->timeInfo.hour, tarInfo->timeInfo.minute, tarInfo->timeInfo.second);
+
+ wdc_UtilsSnprintf((char*)tarInfo->bufferFolderName, MAX_PATH_LEN, "%s",
+ (char*)outputName);
+
+ retPtr = getcwd((char*)tarInfo->currDir, MAX_PATH_LEN);
+ if (retPtr != NULL)
+ wdc_UtilsSnprintf((char*)tarInfo->bufferFolderPath, MAX_PATH_LEN, "%s%s%s",
+ (char *)tarInfo->currDir, WDC_DE_PATH_SEPARATOR, (char *)tarInfo->bufferFolderName);
+ else {
+ fprintf(stderr, "ERROR : WDC : get current working directory failed\n");
+ goto free_buf;
+ }
+
+ ret = wdc_UtilsCreateDir((char*)tarInfo->bufferFolderPath);
+ if (ret)
+ {
+ fprintf(stderr, "ERROR : WDC : create directory failed, ret = %d, dir = %s\n", ret, tarInfo->bufferFolderPath);
+ goto free_buf;
+ } else {
+ fprintf(stderr, "Stored log files in directory: %s\n", tarInfo->bufferFolderPath);
+ }
+
+ ret = wdc_do_get_sn730_log_len(fd, &full_log_len, SN730_GET_FULL_LOG_LENGTH);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+ ret = wdc_do_get_sn730_log_len(fd, &key_log_len, SN730_GET_KEY_LOG_LENGTH);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+ ret = wdc_do_get_sn730_log_len(fd, &core_dump_log_len, SN730_GET_COREDUMP_LOG_LENGTH);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+ ret = wdc_do_get_sn730_log_len(fd, &extended_log_len, SN730_GET_EXTENDED_LOG_LENGTH);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+
+ full_log_buf = (uint8_t*) calloc(full_log_len, sizeof (uint8_t));
+ key_log_buf = (uint8_t*) calloc(key_log_len, sizeof (uint8_t));
+ core_dump_log_buf = (uint8_t*) calloc(core_dump_log_len, sizeof (uint8_t));
+ extended_log_buf = (uint8_t*) calloc(extended_log_len, sizeof (uint8_t));
+
+ if (!full_log_buf || !key_log_buf || !core_dump_log_buf || !extended_log_buf) {
+ fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno));
+ ret = -1;
+ goto free_buf;
+ }
+
+ /* Get the full log */
+ ret = get_sn730_log_chunks(fd, full_log_buf, full_log_len, SN730_GET_FULL_LOG_SUBOPCODE);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+
+ /* Get the key log */
+ ret = get_sn730_log_chunks(fd, key_log_buf, key_log_len, SN730_GET_KEY_LOG_SUBOPCODE);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+
+ /* Get the core dump log */
+ ret = get_sn730_log_chunks(fd, core_dump_log_buf, core_dump_log_len, SN730_GET_CORE_LOG_SUBOPCODE);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+
+ /* Get the extended log */
+ ret = get_sn730_log_chunks(fd, extended_log_buf, extended_log_len, SN730_GET_EXTEND_LOG_SUBOPCODE);
+ if (ret) {
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ goto free_buf;
+ }
+
+ /* Write log files */
+ wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR,
+ "full_log", (char*)tarInfo->timeString);
+ wdc_WriteToFile(tarInfo->fileName, (char*)full_log_buf, full_log_len);
+
+ wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR,
+ "key_log", (char*)tarInfo->timeString);
+ wdc_WriteToFile(tarInfo->fileName, (char*)key_log_buf, key_log_len);
+
+ wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR,
+ "core_dump_log", (char*)tarInfo->timeString);
+ wdc_WriteToFile(tarInfo->fileName, (char*)core_dump_log_buf, core_dump_log_len);
+
+ wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR,
+ "extended_log", (char*)tarInfo->timeString);
+ wdc_WriteToFile(tarInfo->fileName, (char*)extended_log_buf, extended_log_len);
+
+ /* Tar the log directory */
+ wdc_UtilsSnprintf(tarInfo->tarFileName, sizeof(tarInfo->tarFileName), "%s%s", (char*)tarInfo->bufferFolderPath, WDC_DE_TAR_FILE_EXTN);
+ wdc_UtilsSnprintf(tarInfo->tarFiles, sizeof(tarInfo->tarFiles), "%s%s%s", (char*)tarInfo->bufferFolderName, WDC_DE_PATH_SEPARATOR, WDC_DE_TAR_FILES);
+ wdc_UtilsSnprintf(tarInfo->tarCmd, sizeof(tarInfo->tarCmd), "%s %s %s", WDC_DE_TAR_CMD, (char*)tarInfo->tarFileName, (char*)tarInfo->tarFiles);
+
+ ret = system(tarInfo->tarCmd);
+
+ if (ret)
+ fprintf(stderr, "ERROR : WDC : Tar of log data failed, ret = %d\n", ret);
+
+free_buf:
+ free(tarInfo);
+ free(full_log_buf);
+ free(core_dump_log_buf);
+ free(key_log_buf);
+ free(extended_log_buf);
+ return ret;
+}
+
static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command,
struct plugin *plugin)
{
@@ -1111,6 +1375,8 @@ static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command
if ((capabilities & WDC_DRIVE_CAP_INTERNAL_LOG) == WDC_DRIVE_CAP_INTERNAL_LOG) {
snprintf(f + strlen(f), PATH_MAX, "%s", ".bin");
return wdc_do_cap_diag(fd, f, xfer_size);
+ } else if ((capabilities & WDC_SN730_CAP_VUC_LOG) == WDC_SN730_CAP_VUC_LOG) {
+ return wdc_do_sn730_get_and_tar(fd, f);
} else {
fprintf(stderr, "ERROR : WDC: unsupported device for this command\n");
return -1;
--
2.13.7

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
From dc26bb70d82569730b4ce5c88f22084812a2334d Mon Sep 17 00:00:00 2001
From: Breno Leitao <leitao@debian.org>
Date: Mon, 21 Jan 2019 06:31:15 -0500
Subject: [PATCH] Fix compilation with GCC-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Printf() is being called to print an unsigned long int using the long long
identifier. This causes the following error with GCC-8:
nvme.c:3056:5: error: format %llu expects argument of type long long unsigned int, but argument 3 has type __u64 {aka long unsigned int} [-Werror=format=]
"Invalid value for block size (%llu), must be a power of two\n",
^
nvme.c:3091:6: error: format %llu expects argument of type long long unsigned int, but argument 3 has type __u64 {aka long unsigned int} [-Werror=format=]
"LBAF corresponding to block size %llu (LBAF %u) not found\n",
Adjusting the printf arguments to print the proper format.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
nvme.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nvme.c b/nvme.c
index 992c6b9..e85834d 100644
--- a/nvme.c
+++ b/nvme.c
@@ -3053,7 +3053,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
if (cfg.bs) {
if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) {
fprintf(stderr,
- "Invalid value for block size (%llu), must be a power of two\n",
+ "Invalid value for block size (%lu), must be a power of two\n",
cfg.bs);
return EINVAL;
}
@@ -3088,7 +3088,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
}
if (cfg.lbaf == 0xff) {
fprintf(stderr,
- "LBAF corresponding to block size %llu (LBAF %u) not found\n",
+ "LBAF corresponding to block size %lu (LBAF %u) not found\n",
cfg.bs, lbads);
fprintf(stderr,
"Please correct block size, or specify LBAF directly\n");
--
2.13.7

View File

@ -0,0 +1,39 @@
From 254bcd6b23436fd929e18c935322410b541ca121 Mon Sep 17 00:00:00 2001
From: Breno Leitao <leitao@debian.org>
Date: Mon, 21 Jan 2019 07:03:24 -0500
Subject: [PATCH] Fix CFLAGS parameter
Currently nvme-cli 1.7 is not compiling on Debian because the Debian helper
(compilation toolkit) does pass a CFLAGS variable, thus, avoiding the
initial definition (CFLAGS ?= -O2 -g -Wall -Werror -I.)
The problem is that -I should not be removed, otherwise the code does not
compile, with the following bug:
cc -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D__CHECK_ENDIAN__ -g -O2 -fdebug-prefix-map=/home/breno/nvme/nvme-cli-1.7=. -fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 -DLIBUUID -DNVME_VERSION='"1.7"' -o plugins/intel/intel-nvme.o -c plugins/intel/intel-nvme.c
plugins/intel/intel-nvme.c:10:18: fatal error: nvme.h: No such file or directory
compilation terminated.
This patch just moves the -I parameter to part of the CFLAGS that is not
replaced by dh's CFLAGS.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 525616a..3a4e223 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-CFLAGS ?= -O2 -g -Wall -Werror -I.
-CFLAGS += -std=gnu99
+CFLAGS ?= -O2 -g -Wall -Werror
+CFLAGS += -std=gnu99 -I.
CPPFLAGS += -D_GNU_SOURCE -D__CHECK_ENDIAN__
LIBUUID = $(shell $(LD) -o /dev/null -luuid >/dev/null 2>&1; echo $$?)
NVME = nvme
--
2.13.7

View File

@ -0,0 +1,39 @@
From 97274c2cf573349e637b4a55c0045488206470ad Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Date: Fri, 25 Jan 2019 08:54:32 -0700
Subject: [PATCH] nvme-cli: fix compilation with uint64_t cast
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
nvme.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/nvme.c b/nvme.c
index e85834d..8922ec2 100644
--- a/nvme.c
+++ b/nvme.c
@@ -3053,8 +3053,8 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
if (cfg.bs) {
if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) {
fprintf(stderr,
- "Invalid value for block size (%lu), must be a power of two\n",
- cfg.bs);
+ "Invalid value for block size (%"PRIu64"), must be a power of two\n",
+ (uint64_t) cfg.bs);
return EINVAL;
}
}
@@ -3088,8 +3088,8 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
}
if (cfg.lbaf == 0xff) {
fprintf(stderr,
- "LBAF corresponding to block size %lu (LBAF %u) not found\n",
- cfg.bs, lbads);
+ "LBAF corresponding to block size %"PRIu64"(LBAF %u) not found\n",
+ (uint64_t)cfg.bs, lbads);
fprintf(stderr,
"Please correct block size, or specify LBAF directly\n");
return EINVAL;
--
2.13.7

View File

@ -0,0 +1,93 @@
From 6d827f7848212033ba2e560922a4b55bc323a1ef Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Mon, 14 Jan 2019 10:15:16 +0100
Subject: [PATCH] nvme_fc auto-connect scripts
References: bsc#1103354
Here's a set of script to enable FC-NVMe autoconnect, based on
the initial posting from James Smart.
FC-NVMe already generates an uevent whenever a new FC-NVMe remote
port is registered, so we can create an udev rule to parse this
event and start connecting to it.
The problem here is that the 'nvme connect' call might be taking
some time or might even stall altogether, so we cannot call it
directly from the udev rule. Rather, the udev rule starts a systemd
service, which then calls 'nvme connect' as a 'oneshot' program.
With this approach we are insulated from any stalls in udev rules.
Additionally we can implement a boot service to restart any missed
connections attempts.
Cc: James Smart <james.smart@broadcom.com>
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
nvme-fc-autoconnect/70-nvmefc-autoconnect.conf | 1 +
nvme-fc-autoconnect/70-nvmefc-autoconnect.rules | 8 ++++++++
nvme-fc-autoconnect/nvmefc-boot-connections.service | 9 +++++++++
nvme-fc-autoconnect/nvmefc-connect@.service | 14 ++++++++++++++
4 files changed, 32 insertions(+)
create mode 100644 nvme-fc-autoconnect/70-nvmefc-autoconnect.conf
create mode 100644 nvme-fc-autoconnect/70-nvmefc-autoconnect.rules
create mode 100644 nvme-fc-autoconnect/nvmefc-boot-connections.service
create mode 100644 nvme-fc-autoconnect/nvmefc-connect@.service
diff --git a/nvme-fc-autoconnect/70-nvmefc-autoconnect.conf b/nvme-fc-autoconnect/70-nvmefc-autoconnect.conf
new file mode 100644
index 0000000..b92d94f
--- /dev/null
+++ b/nvme-fc-autoconnect/70-nvmefc-autoconnect.conf
@@ -0,0 +1 @@
+install_items+="/usr/lib/udev/rules.d/70-nvmefc-autoconnect.rules"
diff --git a/nvme-fc-autoconnect/70-nvmefc-autoconnect.rules b/nvme-fc-autoconnect/70-nvmefc-autoconnect.rules
new file mode 100644
index 0000000..aa4f9bf
--- /dev/null
+++ b/nvme-fc-autoconnect/70-nvmefc-autoconnect.rules
@@ -0,0 +1,8 @@
+#
+# nvme_fc: udev event to automatically scan (via discovery controller)
+# new FC nvme remote ports and auto-connect to the subsystems they report.
+#
+
+ACTION=="change", SUBSYSTEM=="fc", ENV{FC_EVENT}=="nvmediscovery", \
+ ENV{NVMEFC_HOST_TRADDR}=="*", ENV{NVMEFC_TRADDR}=="*", \
+ RUN+="/usr/bin/systemctl --no-block start nvmefc-connect@--host-traddr=$env{NVMEFC_HOST_TRADDR}\\x20--traddr=$env{NVMEFC_TRADDR}.service"
diff --git a/nvme-fc-autoconnect/nvmefc-boot-connections.service b/nvme-fc-autoconnect/nvmefc-boot-connections.service
new file mode 100644
index 0000000..aa35c15
--- /dev/null
+++ b/nvme-fc-autoconnect/nvmefc-boot-connections.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Auto-connect to subsystems on FC-NVME devices during boot
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c "echo add > /sys/class/fc/fc_udev_device/nvme_discovery"
+
+[Install]
+WantedBy=default.target
diff --git a/nvme-fc-autoconnect/nvmefc-connect@.service b/nvme-fc-autoconnect/nvmefc-connect@.service
new file mode 100644
index 0000000..c2370d6
--- /dev/null
+++ b/nvme-fc-autoconnect/nvmefc-connect@.service
@@ -0,0 +1,14 @@
+#
+# Unit file used by 70-nvmefc-autoconnect.rules.
+#
+
+[Unit]
+Description=Auto-connect to subsystems on FC-NVME devices
+After=syslog.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c "/usr/sbin/nvme connect-all --transport=fc `/usr/bin/echo -e '%i'`"
+
+[Install]
+WantedBy=default.target
--
2.13.7

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5d6aefbed3793978cf5f78ea53cf3a49b23b45d8587b1e575970842bee124fcd
size 381171

3
nvme-cli-1.7.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bf2af491541cb3e8757ef22d95f2550a9ddc1073f085226a1c8827e43018ba86
size 369447

View File

@ -1,3 +1,392 @@
-------------------------------------------------------------------
Mon Jan 28 11:35:46 CET 2019 - hare@suse.de
- Update to version 1.7
- Drop obsolete patches:
- 0001-Use-tnvmcap-register-for-creating-namespace.patch
- 0002-don-t-execute-a-command-if-dry-run-is-supplied.patch
- 0003-Remove-trailing-n-so-that-the-output-is-valid-json.patch
- 0004-nvme-cli-remove-unnecessary-assignments.patch
- 0005-nvme-print.c-fix-ns-descs-JSON-output.patch
- 0006-nvme-cli-fix-typo-in-json_print_list_items.patch
- 0007-nvme-get-property-Add-documentation.patch
- 0008-fabrics-write-ctrl_loss_tmo-to-fabrics-device-on-con.patch
- 0009-fabrics-write-keep-alive-timeout-to-fabrics-device-o.patch
- 0010-nvme-models.c-search-for-pci.ids.patch
- 0011-nvme-cli-add-ns-write-protect-feature-support.patch
- 0012-nvme-cli-add-minimal-ana-log-page-support.patch
- 0013-nvme-cli-add-ana-log-documentation.patch
- 0014-Fix-print-format-specifier-for-64-bit.patch
- 0015-nvme-ana-log-fixup-compiler-warning-in-show_ana_log.patch
- 0016-nvme-vendor-fixup-c99-declaration-in-huawei-plugin.patch
- 0017-nvme-discover-sanitize-options.patch
- 0018-Fix-nvme-id-namespace-struct.patch
- 0019-nvme-cli-make-show_registers_cap-static.patch
- 0020-nvme-cli-wdc-plugin-mark-array-static-declaration.patch
- 0021-nvme-cli-fix-sparse-warnings-for-declaration.patch
- 0022-nvme-cli-don-t-use-unsigned-for-fd-in-lnvm-nvme.c.patch
- 0023-nvme-cli-remove-always-true-condition-for-u8.patch
- 0024-nvme-cli-fix-dead-code-nvmf-log-page-discovery.patch
- 0025-nvme-cli-code-cleanup-for-passthru-handlers.patch
- 0026-nvme-cli-fix-scaandir-return-value.patch
- 0027-nvme-cli-netapp-plugin-handle-empty-strings.patch
- 0028-nvme-cli-Fix-the-displayed-metadata-length-value-on-.patch
- 0029-nvme-list-fix-nvme-list-output-if-identify-failed-on.patch
- 0030-nvme-cli-use-uniform-error-message-for-open.patch
- 0031-nvme-cli-fix-indentation.patch
- 0032-nvme-cli-make-wdc-plug-in-functions-static.patch
- 0033-nvme-cli-mark-functions-static.patch
- 0034-nvme-cli-make-malloc-error-handling-uniform.patch
- 0035-Enlarge-local-char-so-snprintf-3-can-t-truncate-path.patch
- 0036-fabrics-make-some-arguments-integers.patch
- 0037-fabrics-don-t-fail-empty-discovery-log-page.patch
- 0038-nvme-commonize-subsystems-info-in-a-helper.patch
- 0039-fabrics-add-disconnect-all-command.patch
- 0040-Regen-documentation.patch
- 0041-attach-ns-fix-segfault-for-ctrl-list-wrong-input.patch
- 0042-nvme-discover-Retry-discovery-log-if-the-generation-.patch
- 0043-nvme-ioctl-retrieve-log-pages-in-4k-chunks.patch
- 0044-nvme-discover-Re-check-generation-counter-after-log-.patch
- 0045-seagate-nvme-fixup-coding-style.patch
- 0046-nvme-cli-Add-rae-argument-to-nvme_get_log.patch
- 0047-nvme-cli-kill-nvme_passthru_admin.patch
- 0048-nvme-cli-print-n-after-nvme-list-subsys-o-json.patch
- 0049-nvme-cli-tests-fix-fw_log-test-coding-style.patch
- 0050-nvme-cli-tests-fix-id_ctrl-test-coding-style.patch
- 0051-nvme-cli-tests-fix-id_ns-test-coding-style.patch
- 0052-nvme-cli-tests-Add-get_id_ctrl-function.patch
- 0054-Add-PCI-device-id-checking-for-the-WDC-plugin-comman.patch
- 0055-Fix-nvme-test-device-selection-to-use-controller-val.patch
- 0056-nvme-cli-prevent-resv-action-field-overflow.patch
- 0057-nvme-cli-report-subsystem-reset-not-supported-by-con.patch
- 0058-nvme-cli-fix-indentation-for-dir_-send-receive.patch
- 0059-nvme-cli-make-read-error-handling-uniform.patch
- 0060-Use-sys-ioctl.h-to-pull-in-definitions.patch
- 0061-Remove-unnecessary-asm-byteorder.h.patch
- 0062-Remove-unnecessary-linux-types.h-include.patch
- 0063-Include-libgen.h-for-basename-prototype.patch
- 0064-Include-sys-stat.h.patch
- 0065-nvme-cli-remove-endian.h.patch
- 0066-We-don-t-need-to-include-linux-types.h-here.patch
- 0067-Initialize-line.patch
- 0068-Use-standard-interfaces-to-get-timezone-offsets.patch
- 0069-nvme-cli-fix-ioctl-argument.patch
- 0070-nvme-cli-fix-a-typo.patch
- 0071-Enable-code-block-syntax-highlight-in-README.md.patch
- 0072-Makefile-fix-bash-completion-install-path.patch
- 0073-NVMe-CLI-WDC-Plugin-Simplify-the-device-id-checking-.patch
- 0074-nvme-cli-Add-wdc-plugin-command-vs-internal-log-and-.patch
- 0075-nvme-cli-Add-help-text-for-wdc-plugin-command-vs-int.patch
- 0076-Update-documentation.patch
- 0077-nvme.spec.in-fix-bash-completion-path-require.patch
- 0078-nvme-cli-wdc-plugin-Add-get-pfail-dump-command.patch
- 0079-nvme-cli-wdc-plugin-Add-documentation-for-pfail-dump.patch
- 0080-Re-gen-documentation-for-new-files.patch
- 0081-wdc-Fix-strncpy-warning.patch
- 0082-Refactor-plugins-in-a-file-hierarchy.patch
- 0083-nvme-cli-fix-sanitize-status-endianness.patch
- 0084-nvme-cli-fix-ana-log-endianness.patch
- 0085-wdc-Use-const-string-for-suffix.patch
- 0086-nvme-cli-fix-a-typo-in-SELF-TEST-log.patch
- 0087-nvme-cli-fix-a-typo.patch
- 0088-nvme-cli-fix-array-len-to-hold-string-of-size-4.patch
- 0089-nvme-cli-fix-endianness-for-the-structure-field.patch
- 0090-nvme-Handle-supported-capabilities-result-for-get-fe.patch
- 0091-connect-all-special-treatment-to-EALREADY-afetr-writ.patch
- 0092-Added-zsh-completion-installation.patch
- 0093-nvme-cli-fix-a-typo.patch
- 0094-nvme-fixup-ANA-group-descriptor-offset.patch
- 0095-nvme-introduce-get_nvme_ctrl_attr.patch
- 0096-nvme-print-out-controller-state-for-list-subsys.patch
- 0097-nvme-list-subsys-Add-device-name-argument-and-print-.patch
- 0098-list-subsys-Preserve-line-breaks-and-spaces.patch
- 0099-Regen-documentation.patch
- 0100-In-json-output-if-the-commands-add-zero-length-strin.patch
- 0101-Fix-printing-of-large-ANAGRPID-values.patch
- 0102-micron-nvme-Replace-direct-use-of-ioctl.patch
- 0104-Fix-typos-in-docs.patch
- 0105-Fix-typos-in-tests-and-utils.patch
- 0106-fabrics-support-fabrics-sq-flow-control-disable.patch
- 0107-fabrics-use-trtype_str-when-parsing-a-discovery-log-.patch
- 0108-nvme-Add-TCP-transport.patch
- 0109-fabrics-add-tcp-port-tsas-decoding.patch
- 0110-fabrics-add-transport-header-and-data-digest.patch
- 0111-nvme-ioctl-clear-rae-for-discovery-log-pages.patch
- 0112-Added-support-for-virtualization-management-command.patch
- 0113-nvme-cli-Don-t-print-result-on-passthru-error.patch
- 0114-nvme-cli-readme-fix-typo-in-Alpine-distro-support.patch
- 0115-Added-gentoo-to-README.md.patch
- 0116-fabrics-pass-in-number-of-write-queues.patch
- 0117-fabrics-pass-in-number-of-polling-queues.patch
- 0118-Update-documentation.patch
- 0119-README-update-Arch-Linux-install-instructions.patch
- 0120-fabrics-allow-nr_io-write-poll_queues-and-queue-size.patch
- 0121-nvme-Adding-a-block-size-selector-to-format.patch
- 0122-nvme-Regenerate-documentation.patch
- 0123-timeout-option-added-to-ns_create-delete-440.patch
- 0124-nvme-Remove-duplicate-error-message.patch
- Add patches from upstream git tree (FATE#326925)
+ 0001-wdc-Change-device-capability-checking.patch
+ 0002-wdc-Add-additional-device-for-vs-internal-log.patch
+ 0003-generate-new-documentation.patch
+ 0004-Fix-compilation-with-GCC-8.patch
+ 0005-Fix-CFLAGS-parameter.patch
+ 0006-nvme-cli-fix-compilation-with-uint64_t-cast.patch
- Add FC-NVMe autoconnect scripts (bsc#1103354)
+ 0100-nvme_fc-auto-connect-scripts.patch
-------------------------------------------------------------------
Thu Jan 10 08:52:57 CET 2019 - hare@suse.de
- Use tnvmcap register for creating namespace (FATE#326925)
+ 0001-Use-tnvmcap-register-for-creating-namespace.patch
- don't execute a command if --dry-run is supplied (FATE#326925)
+ 0002-don-t-execute-a-command-if-dry-run-is-supplied.patch
- Remove trailing "\n" so that the output is valid json (FATE#326925)
+ 0003-Remove-trailing-n-so-that-the-output-is-valid-json.patch
- nvme-cli: remove unnecessary assignments (FATE#326925)
+ 0004-nvme-cli-remove-unnecessary-assignments.patch
- nvme-print.c : fix ns-descs JSON output (FATE#326925)
+ 0005-nvme-print.c-fix-ns-descs-JSON-output.patch
- nvme-cli: fix typo in json_print_list_items (FATE#326925)
+ 0006-nvme-cli-fix-typo-in-json_print_list_items.patch
- nvme-get-property : Add documentation (FATE#326925)
+ 0007-nvme-get-property-Add-documentation.patch
- fabrics: write ctrl_loss_tmo to fabrics device on connect (FATE#326925)
+ 0008-fabrics-write-ctrl_loss_tmo-to-fabrics-device-on-con.patch
- fabrics: write keep-alive-timeout to fabrics device on (FATE#326925)
+ 0009-fabrics-write-keep-alive-timeout-to-fabrics-device-o.patch
- nvme-models.c - search for pci.ids (FATE#326925)
+ 0010-nvme-models.c-search-for-pci.ids.patch
- nvme-cli add ns write protect feature support (FATE#326925)
+ 0011-nvme-cli-add-ns-write-protect-feature-support.patch
- nvme-cli: add minimal ana-log page support (FATE#326925)
+ 0012-nvme-cli-add-minimal-ana-log-page-support.patch
- nvme-cli: add ana-log documentation (FATE#326925)
+ 0013-nvme-cli-add-ana-log-documentation.patch
- Fix print format specifier for 64-bit (FATE#326925)
+ 0014-Fix-print-format-specifier-for-64-bit.patch
- nvme-ana-log: fixup compiler warning in show_ana_log() (FATE#326925)
+ 0015-nvme-ana-log-fixup-compiler-warning-in-show_ana_log.patch
- nvme-vendor: fixup c99 declaration in huawei plugin (FATE#326925)
+ 0016-nvme-vendor-fixup-c99-declaration-in-huawei-plugin.patch
- nvme-discover: sanitize options (FATE#326925)
+ 0017-nvme-discover-sanitize-options.patch
- Fix nvme id namespace struct (FATE#326925)
+ 0018-Fix-nvme-id-namespace-struct.patch
- nvme-cli: make show_registers_cap() static (FATE#326925)
+ 0019-nvme-cli-make-show_registers_cap-static.patch
- nvme-cli: wdc-plugin mark array static declaration (FATE#326925)
+ 0020-nvme-cli-wdc-plugin-mark-array-static-declaration.patch
- nvme-cli: fix sparse warnings for declaration (FATE#326925)
+ 0021-nvme-cli-fix-sparse-warnings-for-declaration.patch
- nvme-cli: don't use unsigned for fd in lnvm-nvme.c (FATE#326925)
+ 0022-nvme-cli-don-t-use-unsigned-for-fd-in-lnvm-nvme.c.patch
- nvme-cli: remove always true condition for u8 (FATE#326925)
+ 0023-nvme-cli-remove-always-true-condition-for-u8.patch
- nvme-cli: fix dead-code nvmf log page discovery (FATE#326925)
+ 0024-nvme-cli-fix-dead-code-nvmf-log-page-discovery.patch
- nvme-cli: code cleanup for passthru() handlers (FATE#326925)
+ 0025-nvme-cli-code-cleanup-for-passthru-handlers.patch
- nvme-cli: fix scaandir() return value (FATE#326925)
+ 0026-nvme-cli-fix-scaandir-return-value.patch
- nvme-cli: netapp plugin handle empty strings (FATE#326925)
+ 0027-nvme-cli-netapp-plugin-handle-empty-strings.patch
- nvme-cli: Fix the displayed metadata length value on Big (FATE#326925)
+ 0028-nvme-cli-Fix-the-displayed-metadata-length-value-on-.patch
- nvme list : fix nvme list output if identify failed on device (FATE#326925)
+ 0029-nvme-list-fix-nvme-list-output-if-identify-failed-on.patch
- nvme-cli: use uniform error message for open (FATE#326925)
+ 0030-nvme-cli-use-uniform-error-message-for-open.patch
- nvme-cli: use uniform error message for open (FATE#326925)
+ 0030-nvme-cli-use-uniform-error-message-for-open.patch~
- nvme-cli: fix indentation (FATE#326925)
+ 0031-nvme-cli-fix-indentation.patch
- nvme-cli: make wdc plug-in functions static (FATE#326925)
+ 0032-nvme-cli-make-wdc-plug-in-functions-static.patch
- nvme-cli: mark functions static (FATE#326925)
+ 0033-nvme-cli-mark-functions-static.patch
- nvme-cli: make malloc error handling uniform (FATE#326925)
+ 0034-nvme-cli-make-malloc-error-handling-uniform.patch
- Enlarge local char[] so snprintf(3) can't truncate path. (FATE#326925)
+ 0035-Enlarge-local-char-so-snprintf-3-can-t-truncate-path.patch
- fabrics: make some arguments integers (FATE#326925)
+ 0036-fabrics-make-some-arguments-integers.patch
- fabrics: don't fail empty discovery log page (FATE#326925)
+ 0037-fabrics-don-t-fail-empty-discovery-log-page.patch
- nvme: commonize subsystems info in a helper (FATE#326925)
+ 0038-nvme-commonize-subsystems-info-in-a-helper.patch
- fabrics: add disconnect-all command (FATE#326925)
+ 0039-fabrics-add-disconnect-all-command.patch
- Regen documentation (FATE#326925)
+ 0040-Regen-documentation.patch
- attach-ns : fix segfault for ctrl list wrong input (FATE#326925)
+ 0041-attach-ns-fix-segfault-for-ctrl-list-wrong-input.patch
- nvme-discover: Retry discovery log if the generation counter (FATE#326925)
+ 0042-nvme-discover-Retry-discovery-log-if-the-generation-.patch
- nvme-ioctl: retrieve log pages in 4k chunks (FATE#326925)
+ 0043-nvme-ioctl-retrieve-log-pages-in-4k-chunks.patch
- nvme-discover: Re-check generation counter after log page (FATE#326925)
+ 0044-nvme-discover-Re-check-generation-counter-after-log-.patch
- seagate-nvme: fixup coding style (FATE#326925)
+ 0045-seagate-nvme-fixup-coding-style.patch
- nvme-cli: Add 'rae' argument to nvme_get_log() (FATE#326925)
+ 0046-nvme-cli-Add-rae-argument-to-nvme_get_log.patch
- nvme-cli: kill nvme_passthru_admin() (FATE#326925)
+ 0047-nvme-cli-kill-nvme_passthru_admin.patch
- nvme-cli: print "\n" after nvme list-subsys -o json (FATE#326925)
+ 0048-nvme-cli-print-n-after-nvme-list-subsys-o-json.patch
- nvme-cli: tests: fix fw_log test coding style (FATE#326925)
+ 0049-nvme-cli-tests-fix-fw_log-test-coding-style.patch
- nvme-cli: tests: fix id_ctrl test coding style (FATE#326925)
+ 0050-nvme-cli-tests-fix-id_ctrl-test-coding-style.patch
- nvme-cli: tests: fix id_ns test coding style (FATE#326925)
+ 0051-nvme-cli-tests-fix-id_ns-test-coding-style.patch
- nvme-cli: tests: Add get_id_ctrl function (FATE#326925)
+ 0052-nvme-cli-tests-Add-get_id_ctrl-function.patch
- Add PCI device id checking for the WDC plugin commands. (FATE#326925)
+ 0054-Add-PCI-device-id-checking-for-the-WDC-plugin-comman.patch
- Fix nvme test device selection to use controller value (FATE#326925)
+ 0055-Fix-nvme-test-device-selection-to-use-controller-val.patch
- nvme-cli: prevent resv action field overflow (FATE#326925)
+ 0056-nvme-cli-prevent-resv-action-field-overflow.patch
- nvme-cli: report subsystem-reset not supported by controller (FATE#326925)
+ 0057-nvme-cli-report-subsystem-reset-not-supported-by-con.patch
- nvme-cli: fix indentation for dir_[send/receive] (FATE#326925)
+ 0058-nvme-cli-fix-indentation-for-dir_-send-receive.patch
- nvme-cli: make read error handling uniform (FATE#326925)
+ 0059-nvme-cli-make-read-error-handling-uniform.patch
- Use sys/ioctl.h to pull in definitions. (FATE#326925)
+ 0060-Use-sys-ioctl.h-to-pull-in-definitions.patch
- Remove unnecessary asm/byteorder.h (FATE#326925)
+ 0061-Remove-unnecessary-asm-byteorder.h.patch
- Remove unnecessary linux/types.h include. (FATE#326925)
+ 0062-Remove-unnecessary-linux-types.h-include.patch
- Include libgen.h for basename prototype. (FATE#326925)
+ 0063-Include-libgen.h-for-basename-prototype.patch
- Include sys/stat.h (FATE#326925)
+ 0064-Include-sys-stat.h.patch
- nvme-cli: remove endian.h (FATE#326925)
+ 0065-nvme-cli-remove-endian.h.patch
- We don't need to include linux/types.h here. (FATE#326925)
+ 0066-We-don-t-need-to-include-linux-types.h-here.patch
- Initialize line. (FATE#326925)
+ 0067-Initialize-line.patch
- Use standard interfaces to get timezone offsets. (FATE#326925)
+ 0068-Use-standard-interfaces-to-get-timezone-offsets.patch
- nvme-cli: fix ioctl argument (FATE#326925)
+ 0069-nvme-cli-fix-ioctl-argument.patch
- nvme-cli: fix a typo (FATE#326925)
+ 0070-nvme-cli-fix-a-typo.patch
- Enable code block syntax highlight in README.md (FATE#326925)
+ 0071-Enable-code-block-syntax-highlight-in-README.md.patch
- Makefile: fix bash completion install path (FATE#326925)
+ 0072-Makefile-fix-bash-completion-install-path.patch
- NVMe-CLI WDC Plugin - Simplify the device id checking (FATE#326925)
+ 0073-NVMe-CLI-WDC-Plugin-Simplify-the-device-id-checking-.patch
- nvme-cli: Add wdc-plugin command vs-internal-log and update (FATE#326925)
+ 0074-nvme-cli-Add-wdc-plugin-command-vs-internal-log-and-.patch
- nvme-cli: Add help text for wdc-plugin command (FATE#326925)
+ 0075-nvme-cli-Add-help-text-for-wdc-plugin-command-vs-int.patch
- Update documentation (FATE#326925)
+ 0076-Update-documentation.patch
- nvme.spec.in : fix bash completion path, require (FATE#326925)
+ 0077-nvme.spec.in-fix-bash-completion-path-require.patch
- nvme-cli wdc plugin: Add get pfail dump command. (FATE#326925)
+ 0078-nvme-cli-wdc-plugin-Add-get-pfail-dump-command.patch
- nvme-cli wdc plugin: Add documentation for pfail dump. (FATE#326925)
+ 0079-nvme-cli-wdc-plugin-Add-documentation-for-pfail-dump.patch
- Re-gen documentation for new files (FATE#326925)
+ 0080-Re-gen-documentation-for-new-files.patch
- wdc: Fix strncpy warning (FATE#326925)
+ 0081-wdc-Fix-strncpy-warning.patch
- Refactor plugins in a file hierarchy (FATE#326925)
+ 0082-Refactor-plugins-in-a-file-hierarchy.patch
- nvme-cli: fix sanitize status endianness (FATE#326925)
+ 0083-nvme-cli-fix-sanitize-status-endianness.patch
- nvme-cli: fix ana-log endianness (FATE#326925)
+ 0084-nvme-cli-fix-ana-log-endianness.patch
- wdc: Use const string for suffix (FATE#326925)
+ 0085-wdc-Use-const-string-for-suffix.patch
- nvme-cli:fix a typo in SELF-TEST log (FATE#326925)
+ 0086-nvme-cli-fix-a-typo-in-SELF-TEST-log.patch
- nvme-cli: fix a typo (FATE#326925)
+ 0087-nvme-cli-fix-a-typo.patch
- nvme-cli: fix array len to hold string of size 4 (FATE#326925)
+ 0088-nvme-cli-fix-array-len-to-hold-string-of-size-4.patch
- nvme-cli: fix endianness for the structure field (FATE#326925)
+ 0089-nvme-cli-fix-endianness-for-the-structure-field.patch
- nvme: Handle supported capabilities result for get features (FATE#326925)
+ 0090-nvme-Handle-supported-capabilities-result-for-get-fe.patch
- connect-all: special treatment to EALREADY afetr write to (FATE#326925)
+ 0091-connect-all-special-treatment-to-EALREADY-afetr-writ.patch
- Added zsh completion installation (FATE#326925)
+ 0092-Added-zsh-completion-installation.patch
- nvme-cli: fix a typo (FATE#326925)
+ 0093-nvme-cli-fix-a-typo.patch
- nvme: fixup ANA group descriptor offset (FATE#326925)
+ 0094-nvme-fixup-ANA-group-descriptor-offset.patch
- nvme: introduce get_nvme_ctrl_attr() (FATE#326925)
+ 0095-nvme-introduce-get_nvme_ctrl_attr.patch
- nvme: print out controller state for 'list-subsys' (FATE#326925)
+ 0096-nvme-print-out-controller-state-for-list-subsys.patch
- nvme-list-subsys: Add device name argument and print out ANA (FATE#326925)
+ 0097-nvme-list-subsys-Add-device-name-argument-and-print-.patch
- list-subsys: Preserve line breaks and spaces (FATE#326925)
+ 0098-list-subsys-Preserve-line-breaks-and-spaces.patch
- Regen documentation (FATE#326925)
+ 0099-Regen-documentation.patch
- In json output, if the commands add zero length string, it (FATE#326123)
+ 0100-In-json-output-if-the-commands-add-zero-length-strin.patch
- Fix printing of large ANAGRPID values (FATE#326123)
+ 0101-Fix-printing-of-large-ANAGRPID-values.patch
- micron-nvme: Replace direct use of ioctl (FATE#326123)
+ 0102-micron-nvme-Replace-direct-use-of-ioctl.patch
- Fix printing of large ANAGRPID values (FATE#326123)
+ 0103-Fix-printing-of-large-ANAGRPID-values.patch
- Fix typos in docs (FATE#326123)
+ 0104-Fix-typos-in-docs.patch
- Fix typos in tests and utils (FATE#326123)
+ 0105-Fix-typos-in-tests-and-utils.patch
- fabrics: support fabrics sq flow control disable (FATE#326123)
+ 0106-fabrics-support-fabrics-sq-flow-control-disable.patch
- fabrics: use trtype_str when parsing a discovery log entry (FATE#326123)
+ 0107-fabrics-use-trtype_str-when-parsing-a-discovery-log-.patch
- nvme: Add TCP transport (FATE#326123)
+ 0108-nvme-Add-TCP-transport.patch
- fabrics: add tcp port tsas decoding (FATE#326123)
+ 0109-fabrics-add-tcp-port-tsas-decoding.patch
- fabrics: add transport header and data digest (FATE#326123)
+ 0110-fabrics-add-transport-header-and-data-digest.patch
- nvme-ioctl: clear rae for discovery log pages (FATE#326123)
+ 0111-nvme-ioctl-clear-rae-for-discovery-log-pages.patch
- Added support for virtualization-management command (FATE#326123)
+ 0112-Added-support-for-virtualization-management-command.patch
- nvme-cli: Don't print result on passthru error (FATE#326123)
+ 0113-nvme-cli-Don-t-print-result-on-passthru-error.patch
- nvme-cli: readme: fix typo in Alpine distro support (FATE#326123)
+ 0114-nvme-cli-readme-fix-typo-in-Alpine-distro-support.patch
- Added gentoo to README.md (FATE#326123)
+ 0115-Added-gentoo-to-README.md.patch
- fabrics: pass in number of write queues (FATE#326123)
+ 0116-fabrics-pass-in-number-of-write-queues.patch
- fabrics: pass in number of polling queues (FATE#326123)
+ 0117-fabrics-pass-in-number-of-polling-queues.patch
- Update documentation (FATE#326123)
+ 0118-Update-documentation.patch
- README: update Arch Linux install instructions (FATE#326123)
+ 0119-README-update-Arch-Linux-install-instructions.patch
- fabrics: allow nr_io/write/poll_queues and queue size to (FATE#326123)
+ 0120-fabrics-allow-nr_io-write-poll_queues-and-queue-size.patch
- nvme: Adding a block size selector to format (FATE#326123)
+ 0121-nvme-Adding-a-block-size-selector-to-format.patch
- nvme: Regenerate documentation (FATE#326123)
+ 0122-nvme-Regenerate-documentation.patch
- timeout option added to ns_create/delete (#440) (FATE#326123)
+ 0123-timeout-option-added-to-ns_create-delete-440.patch
- nvme: Remove duplicate error message (FATE#326123)
+ 0124-nvme-Remove-duplicate-error-message.patch
-------------------------------------------------------------------
Tue Oct 16 07:29:31 UTC 2018 - jthumshirn@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package nvme-cli
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,13 +17,20 @@
Name: nvme-cli
Version: 1.6
Version: 1.7
Release: 0
Summary: NVM Express user space tools
License: GPL-2.0-only
Group: Hardware/Other
Url: https://github.com/linux-nvme/nvme-cli
Source: %{name}-%{version}.tar.gz
Patch1: 0001-wdc-Change-device-capability-checking.patch
Patch2: 0002-wdc-Add-additional-device-for-vs-internal-log.patch
Patch3: 0003-generate-new-documentation.patch
Patch4: 0004-Fix-compilation-with-GCC-8.patch
Patch5: 0005-Fix-CFLAGS-parameter.patch
Patch6: 0006-nvme-cli-fix-compilation-with-uint64_t-cast.patch
Patch100: 0100-nvme_fc-auto-connect-scripts.patch
BuildRequires: asciidoc
BuildRequires: libuuid-devel
BuildRequires: xmlto
@ -37,15 +44,30 @@ dependencies.
%prep
%setup -q -n %{name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch100 -p1
%build
echo %{version} > version
make CFLAGS="%{optflags}" PREFIX=%{_prefix} %{?_smp_mflags} all
make CFLAGS="%{optflags} -I." PREFIX=%{_prefix} %{?_smp_mflags} all
%install
make PREFIX=%{_prefix} DESTDIR=%{buildroot} install-bin install-man %{?_smp_mflags}
install -m 644 -D /dev/null %{buildroot}%{_sysconfdir}/nvme/hostnqn
install -m 644 -D completions/bash-nvme-completion.sh %{buildroot}%{_sysconfdir}/bash_completion.d/nvme
install -m 644 -D nvme-fc-autoconnect/70-nvmefc-autoconnect.rules %{buildroot}%{_udevrulesdir}/70-nvmefc-autoconnect.rules
install -m 644 -D nvme-fc-autoconnect/nvmefc-boot-connections.service %{buildroot}%{_unitdir}/nvmefc-boot-connections.service
install -m 644 -D nvme-fc-autoconnect/nvmefc-connect@.service %{buildroot}%{_unitdir}/nvmefc-connect@.service
%define services nvmefc-boot-connections.service
%pre
%service_add_pre %services
%post
if [ ! -e %{_sysconfdir}/nvme/hostnqn ]; then
@ -54,6 +76,13 @@ fi
if [ ! -e %{_sysconfdir}/nvme/hostid ]; then
%{_bindir}/uuidgen > %{_sysconfdir}/nvme/hostid
fi
%service_add_post %services
%preun
%service_del_preun %services nvmefc-connect@.service
%postun
%service_del_postun %services nvmefc-connect@.service
%files
%defattr(-,root,root)
@ -62,6 +91,9 @@ fi
%{_mandir}/man1/nvme*.1*
%dir %{_sysconfdir}/bash_completion.d/
%{_sysconfdir}/bash_completion.d/nvme
%{_udevrulesdir}/70-nvmefc-autoconnect.rules
%{_unitdir}/nvmefc-boot-connections.service
%{_unitdir}/nvmefc-connect@.service
%dir %{_sysconfdir}/nvme/
%ghost %{_sysconfdir}/nvme/hostnqn
%ghost %{_sysconfdir}/nvme/hostid