public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-65-gb9a1208
@ 2008-05-23 17:13 mgrac
  0 siblings, 0 replies; only message in thread
From: mgrac @ 2008-05-23 17:13 UTC (permalink / raw)
  To: cluster-cvs, cluster-devel

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=b9a120827b951c81b2e9a2b631698fa92311c04f

The branch, RHEL4 has been updated
       via  b9a120827b951c81b2e9a2b631698fa92311c04f (commit)
      from  c2bdfe6388d20668c72b1c942c159ddcd18a819e (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 b9a120827b951c81b2e9a2b631698fa92311c04f
Author: Marek 'marx' Grac <mgrac@redhat.com>
Date:   Fri May 23 19:01:06 2008 +0200

    [FENCE]: Fix #237266: New fence agent for HMC/LPAR

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

Summary of changes:
 fence/agents/lib/fencing.py.py                     |    8 +++
 .../{ilo/fence_ilo.py => lpar/fence_lpar.py}       |   52 ++++++++++++++------
 2 files changed, 44 insertions(+), 16 deletions(-)
 copy fence/agents/{ilo/fence_ilo.py => lpar/fence_lpar.py} (50%)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index d8b2c4e..bb1713d 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -110,6 +110,14 @@ all_opt = {
 		"getopt" : "-s:",
 		"help" : "-s <id>        Physical switch number on device",
 		"order" : 1 },
+	"partition" : {
+		"getopt" : "n:",
+		"help" : "-n <id>        Name of the partition",
+		"order" : 1 },
+	"managed" : {
+		"getopt" : "s:",
+		"help" : "-s <id>        Name of the managed system",
+		"order" : 1 },
 	"test" : {
 		"getopt" : "T",
 		"help" : "",
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/lpar/fence_lpar.py
similarity index 50%
copy from fence/agents/ilo/fence_ilo.py
copy to fence/agents/lpar/fence_lpar.py
index 740add5..2c343a3 100755
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -5,43 +5,54 @@
 ##
 ## The Following Agent Has Been Tested On:
 ##
-##  iLO Version       
+##  Version       
 ## +---------------------------------------------+
-##  iLO Advanced 1.91 
+##  Tested on HMC
 ##
-## @note: We can't use conn.sendline because we need to send CR/LF
 #####
 
 import sys, re, pexpect
-sys.path.append("/usr/lib/fence")
+sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
 #BEGIN_VERSION_GENERATION
-FENCE_RELEASE_NAME=""
+RELEASE_VERSION=""
 REDHAT_COPYRIGHT=""
 BUILD_DATE=""
 #END_VERSION_GENERATION
 
 def get_power_status(conn, options):
 	try:
-		conn.send("POWER\r\n")
+		conn.send("lssyscfg -r lpar -m "+ options["-s"] +" --filter 'lpar_names=" + options["-n"] + "'\n")
 		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
 		fail(EC_TIMED_OUT)
 				
-	status = re.compile("server power is currently: (.*)", re.IGNORECASE).search(conn.before).group(1)
-	return status.lower().strip()
+	status = re.compile(",state=(.*?),", re.IGNORECASE).search(conn.before).group(1)
 
-def set_power_status(conn, options):
-	action = {
-		'on' : "powerup",
-		'off': "powerdown"
-	}[options["-o"]]
+	##
+	## Transformation to standard ON/OFF status if possible
+	if status == "Running":
+		status = "on"
+
+	if status == "Not Activated":
+		status = "off"
+
+	return status
 
+def set_power_status(conn, options):
 	try:
-		conn.send("power " + options["-o"] + "\r\n")
+		if options["-o"] == "on":
+			conn.send("chsysstate -o on -r lpar -m " + options["-s"] + 
+				" -n " + options["-n"] + 
+				" -f `lssyscfg -r lpar -F curr_profile " +
+				" -m " + options["-s"] +
+				" --filter \"lpar_names="+ options["-n"] +"\"`\n" )
+		else:
+			conn.send("chsysstate -o shutdown -r lpar --immed" +
+				" -m " + options["-s"] + " -n " + options["-n"] + "\n")		
 		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
@@ -51,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",
-			"secure", "ribcl" ]
+			"secure", "partition", "managed" ]
 
 	options = check_input(device_opt, process_input(device_opt))
 
@@ -59,7 +70,16 @@ def main():
 	## Fence agent specific defaults
 	#####
 	if 0 == options.has_key("-c"):
-		options["-c"] = "</>hpiLO->"
+		options["-c"] = ":~>"
+
+	if 0 == options.has_key("-x"):
+		fail_usage("Failed: You have to use ssh connection (-x) to fence device")
+
+	if 0 == options.has_key("-s"):
+		fail_usage("Failed: You have to enter name of managed system")
+
+        if 0 == options.has_key("-n"):
+                fail_usage("Failed: You have to enter name of the partition")
 
 	##
 	## Operate the fencing device


hooks/post-receive
--
Cluster Project


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-23 17:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-23 17:13 Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-65-gb9a1208 mgrac

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).