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]

RHEL53 - [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=3844c437bbf16f20b4e2d44b01a342da46efd207
Commit:        3844c437bbf16f20b4e2d44b01a342da46efd207
Parent:        6bf04b872a87caadbd83f4e3b673323399085692
Author:        Marek 'marx' Grac <mgrac@redhat.com>
AuthorDate:    Fri Oct 31 16:06:07 2008 +0100
Committer:     Marek 'marx' Grac <mgrac@redhat.com>
CommitterDate: Fri Oct 31 16:06:07 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 othe
A1,A2,...B1,.... Both types accept numbers (A1 = 1, B1 = [number of last A]
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) becaus
it tests value of get_status() which have to be on/off otherwise we exit wit
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 dd4049a..24205b1 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"
@@ -173,7 +174,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)
@@ -352,6 +354,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" and 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]