File s390-tools-sles15sp1-dbginfo-gather-nvme-related-data.patch of Package s390-tools.14220

Subject: dbginfo: gather nvme related data
From: Sebastian Ott <sebott@linux.ibm.com>

Summary:     s390-tools/dbginfo: Collect NVMe-related debug data
Description: Collect SMART (Self-Monitoring, Analysis and Reporting Technology)
             data in dbginfo.sh .
Upstream-ID: b9e47e356bbfc92e41b758e74606baacbab33ee4
Problem-ID:  RAS1702

Upstream-Description:

             dbginfo: gather nvme related data

             Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
             Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>


Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
---
 scripts/dbginfo.sh |   26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

--- a/scripts/dbginfo.sh
+++ b/scripts/dbginfo.sh
@@ -182,11 +182,14 @@ readonly OUTPUT_FILE_XML="${WORKPATH}dom
 # File that includes the docker inspect output
 readonly OUTPUT_FILE_DOCKER="${WORKPATH}docker_inspect.out"
 
+# File that includes nvme related information
+readonly OUTPUT_FILE_NVME="${WORKPATH}nvme.out"
+
 # Mount point of the debug file system
 readonly MOUNT_POINT_DEBUGFS="/sys/kernel/debug"
 
 # The amount of steps running the whole collections
-readonly COLLECTION_COUNT=11
+readonly COLLECTION_COUNT=12
 
 # The kernel version (e.g. '2' from 2.6.32 or '3' from 3.2.1)
 readonly KERNEL_VERSION=$(uname -r 2>/dev/null | cut -d'.' -f1)
@@ -829,6 +832,25 @@ collect_docker() {
 }
 
 ########################################
+collect_nvme() {
+    local NVME
+
+    pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Collecting nvme output"
+    call_run_command "nvme list" "${OUTPUT_FILE_NVME}"
+
+    for NVME in /dev/nvme[0-9]*; do
+	if [ -c $NVME ]; then
+	    call_run_command "smartctl -x $NVME" "${OUTPUT_FILE_NVME}"
+	    call_run_command "nvme fw-log $NVME" "${OUTPUT_FILE_NVME}"
+	    call_run_command "nvme smart-log $NVME" "${OUTPUT_FILE_NVME}"
+	    call_run_command "nvme error-log $NVME" "${OUTPUT_FILE_NVME}"
+	fi
+    done
+
+    pr_log_stdout " "
+}
+
+########################################
 post_processing() {
     local file_mtime
     local file_mtime_epoche
@@ -1120,6 +1142,8 @@ collect_domain_xml
 
 collect_docker
 
+collect_nvme
+
 post_processing
 
 create_package
openSUSE Build Service is sponsored by