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: fence-agents: master - fence_lpar: Fix 'list' operation for HMC v3 Date: Mon, 16 Feb 2009 14:28:00 -0000 [thread overview] Message-ID: <20090216142801.1461812026F@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=96e27b8d2247d64abc53633ba81cc0cff474d668 Commit: 96e27b8d2247d64abc53633ba81cc0cff474d668 Parent: 5afd5af37b31abc7c2198940796fd3bd9b03d621 Author: Marek 'marx' Grac <mgrac@redhat.com> AuthorDate: Mon Feb 16 15:26:28 2009 +0100 Committer: Marek 'marx' Grac <mgrac@redhat.com> CommitterDate: Mon Feb 16 15:26:28 2009 +0100 fence_lpar: Fix 'list' operation for HMC v3 --- fence/agents/lpar/fence_lpar.py | 57 ++++++++++++++++++++++++++------------ 1 files changed, 39 insertions(+), 18 deletions(-) diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py index 53f8f60..a5a769a 100644 --- a/fence/agents/lpar/fence_lpar.py +++ b/fence/agents/lpar/fence_lpar.py @@ -80,33 +80,54 @@ def set_power_status(conn, options): def get_lpar_list(conn, options): outlets = { } - try: - conn.send("lssyscfg -r lpar -m " + options["-s"] + - " -F name:state\n") - conn.log_expect(options, options["-c"], POWER_TIMEOUT) + if options["-H"] == "3": + try: + conn.send("query_partition_names -m " + options["-s"] + "\n") + conn.log_expect(options, options["-c"], POWER_TIMEOUT) - ## We have to remove first line (command) and last line (part of new prompt) - #### - res = re.search("^.+?\n(.*)\n.*$", conn.before, re.S) + ## We have to remove first 3 lines (command + header) and last line (part of new prompt) + #### + res = re.search("^.+?\n(.+?\n){2}(.*)\n.*$", conn.before, re.S) - if res == None: - fail_usage("Unable to parse output of list command") + if res == None: + fail_usage("Unable to parse output of list command") - lines = res.group(1).split("\n") - for x in lines: - s = x.split(":") - outlets[s[0]] = ("", s[1]) - except pexpect.EOF: - fail(EC_CONNECTION_LOST) - except pexpect.TIMEOUT: - fail(EC_TIMED_OUT) + lines = res.group(2).split("\n") + for x in lines: + outlets[x.rstrip()] = ("", "") + except pexpect.EOF: + fail(EC_CONNECTION_LOST) + except pexpect.TIMEOUT: + fail(EC_TIMED_OUT) + elif options["-H"] == "4": + try: + conn.send("lssyscfg -r lpar -m " + options["-s"] + + " -F name:state\n") + conn.log_expect(options, options["-c"], POWER_TIMEOUT) + + ## We have to remove first line (command) and last line (part of new prompt) + #### + res = re.search("^.+?\n(.*)\n.*$", conn.before, re.S) + + if res == None: + fail_usage("Unable to parse output of list command") + + lines = res.group(1).split("\n") + for x in lines: + s = x.split(":") + outlets[s[0]] = ("", s[1]) + 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", - "secure", "partition", "managed", "hmc_version", "cmd_prompt" ] + "secure", "partition", "managed", "hmc_version", "cmd_prompt", + "separator" ] options = check_input(device_opt, process_input(device_opt))
reply other threads:[~2009-02-16 14:28 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=20090216142801.1461812026F@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).