public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Chris Feist <cfeist@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: The tag: cmirror_1_1_34 has been created
Date: Wed, 12 Nov 2008 20:42:00 -0000	[thread overview]
Message-ID: <20081112202209.8FA02C07C9@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c8e1dff26b5fd3d9cb5c72a6787871fc92686a39
Commit:        c8e1dff26b5fd3d9cb5c72a6787871fc92686a39
Parent:        3993b5e73a08031ec88a25c5cfa5146d4ab3787c
Author:        Marek 'marx' Grac <mgrac@redhat.com>
AuthorDate:    Wed Nov 12 14:57:03 2008 +0100
Committer:     Marek 'marx' Grac <mgrac@redhat.com>
CommitterDate: Wed Nov 12 15:02:24 2008 +0100

[fence] Extension to fence agent for LPAR/HMC with 'list'/'monitor' operation

---
 fence/agents/lib/fencing.py.py  |    2 +-
 fence/agents/lpar/fence_lpar.py |   29 +++++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index f661af8..124f8c2 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -403,7 +403,7 @@ def wait_power_status(tn, options, get_power_fn):
 	return 0
 
 def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None):
-	if (options["-o"] == "list" and 0 == options["device_opt"].count("port")):
+	if (options["-o"] == "list") and (0 == options["device_opt"].count("port")) and (0 == options["device_opt"].count("partition")):
 		print "N/A"
 		return
 	elif (options["-o"] == "list" and get_outlet_list == None):
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index a8a4fe9..56c3153 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -57,6 +57,31 @@ def set_power_status(conn, options):
 	except pexpect.TIMEOUT:
 		fail(EC_TIMED_OUT)
 
+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)
+
+		## 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",
@@ -76,14 +101,14 @@ def main():
 	if 0 == options.has_key("-s"):
 		fail_usage("Failed: You have to enter name of managed system")
 
-        if 0 == options.has_key("-n"):
+        if (0 == ["list", "monitor"].count(options["-o"].lower())) and (0 == options.has_key("-n")):
                 fail_usage("Failed: You have to enter name of the partition")
 
 	##
 	## Operate the fencing device
 	####
 	conn = fence_login(options)
-	fence_action(conn, options, set_power_status, get_power_status)
+	fence_action(conn, options, set_power_status, get_power_status, get_lpar_list)
 
 	##
 	## Logout from system


                 reply	other threads:[~2008-11-12 20:42 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=20081112202209.8FA02C07C9@lists.fedorahosted.org \
    --to=cfeist@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: link
Be 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).