Cluster Project branch, master, updated. gfs-kernel_0_1_22-104-g4a91131
mgrac@sourceware.org
mgrac@sourceware.org
Fri Mar 28 16:23:00 GMT 2008
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".
http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4a91131c548a5127431255f47ad96889cb1f4d07
The branch, master has been updated
via 4a91131c548a5127431255f47ad96889cb1f4d07 (commit)
from 2c60eddf3d7bedfd452c9583a7e957103e1eaa16 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4a91131c548a5127431255f47ad96889cb1f4d07
Author: Marek 'marx' Grac <mgrac@redhat.com>
Date: Fri Mar 28 17:18:42 2008 +0100
fence/agents: WTI agents merged
Fencing devices from WTI can use password or login/password for loging in.
This patch merge two fencing agents together so it will be same as old agent.
-----------------------------------------------------------------------
Summary of changes:
fence/agents/lib/fencing.py | 6 ++-
fence/agents/wti/wti-ips.py | 100 -------------------------------
fence/agents/wti/{wti-rsm.py => wti.py} | 22 ++++++-
3 files changed, 24 insertions(+), 104 deletions(-)
delete mode 100755 fence/agents/wti/wti-ips.py
rename fence/agents/wti/{wti-rsm.py => wti.py} (76%)
diff --git a/fence/agents/lib/fencing.py b/fence/agents/lib/fencing.py
index 56c89a7..f0fe163 100644
--- a/fence/agents/lib/fencing.py
+++ b/fence/agents/lib/fencing.py
@@ -59,6 +59,10 @@ all_opt = {
"getopt" : "l:",
"help" : "-l <name> Login name",
"order" : 1 },
+ "no_login" : {
+ "getopt" : "",
+ "help" : "",
+ "order" : 1 },
"passwd" : {
"getopt" : "p:",
"help" : "-p <password> Login password",
@@ -204,7 +208,7 @@ def check_input(device_opt, opt):
if 0 == ["on", "off", "reboot", "status"].count(options["-o"].lower()):
fail_usage("Failed: Unrecognised action '" + options["-o"] + "'")
- if (0 == options.has_key("-l")) and (device_opt.count("login")):
+ if (0 == options.has_key("-l")) and device_opt.count("login") and (device_opt.count("no_login") == 0):
fail_usage("Failed: You have to set login name")
if 0 == options.has_key("-a"):
diff --git a/fence/agents/wti/wti-ips.py b/fence/agents/wti/wti-ips.py
deleted file mode 100755
index 16d8db2..0000000
--- a/fence/agents/wti/wti-ips.py
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/python
-
-##
-## Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
-##
-## The Following Agent Has Been Tested On:
-##
-## Version Firmware
-## +-----------------+---------------------------+
-## WTI IPS-800-CE v1.40h
-##
-#####
-
-import sys, re, pexpect
-sys.path.append("../lib/")
-from fencing import *
-
-def get_power_status(conn, options):
- try:
- conn.send("/S"+"\r\n")
- conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
- except pexpect.EOF:
- fail(EC_CONNECTION_LOST)
- except pexpect.TIMEOUT:
- fail(EC_TIMED_OUT)
-
- plug_section = 0
- for line in conn.before.splitlines():
- if (plug_section == 2) and line.find("|") >= 0:
- plug_line = [x.strip().lower() for x in line.split("|")]
- if len(plug_line) < len(plug_header):
- plug_section = -1
- pass
- if options["-n"] == plug_line[plug_index]:
- return plug_line[status_index]
- elif (plug_section == 1):
- plug_section = 2
- pass
- elif (line.upper().startswith("PLUG")):
- plug_section = 1
- plug_header = [x.strip().lower() for x in line.split("|")]
- plug_index = plug_header.index("plug")
- status_index = plug_header.index("status")
-
- return "PROBLEM"
-
-def set_power_status(conn, options):
- action = {
- 'on' : "/on",
- 'off': "/off"
- }[options["-o"]]
-
- try:
- conn.send(action + " " + options["-n"] + ",y\r\n")
- conn.log_expect(options, options["-c"], POWER_TIMEOUT)
- except pexcept.EOF:
- fail(EC_CONNECTION_LOST)
- except pexcept.TIMEOUT:
- fail(EC_TIMED_OUT)
-
-def main():
- device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
- "action", "ipaddr", "passwd", "passwd_script",
- "cmd_prompt", "port" ]
-
- options = check_input(device_opt, process_input(device_opt))
-
- ##
- ## Fence agent specific defaults
- #####
- if 0 == options.has_key("-c"):
- options["-c"] = "IPS>"
-
- ##
- ## Login to system
- ## @note: there is no username so we can't use fence_login()
- ####
- try:
- conn = fspawn ('telnet ' + options["-a"])
- conn.log_expect(options, "Password: ", SHELL_TIMEOUT)
- conn.send(options["-p"]+"\r\n")
- conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
- except pexpect.EOF:
- fail(EC_LOGIN_DENIED)
- except pexpect.TIMEOUT:
- fail(EC_LOGIN_DENIED)
-
- ##
- ## Operate the fecing device
- ######
- fence_action(conn, options, set_power_status, get_power_status)
-
- ##
- ## Logout from system
- ######
- conn.send("/X,Y"+"\r\n")
- conn.close()
-
-if __name__ == "__main__":
- main()
diff --git a/fence/agents/wti/wti-rsm.py b/fence/agents/wti/wti.py
similarity index 76%
rename from fence/agents/wti/wti-rsm.py
rename to fence/agents/wti/wti.py
index 3e40aa2..ccec9dd 100755
--- a/fence/agents/wti/wti-rsm.py
+++ b/fence/agents/wti/wti.py
@@ -9,6 +9,7 @@
## +-----------------+---------------------------+
## WTI RSM-8R4 ?? unable to find out ??
## WTI MPC-??? ?? unable to find out ??
+## WTI IPS-800-CE v1.40h (no username)
#####
import sys, re, pexpect
@@ -61,7 +62,7 @@ def set_power_status(conn, options):
def main():
device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
"action", "ipaddr", "login", "passwd", "passwd_script",
- "cmd_prompt", "secure", "port" ]
+ "cmd_prompt", "secure", "port", "no_login" ]
options = check_input(device_opt, process_input(device_opt))
@@ -69,12 +70,27 @@ def main():
## Fence agent specific defaults
#####
if 0 == options.has_key("-c"):
- options["-c"] = [ "RSM>", "MPC>" ]
+ options["-c"] = [ "RSM>", "MPC>", "IPS>" ]
##
## Operate the fencing device
+ ##
+ ## @note: if there is not a login name then we assume that it is WTI-IPS
+ ## where no login name is used
#####
- conn = fence_login(options)
+ if (0 == options.has_key("-l")):
+ try:
+ conn = fspawn ('telnet ' + options["-a"])
+ conn.log_expect(options, "Password: ", SHELL_TIMEOUT)
+ conn.send(options["-p"]+"\r\n")
+ conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+ except pexpect.EOF:
+ fail(EC_LOGIN_DENIED)
+ except pexpect.TIMEOUT:
+ fail(EC_LOGIN_DENIED)
+ else:
+ conn = fence_login(options)
+
fence_action(conn, options, set_power_status, get_power_status)
##
hooks/post-receive
--
Cluster Project
More information about the Cluster-cvs
mailing list