Blob Blame History Raw
From 2a2aa2d03bc456ce1fa869fa54398c89956e409a Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Thu, 16 Jul 2015 09:26:32 +0200
Subject: [PATCH 1/2] fencing: Add option that forces ON even if machine is
 already ON

This feature is required for fence_scsi when we have to do unfencing after reboot even
if node was not fenced at all. Keys for SCSI are stored in /var/run/cluster and so they
have to re-created.
---
 fence/agents/lib/fencing.py.py  | 9 +++++++--
 fence/agents/scsi/fence_scsi.py | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 2ba98b8..377c63f 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -82,6 +82,10 @@ all_opt = {
 		"getopt" : "",
 		"help" : "",
 		"order" : 1},
+	"force_on" : {
+		"getopt" : "",
+		"help" : "",
+		"order" : 1},
 	"action" : {
 		"getopt" : "o:",
 		"longopt" : "action",
@@ -949,8 +953,9 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list=None,
 			fail(EC_STATUS)
 
 		if options["--action"] == status:
-			print "Success: Already %s" % (status.upper())
-			return 0
+			if not (status == "on" and "force_on" in options["device_opt"]):
+				print "Success: Already %s" % (status.upper())
+				return 0
 
 		if options["--action"] == "on":
 			if set_multi_power_fn(tn, options, set_power_fn, get_power_fn, 1 + int(options["--retry-on"])):
diff --git a/fence/agents/scsi/fence_scsi.py b/fence/agents/scsi/fence_scsi.py
index f373e6b..445c5f8 100644
--- a/fence/agents/scsi/fence_scsi.py
+++ b/fence/agents/scsi/fence_scsi.py
@@ -396,7 +396,7 @@ def main():
 
 	device_opt = ["no_login", "no_password", "devices", "nodename", "key",\
 	"aptpl", "fabric_fencing", "on_target", "corosync-cmap_path",\
-	"sg_persist_path", "sg_turs_path", "logfile", "vgs_path"]
+	"sg_persist_path", "sg_turs_path", "logfile", "vgs_path", "force_on"]
 
 	define_new_opts()
 
-- 
1.9.3