cluster: RHEL6 - fencing: Method to cause one node to delay fencing

Marek Grác marx at fedoraproject.org
Mon Oct 25 16:32:15 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c43ed4d1cf583273b34866a1815ddf831fc3161d
Commit:        c43ed4d1cf583273b34866a1815ddf831fc3161d
Parent:        f7c91de9fdfa688837e3df200b92c894a025de24
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Mon Aug 2 15:51:23 2010 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Mon Oct 25 18:25:22 2010 +0200

fencing: Method to cause one node to delay fencing

Patch to fencing library

Resolves: rhbz#614046
---
 fence/agents/lib/fencing.py.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 88bb1a1..4f8cbdc 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -63,6 +63,12 @@ all_opt = {
 		"required" : "0",
 		"shortdesc" : "Write debug information to given file",
 		"order" : 52 },
+	"delay" : {
+		"getopt" : "f:",
+		"longopt" : "delay",
+		"help" : "--delay <seconds>              Wait X seconds before fencing is started",
+		"default" : "0",
+		"order" : 200 },
 	"agent"   : {
 		"getopt" : "",
 		"help" : "",
@@ -373,7 +379,7 @@ all_opt = {
 		"order" : 200 }
 }
 
-common_opt = [ "retry_on" ]
+common_opt = [ "retry_on", "delay" ]
 
 class fspawn(pexpect.spawn):
 	def log_expect(self, options, pattern, timeout):
@@ -606,7 +612,7 @@ def check_input(device_opt, opt):
 	##
 	## Add options which are available for every fence agent
 	#####
-	device_opt.extend(common_opt)
+	device_opt.extend([x for x in common_opt if device_opt.count(x) == 0])
 	
 	options = dict(opt)
 	options["device_opt"] = device_opt
@@ -750,6 +756,8 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 				print o + options["-C"] + alias	
 		return
 
+	if options["-o"] in ["off", "reboot"]:
+		time.sleep(int(options["-f"]))
 	status = get_power_fn(tn, options)
 
 	if status != "on" and status != "off":  


More information about the cluster-commits mailing list