public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: "Marek Grác" <marx@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: RHEL5 - [fence] WTI should not power on/off plug if it is unable to get status
Date: Wed, 29 Oct 2008 15:46:00 -0000	[thread overview]
Message-ID: <20081029154535.676CF12026C@lists.fedorahosted.org> (raw)

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"


             reply	other threads:[~2008-10-29 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 15:46 Marek Grác [this message]
2008-10-29 16:32 Marek Grác

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081029154535.676CF12026C@lists.fedorahosted.org \
    --to=marx@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).