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

[Cluster-devel] Cluster Project branch, STABLE2, updated. cluster-2.03.04-42-g2ebd2d7



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=2ebd2d7537c04c252ca98f03ba0c49a8444e3869

The branch, STABLE2 has been updated
       via  2ebd2d7537c04c252ca98f03ba0c49a8444e3869 (commit)
       via  66fc7a25642a0450ad9469435fefc8feae6e9268 (commit)
      from  8f534ee6d00311f296d9247b910c3f737a73b0c3 (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 2ebd2d7537c04c252ca98f03ba0c49a8444e3869
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Mon May 26 10:22:35 2008 +0200

    [BUILD] Add fence_lpar fencing agent to the build system
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

commit 66fc7a25642a0450ad9469435fefc8feae6e9268
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 +++
 fence/agents/lpar/Makefile      |   18 +++++++
 fence/agents/lpar/fence_lpar.py |   97 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 fence/agents/lpar/Makefile
 create mode 100755 fence/agents/lpar/fence_lpar.py

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 2fe714b..f3f9e6c 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -114,6 +114,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/lpar/Makefile b/fence/agents/lpar/Makefile
new file mode 100644
index 0000000..438e373
--- /dev/null
+++ b/fence/agents/lpar/Makefile
@@ -0,0 +1,18 @@
+###############################################################################
+###############################################################################
+##
+##  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
+##  Copyright (C) 2004 Red Hat, Inc.  All rights reserved.
+##  
+##  This copyrighted material is made available to anyone wishing to use,
+##  modify, copy, or redistribute it subject to the terms and conditions
+##  of the GNU General Public License v.2.
+##
+###############################################################################
+###############################################################################
+
+include ../../../make/defines.mk
+
+TARGET= fence_lpar
+
+include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
new file mode 100755
index 0000000..2c343a3
--- /dev/null
+++ b/fence/agents/lpar/fence_lpar.py
@@ -0,0 +1,97 @@
+#!/usr/bin/python
+
+##
+## Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
+##
+## The Following Agent Has Been Tested On:
+##
+##  Version       
+## +---------------------------------------------+
+##  Tested on HMC
+##
+#####
+
+import sys, re, pexpect
+sys.path.append("@FENCEAGENTSLIBDIR@")
+from fencing import *
+
+#BEGIN_VERSION_GENERATION
+RELEASE_VERSION=""
+REDHAT_COPYRIGHT=""
+BUILD_DATE=""
+#END_VERSION_GENERATION
+
+def get_power_status(conn, options):
+	try:
+		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(",state=(.*?),", re.IGNORECASE).search(conn.before).group(1)
+
+	##
+	## 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:
+		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)
+	except pexpect.TIMEOUT:
+		fail(EC_TIMED_OUT)
+
+def main():
+	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
+			"action", "ipaddr", "login", "passwd", "passwd_script",
+			"secure", "partition", "managed" ]
+
+	options = check_input(device_opt, process_input(device_opt))
+
+	## 
+	## Fence agent specific defaults
+	#####
+	if 0 == options.has_key("-c"):
+		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
+	####
+	conn = fence_login(options)
+	fence_action(conn, options, set_power_status, get_power_status)
+
+	##
+	## Logout from system
+	######
+	conn.send("quit\r\n")
+	conn.close()
+
+if __name__ == "__main__":
+	main()


hooks/post-receive
--
Cluster Project


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