Blame SOURCES/bz1265426-2-fence_scsi_hard.patch

e4ffb1
From 5c8cf5613f9371b53d1aab6f97db99bdbf9db4b4 Mon Sep 17 00:00:00 2001
e4ffb1
From: John Ruemker <jruemker@redhat.com>
e4ffb1
Date: Tue, 22 Sep 2015 18:02:37 -0400
e4ffb1
Subject: [PATCH 2/4] fence_scsi: Offer hard-reboot option for fence_scsi_check
e4ffb1
 script
e4ffb1
e4ffb1
The existing implementation of fence_scsi_check returns an error if any
e4ffb1
device is no longer registered properly, and this error return causes
e4ffb1
watchdog to use its custom procedure to reboot the host.  This procedure
e4ffb1
is prone to blocking, especially when GFS2 file systems are mounted or
e4ffb1
multipath devices are configured to queue indefinitely, so having the
e4ffb1
check be able to hard-reboot the host instead of returning a failure
e4ffb1
gives a means for avoiding these blockages.
e4ffb1
---
e4ffb1
 fence/agents/scsi/fence_scsi.py | 7 ++++++-
e4ffb1
 1 file changed, 6 insertions(+), 1 deletion(-)
e4ffb1
e4ffb1
diff --git a/fence/agents/scsi/fence_scsi.py b/fence/agents/scsi/fence_scsi.py
e4ffb1
index 8680828..ff34721 100644
e4ffb1
--- a/fence/agents/scsi/fence_scsi.py
e4ffb1
+++ b/fence/agents/scsi/fence_scsi.py
e4ffb1
@@ -379,7 +379,7 @@ def scsi_check_get_verbose():
e4ffb1
 	return bool(match)
e4ffb1
 
e4ffb1
 
e4ffb1
-def scsi_check():
e4ffb1
+def scsi_check(hardreboot=False):
e4ffb1
 	if len(sys.argv) >= 3 and sys.argv[1] == "repair":
e4ffb1
 		return int(sys.argv[2])
e4ffb1
 	options = {}
e4ffb1
@@ -403,6 +403,9 @@ def scsi_check():
e4ffb1
 		else:
e4ffb1
 			logging.debug("key " + key + " not registered with device " + dev)
e4ffb1
 	logging.debug("key " + key + " registered with any devices")
e4ffb1
+
e4ffb1
+	if hardreboot == True:
e4ffb1
+		os.system("reboot -f")
e4ffb1
 	return 2
e4ffb1
 
e4ffb1
 
e4ffb1
@@ -423,6 +426,8 @@ def main():
e4ffb1
 	#fence_scsi_check
e4ffb1
 	if os.path.basename(sys.argv[0]) == "fence_scsi_check.pl":
e4ffb1
 		sys.exit(scsi_check())
e4ffb1
+	elif os.path.basename(sys.argv[0]) == "fence_scsi_check_hardreboot":
e4ffb1
+		sys.exit(scsi_check(True))
e4ffb1
 
e4ffb1
 	options = check_input(device_opt, process_input(device_opt))
e4ffb1
 
e4ffb1
-- 
e4ffb1
2.4.3
e4ffb1