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

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