public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: "Marek Grác" <marx@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: cluster: STABLE3 - [FENCE] #462390 - Support for iDRAC on Dell M600 Blade Chassis Date: Fri, 24 Apr 2009 12:57:00 -0000 [thread overview] Message-ID: <20090424125657.BBEE5120246@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=9e43ca654435e9207c35eca0b124caf8cb7e13d0 Commit: 9e43ca654435e9207c35eca0b124caf8cb7e13d0 Parent: 202410c294867474201f85be11eab3f579801088 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:55:05 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 | 60 ++++++++++++++++++++++++++++++++----- 1 files changed, 52 insertions(+), 8 deletions(-) diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py index 568b6ae..bffd4f2 100755 --- a/fence/agents/drac/fence_drac5.py +++ b/fence/agents/drac/fence_drac5.py @@ -9,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 @@ -24,15 +24,22 @@ BUILD_DATE="March, 2008" 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 = { @@ -41,18 +48,43 @@ 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) except pexpect.TIMEOUT: fail(EC_TIMED_OUT) +def get_list_devices(conn, options): + outlets = { } + + try: + if options["model"] == "DRAC CMC": + conn.sendline("getmodinfo") + + list_re = re.compile("^([^\s]*?)\s+Present\s*(ON|OFF)\s*.*$") + for line in conn.before.splitlines(): + if (list_re.search(line)): + outlets[list_re.search(line).group(1)] = ("", list_re.search(line).group(2)) + conn.log_expect(options, options["-c"], POWER_TIMEOUT) + elif options["model"] == "DRAC 5": + ## DRAC 5 can be used only for one computer + pass + except pexpect.EOF: + fail(EC_CONNECTION_LOST) + except pexpect.TIMEOUT: + fail(EC_TIMED_OUT) + + return outlets + def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "ipaddr", "login", "passwd", "passwd_script", - "cmd_prompt", "secure", - "drac_version", "module_name", "inet4_only", "inet6_only" ] + "cmd_prompt", "secure", "drac_version", "module_name", + "separator", "inet4_only", "inet6_only" ] atexit.register(atexit_handler) @@ -68,7 +100,19 @@ def main(): ## Operate the fencing device ###### conn = fence_login(options) - fence_action(conn, options, set_power_status, get_power_status, None) + + 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, get_list_devices) ## ## Logout from system
reply other threads:[~2009-04-24 12:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090424125657.BBEE5120246@lists.fedorahosted.org \ --to=marx@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).