Blame SOURCES/bz1475318-02-rfe-validate-nodes-watchdog-device-by-using-sbd.patch

be1b1f
From e66477b89b6a0ffbb9220c1a384c2a283dddcf17 Mon Sep 17 00:00:00 2001
be1b1f
From: Ondrej Mular <omular@redhat.com>
be1b1f
Date: Thu, 23 Aug 2018 14:49:05 +0200
be1b1f
Subject: [PATCH] squash bz1475318 RFE: Validate node's watchdog dev
be1b1f
be1b1f
6ae0b56ea1d9 fix watchdog device test error message
be1b1f
be1b1f
3685516072c8 Mark all watchdogs listed by SBD as supported
be1b1f
---
be1b1f
 pcs/lib/sbd.py |  6 +++---
be1b1f
 pcs/stonith.py | 22 +++++-----------------
be1b1f
 pcsd/remote.rb |  5 ++++-
be1b1f
 3 files changed, 12 insertions(+), 21 deletions(-)
be1b1f
be1b1f
diff --git a/pcs/lib/sbd.py b/pcs/lib/sbd.py
be1b1f
index caf86a18..0e7f5b92 100644
be1b1f
--- a/pcs/lib/sbd.py
be1b1f
+++ b/pcs/lib/sbd.py
be1b1f
@@ -302,10 +302,10 @@ def test_watchdog(cmd_runner, watchdog=None):
be1b1f
     cmd = [settings.sbd_binary, "test-watchdog"]
be1b1f
     if watchdog:
be1b1f
         cmd.extend(["-w", watchdog])
be1b1f
-    dummy_std_out, std_err, ret_val = cmd_runner.run(cmd)
be1b1f
+    std_out, dummy_std_err, ret_val = cmd_runner.run(cmd)
be1b1f
     if ret_val:
be1b1f
-        if "Multiple watchdog devices discovered" in std_err:
be1b1f
+        if "Multiple watchdog devices discovered" in std_out:
be1b1f
             raise LibraryError(reports.sbd_watchdog_test_multiple_devices())
be1b1f
-        raise LibraryError(reports.sbd_watchdog_test_error(std_err))
be1b1f
+        raise LibraryError(reports.sbd_watchdog_test_error(std_out))
be1b1f
     else:
be1b1f
         raise LibraryError(reports.sbd_watchdog_test_failed())
be1b1f
diff --git a/pcs/stonith.py b/pcs/stonith.py
be1b1f
index cc805da8..707321ca 100644
be1b1f
--- a/pcs/stonith.py
be1b1f
+++ b/pcs/stonith.py
be1b1f
@@ -503,25 +503,13 @@ def sbd_watchdog_list(lib, argv, modifiers):
be1b1f
         raise CmdLineInputError()
be1b1f
 
be1b1f
     available_watchdogs = lib.sbd.get_local_available_watchdogs()
be1b1f
-    supported_watchdog_list = [
be1b1f
-        wd for wd, wd_info in available_watchdogs.items()
be1b1f
-        if wd_info["caution"] is None
be1b1f
-    ]
be1b1f
-    unsupported_watchdog_list = [
be1b1f
-        wd for wd in available_watchdogs
be1b1f
-        if wd not in supported_watchdog_list
be1b1f
-    ]
be1b1f
-
be1b1f
-    if supported_watchdog_list:
be1b1f
-        print("Supported watchdog(s):")
be1b1f
-        for watchdog in supported_watchdog_list:
be1b1f
-            print("  {}".format(watchdog))
be1b1f
 
be1b1f
-    if unsupported_watchdog_list:
be1b1f
-        print("Unsupported watchdog(s):")
be1b1f
-        for watchdog in unsupported_watchdog_list:
be1b1f
+    if available_watchdogs:
be1b1f
+        print("Available watchdog(s):")
be1b1f
+        for watchdog in sorted(available_watchdogs.keys()):
be1b1f
             print("  {}".format(watchdog))
be1b1f
-
be1b1f
+    else:
be1b1f
+        print("No available watchdog")
be1b1f
 
be1b1f
 def sbd_watchdog_list_json(lib, argv, modifiers):
be1b1f
     if argv:
be1b1f
diff --git a/pcsd/remote.rb b/pcsd/remote.rb
be1b1f
index 27af41b2..a74f28f5 100644
be1b1f
--- a/pcsd/remote.rb
be1b1f
+++ b/pcsd/remote.rb
be1b1f
@@ -2408,7 +2408,10 @@ def check_sbd(param, request, auth_user)
be1b1f
         :path => watchdog,
be1b1f
         :exist => exists,
be1b1f
         :is_supported => (
be1b1f
-          exists and available_watchdogs[watchdog]['caution'] == nil
be1b1f
+          # this method is not reliable so all watchdog devices listed by SBD
be1b1f
+          # will be listed as supported for now
be1b1f
+          # exists and available_watchdogs[watchdog]['caution'] == nil
be1b1f
+          exists
be1b1f
         ),
be1b1f
       }
be1b1f
     rescue JSON::ParserError
be1b1f
-- 
be1b1f
2.13.6
be1b1f