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

[Cluster-devel] Cluster Project branch, master, updated. cluster-2.99.02-23-g041c632



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=041c632cc81171f2a2a793b91012d9c4b7935ffd

The branch, master has been updated
       via  041c632cc81171f2a2a793b91012d9c4b7935ffd (commit)
      from  f996ecccc2a91cd4b0e6b11167ffc3a28fe1499c (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 041c632cc81171f2a2a793b91012d9c4b7935ffd
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} (51%)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 61e5fb2..944553c 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 51%
copy from fence/agents/ilo/fence_ilo.py
copy to fence/agents/lpar/fence_lpar.py
index a5471db..2c343a3 100755
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -5,11 +5,10 @@
 ##
 ## 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
@@ -17,31 +16,43 @@ sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
 #BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New ILO Agent - test release on steroids"
+RELEASE_VERSION=""
 REDHAT_COPYRIGHT=""
-BUILD_DATE="March, 2008"
+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]