Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > d236c5da97a239a1b6991cfba2865b66 > files > 59

cman-2.0.115-68.el5_6.1.src.rpm

From 5215e29266b95f1492428b296e7232c7afe1237a Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Wed, 11 Nov 2009 15:01:19 +0100
Subject: [PATCH] fencing: Unable to power on machine after applying patch

Problem introduced by:

    commit 45ed9fd03c0718252f2ae418ffa7161198aa4688
    Author: Marek 'marx' Grac <mgrac@redhat.com>
    Date:   Fri Nov 6 14:13:02 2009 +0100

        fencing: New option --retry-on <N>
---
 fence/agents/lib/fencing.py.py |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 4aa3224..d37498f 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -356,6 +356,8 @@ all_opt = {
 		"order" : 200 }
 }
 
+common_opt = [ "retry_on" ]
+
 class fspawn(pexpect.spawn):
 	def log_expect(self, options, pattern, timeout):
 		result = self.expect(pattern, timeout)
@@ -466,6 +468,12 @@ def metadata(avail_opt, options, docs):
 
 def process_input(avail_opt):
 	global all_opt
+	global common_opt
+
+	##
+	## Add options which are available for every fence agent
+	#####
+	avail_opt.extend(common_opt)
 
 	##
 	## Set standard environment
@@ -565,11 +573,12 @@ def process_input(avail_opt):
 ######
 def check_input(device_opt, opt):
 	global all_opt
+	global common_opt
 
 	##
 	## Add options which are available for every fence agent
 	#####
-	device_opt.append("retry_on")
+	device_opt.extend(common_opt)
 	
 	options = dict(opt)
 	options["device_opt"] = device_opt
@@ -727,7 +736,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 			print "Success: Already ON"
 		else:
 			power_on = False
-			for i in range(1,int(options["-F"])):
+			for i in range(1,1 + int(options["-F"])):
 				set_power_fn(tn, options)
 				time.sleep(int(options["-G"]))
 				if wait_power_status(tn, options, get_power_fn):
@@ -758,7 +767,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 		options["-o"] = "on"
 
 		power_on = False
-		for i in range(1,int(options["-F"])):
+		for i in range(1,1 + int(options["-F"])):
 			set_power_fn(tn, options)
 			time.sleep(int(options["-G"]))
 			if wait_power_status(tn, options, get_power_fn) == 1:
-- 
1.6.0.6