This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RHEL5 - [fence] WTI should not power on/off plug if it is unable toget status


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=71c6153b1cdcca74b4c4f21b623deba233c2f1c6
Commit:        71c6153b1cdcca74b4c4f21b623deba233c2f1c6
Parent:        ae8bd1b0fe749b8c4af6de77b423c9be3c3653e9
Author:        Marek 'marx' Grac <mgrac@redhat.com>
AuthorDate:    Wed Oct 29 16:20:39 2008 +0100
Committer:     Marek 'marx' Grac <mgrac@redhat.com>
CommitterDate: Wed Oct 29 16:29:18 2008 +0100

[fence] WTI should not power on/off plug if it is unable to get status

Fix #468904. On some WTI devices plugs are numbered as 1,2,3 and on the others as
A1,A2,...B1,.... Both types accept numbers (A1 = 1, B1 = [number of last A] + 1).
Power on/off works with numbers but if we want to parse status of plug then
we have a problem. This patch is a general solution (fencing library) because
it tests value of get_status() which have to be on/off otherwise we exit with
new error code.
---
 fence/agents/lib/fencing.py.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 9e7aa97..e71ab29 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -28,6 +28,7 @@ EC_CONNECTION_LOST = 4
 EC_TIMED_OUT       = 5
 EC_WAITING_ON      = 6
 EC_WAITING_OFF     = 7
+EC_STATUS          = 8
 
 TELNET_PATH = "/usr/bin/telnet"
 SSH_PATH    = "/usr/bin/ssh"
@@ -177,7 +178,8 @@ def fail(error_code):
 		EC_CONNECTION_LOST : "Connection lost",
 		EC_TIMED_OUT : "Connection timed out",
 		EC_WAITING_ON : "Failed: Timed out waiting to power ON",
-		EC_WAITING_OFF : "Failed: Timed out waiting to power OFF"
+		EC_WAITING_OFF : "Failed: Timed out waiting to power OFF",
+		EC_STATUS : "Failed: Unable to obtain correct plug status"
 	}[error_code] + "\n"
 	sys.stderr.write(message)
 	sys.exit(error_code)
@@ -357,6 +359,9 @@ def wait_power_status(tn, options, get_power_fn):
 def fence_action(tn, options, set_power_fn, get_power_fn):
 	status = get_power_fn(tn, options)
 
+	if status != "on" or status != "off":  
+		fail(EC_STATUS)
+
 	if options["-o"] == "on":
 		if status == "on":
 			print "Success: Already ON"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]