[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] Cluster Project branch, RHEL5, updated. cmirror_1_1_15-93-g9887ba8



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=9887ba84c5be5049322e1cbf1fb6b3d91ab5acec

The branch, RHEL5 has been updated
       via  9887ba84c5be5049322e1cbf1fb6b3d91ab5acec (commit)
      from  8397bb45819a981bfc112dd8140da753983fdc11 (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 9887ba84c5be5049322e1cbf1fb6b3d91ab5acec
Author: Marek 'marx' Grac <mgrac redhat com>
Date:   Fri May 23 19:01:06 2008 +0200

    [FENCE]: Fix #448133: 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]