This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: RHEL4 - fence_drac5: #466788 - Add support for Dell M600 CMC


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=0d5f43e5f68f5db067fdf152f7d35c1cc986c4df
Commit:        0d5f43e5f68f5db067fdf152f7d35c1cc986c4df
Parent:        2b5c4941357d0904babbdf4548b2466c7d6f9dc4
Author:        Marek 'marx' Grac <mgrac@redhat.com>
AuthorDate:    Wed Apr 22 12:30:45 2009 +0200
Committer:     Marek 'marx' Grac <mgrac@redhat.com>
CommitterDate: Wed Apr 22 12:30:45 2009 +0200

fence_drac5: #466788 - Add support for Dell M600 CMC

Fence agent was enhanced to work also with Dell M600 CMC.
---
 fence/agents/drac/fence_drac5.py |   36 ++++++++++++++++++++++++++++--------
 1 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
old mode 100755
new mode 100644
index 12cd5f7..7f8fd24
--- a/fence/agents/drac/fence_drac5.py
+++ b/fence/agents/drac/fence_drac5.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-##
+#####
 ## Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
 ##
 ## The Following Agent Has Been Tested On:
@@ -10,7 +10,6 @@
 ##  DRAC 5             1.0  (Build 06.05.12)
 ##  DRAC 5             1.21 (Build 07.05.04)
 ##
-## @note: drac_version, modulename were removed
 #####
 
 import sys, re, pexpect
@@ -25,15 +24,22 @@ BUILD_DATE=""
 
 def get_power_status(conn, options):
 	try:
-		conn.sendline("racadm serveraction powerstatus")
+		if options["model"] == "DRAC CMC":
+			conn.sendline("racadm serveraction powerstatus -m " + options["-m"])
+		elif options["model"] == "DRAC 5":
+			conn.sendline("racadm serveraction powerstatus")
+		
 		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 status: (.*)", re.IGNORECASE).search(conn.before).group(1)
-	return status.lower().strip()
+	status = re.compile("(^|: )(ON|OFF|Powering ON|Powering OFF)\s*$", re.IGNORECASE | re.MULTILINE).search(conn.before).group(2)
+	if status.lower().strip() in ["on", "powering on", "powering off"]:
+		return "on"
+	else:
+		return "off"
 
 def set_power_status(conn, options):
 	action = {
@@ -42,7 +48,10 @@ def set_power_status(conn, options):
 	}[options["-o"]]
 
 	try:
-		conn.sendline("racadm serveraction " + action)
+		if options["model"] == "DRAC CMC":
+			conn.sendline("racadm serveraction " + action + " -m " + options["-m"])
+		elif options["model"] == "DRAC 5":
+			conn.sendline("racadm serveraction " + action)
 		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
@@ -52,8 +61,7 @@ def set_power_status(conn, options):
 def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"cmd_prompt", "secure",
-			"drac_version", "module_name" ]
+			"cmd_prompt", "secure", "drac_version", "module_name" ]
 
 	options = check_input(device_opt, process_input(device_opt))
 
@@ -67,6 +75,18 @@ def main():
 	## Operate the fencing device
 	######
 	conn = fence_login(options)
+	
+	if conn.before.find("CMC") >= 0:
+		if 0 == options.has_key("-m"):
+			fail_usage("Failed: You have to enter module name (-m)")
+			
+		options["model"]="DRAC CMC"		
+	elif conn.before.find("DRAC 5") >= 0:
+		options["model"]="DRAC 5"
+	else:
+		## Assume this is DRAC 5 by default as we don't want to break anything
+		options["model"]="DRAC 5"
+
 	fence_action(conn, options, set_power_status, get_power_status)
 
 	##


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]