Blame SOURCES/bz1243485-1-fence_scsi-force-on.patch

97f65f
From 2a2aa2d03bc456ce1fa869fa54398c89956e409a Mon Sep 17 00:00:00 2001
97f65f
From: Marek 'marx' Grac <mgrac@redhat.com>
97f65f
Date: Thu, 16 Jul 2015 09:26:32 +0200
97f65f
Subject: [PATCH 1/2] fencing: Add option that forces ON even if machine is
97f65f
 already ON
97f65f
97f65f
This feature is required for fence_scsi when we have to do unfencing after reboot even
97f65f
if node was not fenced at all. Keys for SCSI are stored in /var/run/cluster and so they
97f65f
have to re-created.
97f65f
---
97f65f
 fence/agents/lib/fencing.py.py  | 9 +++++++--
97f65f
 fence/agents/scsi/fence_scsi.py | 2 +-
97f65f
 2 files changed, 8 insertions(+), 3 deletions(-)
97f65f
97f65f
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
97f65f
index 2ba98b8..377c63f 100644
97f65f
--- a/fence/agents/lib/fencing.py.py
97f65f
+++ b/fence/agents/lib/fencing.py.py
97f65f
@@ -82,6 +82,10 @@ all_opt = {
97f65f
 		"getopt" : "",
97f65f
 		"help" : "",
97f65f
 		"order" : 1},
97f65f
+	"force_on" : {
97f65f
+		"getopt" : "",
97f65f
+		"help" : "",
97f65f
+		"order" : 1},
97f65f
 	"action" : {
97f65f
 		"getopt" : "o:",
97f65f
 		"longopt" : "action",
97f65f
@@ -949,8 +953,9 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list=None,
97f65f
 			fail(EC_STATUS)
97f65f
 
97f65f
 		if options["--action"] == status:
97f65f
-			print "Success: Already %s" % (status.upper())
97f65f
-			return 0
97f65f
+			if not (status == "on" and "force_on" in options["device_opt"]):
97f65f
+				print "Success: Already %s" % (status.upper())
97f65f
+				return 0
97f65f
 
97f65f
 		if options["--action"] == "on":
97f65f
 			if set_multi_power_fn(tn, options, set_power_fn, get_power_fn, 1 + int(options["--retry-on"])):
97f65f
diff --git a/fence/agents/scsi/fence_scsi.py b/fence/agents/scsi/fence_scsi.py
97f65f
index f373e6b..445c5f8 100644
97f65f
--- a/fence/agents/scsi/fence_scsi.py
97f65f
+++ b/fence/agents/scsi/fence_scsi.py
97f65f
@@ -396,7 +396,7 @@ def main():
97f65f
 
97f65f
 	device_opt = ["no_login", "no_password", "devices", "nodename", "key",\
97f65f
 	"aptpl", "fabric_fencing", "on_target", "corosync-cmap_path",\
97f65f
-	"sg_persist_path", "sg_turs_path", "logfile", "vgs_path"]
97f65f
+	"sg_persist_path", "sg_turs_path", "logfile", "vgs_path", "force_on"]
97f65f
 
97f65f
 	define_new_opts()
97f65f
 
97f65f
-- 
97f65f
1.9.3
97f65f