Blob Blame History Raw
From 5c8cf5613f9371b53d1aab6f97db99bdbf9db4b4 Mon Sep 17 00:00:00 2001
From: John Ruemker <jruemker@redhat.com>
Date: Tue, 22 Sep 2015 18:02:37 -0400
Subject: [PATCH 2/4] fence_scsi: Offer hard-reboot option for fence_scsi_check
 script

The existing implementation of fence_scsi_check returns an error if any
device is no longer registered properly, and this error return causes
watchdog to use its custom procedure to reboot the host.  This procedure
is prone to blocking, especially when GFS2 file systems are mounted or
multipath devices are configured to queue indefinitely, so having the
check be able to hard-reboot the host instead of returning a failure
gives a means for avoiding these blockages.
---
 fence/agents/scsi/fence_scsi.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fence/agents/scsi/fence_scsi.py b/fence/agents/scsi/fence_scsi.py
index 8680828..ff34721 100644
--- a/fence/agents/scsi/fence_scsi.py
+++ b/fence/agents/scsi/fence_scsi.py
@@ -379,7 +379,7 @@ def scsi_check_get_verbose():
 	return bool(match)
 
 
-def scsi_check():
+def scsi_check(hardreboot=False):
 	if len(sys.argv) >= 3 and sys.argv[1] == "repair":
 		return int(sys.argv[2])
 	options = {}
@@ -403,6 +403,9 @@ def scsi_check():
 		else:
 			logging.debug("key " + key + " not registered with device " + dev)
 	logging.debug("key " + key + " registered with any devices")
+
+	if hardreboot == True:
+		os.system("reboot -f")
 	return 2
 
 
@@ -423,6 +426,8 @@ def main():
 	#fence_scsi_check
 	if os.path.basename(sys.argv[0]) == "fence_scsi_check.pl":
 		sys.exit(scsi_check())
+	elif os.path.basename(sys.argv[0]) == "fence_scsi_check_hardreboot":
+		sys.exit(scsi_check(True))
 
 	options = check_input(device_opt, process_input(device_opt))
 
-- 
2.4.3