File 0001-low-hb_report-collect-output-of-sbd-dump-and-sbd-lis.patch of Package crmsh.12576

From 1e88d5bf4060ce3ac99e11aef8de402f809c66b0 Mon Sep 17 00:00:00 2001
From: liangxin1300 <XLiang@suse.com>
Date: Wed, 20 Mar 2019 13:50:58 +0800
Subject: [PATCH 1/4] low: hb_report: collect output of "sbd dump" and "sbd
 list"(bsc#1129383)

---
 hb_report/constants.py |  1 +
 hb_report/utillib.py   | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/hb_report/constants.py b/hb_report/constants.py
index 9ca50c37..5f1276ca 100644
--- a/hb_report/constants.py
+++ b/hb_report/constants.py
@@ -139,5 +139,6 @@ SYSINFO_F = "sysinfo.txt"
 SYSSTATS_F = "sysstats.txt"
 TIME_F = "time.txt"
 OCFS2_F = "ocfs2.txt"
+SBD_F = "sbd.txt"
 
 # vim:ts=4:sw=4:et:
diff --git a/hb_report/utillib.py b/hb_report/utillib.py
index 244b3c4f..9612abc1 100644
--- a/hb_report/utillib.py
+++ b/hb_report/utillib.py
@@ -1467,6 +1467,16 @@ def sbd_info():
     if os.path.exists(constants.SBDCONF):
         shutil.copy2(constants.SBDCONF, constants.WORKDIR)
 
+    if not which("sbd"):
+        return
+    sbd_f = os.path.join(constants.WORKDIR, constants.SBD_F)
+    cmd = ". {};export SBD_DEVICE;{};{}".format(constants.SBDCONF, "sbd dump", "sbd list")
+    with open(sbd_f, "w") as f:
+        _, out = crmutils.get_stdout(cmd)
+        f.write("\n\n#=====[ Command ] ==========================#\n")
+        f.write("# %s\n"%(cmd))
+        f.write(out)
+
 
 def sed_inplace(filename, pattern, repl):
     out_string = ""
-- 
2.22.1

openSUSE Build Service is sponsored by