cluster: RHEL5 - [FENCE] #462390 - Support for iDRAC on Dell M600 Blade Chassis

Marek Grác marx@fedoraproject.org
Fri Apr 24 12:51:00 GMT 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=8ae3300d9073abdad6f2b85629e8e01a67bd0680
Commit:        8ae3300d9073abdad6f2b85629e8e01a67bd0680
Parent:        0f14eedae257f538a1286b1543e10da24b23e214
Author:        Marek 'marx' Grac <mgrac@redhat.com>
AuthorDate:    Fri Apr 24 14:47:44 2009 +0200
Committer:     Marek 'marx' Grac <mgrac@redhat.com>
CommitterDate: Fri Apr 24 14:47:44 2009 +0200

[FENCE] #462390 - Support for iDRAC on Dell M600 Blade Chassis

Add support for M600 to existing agent used for drac5.
---
 fence/agents/drac/fence_drac5.py |   38 +++++++++++++++++++++++++++++---------
 1 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
index 12cd5f7..cf760b0 100755
--- a/fence/agents/drac/fence_drac5.py
+++ b/fence/agents/drac/fence_drac5.py
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
-##
-## Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
+#####
 ##
 ## The Following Agent Has Been Tested On:
 ##
@@ -10,7 +9,7 @@
 ##  DRAC 5             1.0  (Build 06.05.12)
 ##  DRAC 5             1.21 (Build 07.05.04)
 ##
-## @note: drac_version, modulename were removed
+## @note: drac_version was 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") and 0 == ["monitor", "list"].count(option["-o"].lower()):
+			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)
 
 	##



More information about the Cluster-cvs mailing list