FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 05-20-2008, 09:26 AM
 
Default Cluster Project branch, RHEL5, updated. cmirror_1_1_15-90-gd9538c7

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=d9538c73f6 450c84b65f6d04e0bc7bcdaa2b7c8b

The branch, RHEL5 has been updated
via d9538c73f6450c84b65f6d04e0bc7bcdaa2b7c8b (commit)
from 1f8a70aafaa307b565335652b530e72ace8176a9 (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 d9538c73f6450c84b65f6d04e0bc7bcdaa2b7c8b
Author: Marek 'marx' Grac <mgrac@redhat.com>
Date: Tue May 20 11:11:23 2008 +0200

[FENCE] Fix #446995: Parse error: Unknown option 'switch=3'

Support for APC MasterSwitch was added (it worked in original fencing
agent). Option 'switch' on STDIN didn't have a getopt alternative, so
'-s <switch-id>' was added. Plug number notation <switch>:<plug> works
as before. Original behaviour for missing switch number does not change.
If there is just one MasterSwitch then we will set it up otherwise error
is returned.

-----------------------------------------------------------------------

Summary of changes:
fence/agents/apc/fence_apc.py | 85 ++++++++++++++++++++++++++++++---------
fence/agents/lib/fencing.py.py | 4 ++
2 files changed, 69 insertions(+), 20 deletions(-)

diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 5bf74bc..bc1c69c 100755
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -9,6 +9,7 @@
## +---------------------------------------------+
## AP7951 AOS v2.7.0, PDU APP v2.7.3
## AP7941 AOS v3.5.7, PDU APP v3.5.6
+## AP9606 AOS v2.5.4, PDU APP v2.7.3
##
## @note: ssh is very slow on AP7951 device
#####
@@ -31,6 +32,16 @@ def get_power_status(conn, options):

version = 0
admin = 0
+ switch = 0;
+
+ if (None != re.compile('.* MasterSwitch plus.*', re.IGNORECASE | re.S).match(conn.before)):
+ switch = 1;
+ if (None != re.compile('.* MasterSwitch plus 2', re.IGNORECASE | re.S).match(conn.before)):
+ if (0 == options.has_key("-s")):
+ fail_usage("Failed: You have to enter physical switch number")
+ else:
+ if (0 == options.has_key("-s")):
+ options["-s"] = 1

if (None == re.compile('.*Outlet Management.*', re.IGNORECASE | re.S).match(conn.before)):
version = 2
@@ -42,16 +53,19 @@ def get_power_status(conn, options):
else:
admin = 1

- if version == 2:
- if admin == 0:
- conn.send("2
")
+ if switch == 0:
+ if version == 2:
+ if admin == 0:
+ conn.send("2
")
+ else:
+ conn.send("3
")
else:
- conn.send("3
")
+ conn.send("2
")
+ conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+ conn.send("1
")
else:
- conn.send("2
")
- conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
- conn.send("1
")
-
+ conn.send(options["-s"]+"
")
+
while 1 == conn.log_expect(options, [ options["-c"], "Press <ENTER>" ], SHELL_TIMEOUT):
result += conn.before
conn.send("
")
@@ -79,6 +93,22 @@ def set_power_status(conn, options):

version = 0
admin = 0
+ switch = 0
+
+ if (None != re.compile('.* MasterSwitch plus.*', re.IGNORECASE | re.S).match(conn.before)):
+ switch = 1;
+ ## MasterSwitch has different schema for on/off actions
+ action = {
+ 'on' : "1",
+ 'off': "3"
+ }[options["-o"]]
+ if (None != re.compile('.* MasterSwitch plus 2', re.IGNORECASE | re.S).match(conn.before)):
+ if (0 == options.has_key("-s")):
+ fail_usage("Failed: You have to enter physical switch number")
+ else:
+ if (0 == options.has_key("-s")):
+ options["-s"] = 1
+
if (None == re.compile('.*Outlet Management.*', re.IGNORECASE | re.S).match(conn.before)):
version = 2
else:
@@ -89,26 +119,35 @@ def set_power_status(conn, options):
else:
admin = 1

- if version == 2:
- if admin == 0:
- conn.send("2
")
+ if switch == 0:
+ if version == 2:
+ if admin == 0:
+ conn.send("2
")
+ else:
+ conn.send("3
")
else:
- conn.send("3
")
+ conn.send("2
")
+ conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+ conn.send("1
")
else:
- conn.send("2
")
- conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
- conn.send("1
")
+ conn.send(options["-s"] + "
")

while 1 == conn.log_expect(options, [ options["-c"], "Press <ENTER>" ], SHELL_TIMEOUT):
conn.send("
")
conn.send(options["-n"]+"
")
conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
- if admin == 1:
- conn.send("1
")
- conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
- if version == 3:
+
+ if switch == 0:
+ if admin == 1:
+ conn.send("1
")
+ conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+ if version == 3:
+ conn.send("1
")
+ conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+ else:
conn.send("1
")
conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+
conn.send(action+"
")
conn.log_expect(options, "Enter 'YES' to continue or <ENTER> to cancel :", SHELL_TIMEOUT)
conn.send("YES
")
@@ -126,7 +165,7 @@ def set_power_status(conn, options):
def main():
device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
"action", "ipaddr", "login", "passwd", "passwd_script",
- "secure", "port", "test" ]
+ "secure", "port", "switch", "test" ]

options = check_input(device_opt, process_input(device_opt))

@@ -136,6 +175,12 @@ def main():
if 0 == options.has_key("-c"):
options["-c"] = "
>"

+ ## Support for -n [switch]:[plug] notation that was used before
+ if (-1 != options["-n"].find(":")):
+ (switch, plug) = options["-n"].split(":", 1)
+ options["-s"] = switch;
+ options["-n"] = plug;
+
##
## Operate the fencing device
####
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 7aa8a0c..4f13a55 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -106,6 +106,10 @@ all_opt = {
"getopt" : "n:",
"help" : "-n <id> Physical plug number on device",
"order" : 1 },
+ "switch" : {
+ "getopt" : "-s:",
+ "help" : "-s <id> Physical switch number on device",
+ "order" : 1 },
"test" : {
"getopt" : "T",
"help" : "",


hooks/post-receive
--
Cluster Project
 

Thread Tools




All times are GMT. The time now is 10:23 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org