From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10252 invoked by alias); 24 Apr 2009 12:51:40 -0000 Received: (qmail 10203 invoked by alias); 24 Apr 2009 12:51:40 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_210,J_CHICKENPOX_28,SPF_HELO_PASS X-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_210,J_CHICKENPOX_28,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: RHEL5 - [FENCE] #462390 - Support for iDRAC on Dell M600 Blade Chassis To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/RHEL5 X-Git-Reftype: branch X-Git-Oldrev: 0f14eedae257f538a1286b1543e10da24b23e214 X-Git-Newrev: 8ae3300d9073abdad6f2b85629e8e01a67bd0680 From: =?utf-8?q?Marek_Gr=C3=A1c?= Message-Id: <20090424125114.ADDC2120246@lists.fedorahosted.org> Date: Fri, 24 Apr 2009 12:51:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q2/txt/msg00105.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=8ae3300d9073abdad6f2b85629e8e01a67bd0680 Commit: 8ae3300d9073abdad6f2b85629e8e01a67bd0680 Parent: 0f14eedae257f538a1286b1543e10da24b23e214 Author: Marek 'marx' Grac AuthorDate: Fri Apr 24 14:47:44 2009 +0200 Committer: Marek 'marx' Grac 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) ##