Blame SOURCES/bz1265426-2-fence_scsi_hard.patch

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