cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Marek 'marx' Grac <mgrac@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 3/7] COMPATIBILITY BREAK: fence_lpar replace --n / --partition / partition with standard -n / --plug / port
Date: Sun, 25 Nov 2012 14:18:06 +0100	[thread overview]
Message-ID: <1353849490-15635-3-git-send-email-mgrac@redhat.com> (raw)
In-Reply-To: <1353849490-15635-1-git-send-email-mgrac@redhat.com>

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

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index a9bc0b4..64a1a06 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -759,8 +759,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 	try:
 		## Process options that manipulate fencing device
 		#####
-		if (options["--action"] == "list") and \
-			0 == options["device_opt"].count("port") and 0 == options["device_opt"].count("partition"):
+		if (options["--action"] == "list") and 0 == options["device_opt"].count("port"):
 			print "N/A"
 			return
 		elif (options["--action"] == "list" and get_outlet_list == None):
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index e8e50c6..55b8294 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -22,15 +22,15 @@ BUILD_DATE=""
 
 def get_power_status(conn, options):
 	if options["--hmc-version"] == "3":
-		conn.send("lssyscfg -r lpar -m " + options["--managed"] + " -n " + options["--partition"] + " -F name,state\n")
+		conn.send("lssyscfg -r lpar -m " + options["--managed"] + " -n " + options["--plug"] + " -F name,state\n")
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 		try:
-			status = re.compile("^" + options["--partition"] + ",(.*?),.*$", re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
+			status = re.compile("^" + options["--plug"] + ",(.*?),.*$", re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
 		except AttributeError:
 			fail(EC_STATUS_HMC)
 	elif options["--hmc-version"] == "4":
-		conn.send("lssyscfg -r lpar -m "+ options["--managed"] +" --filter 'lpar_names=" + options["--partition"] + "'\n")
+		conn.send("lssyscfg -r lpar -m "+ options["--managed"] +" --filter 'lpar_names=" + options["--plug"] + "'\n")
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 		try:				
@@ -50,18 +50,18 @@ def get_power_status(conn, options):
 def set_power_status(conn, options):
 	if options["--hmc-version"] == "3":
 		conn.send("chsysstate -o " + options["--action"] + " -r lpar -m " + options["--managed"]
-			+ " -n " + options["--partition"] + "\n")
+			+ " -n " + options["--plug"] + "\n")
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 	elif options["--hmc-version"] == "4":
 		if options["--action"] == "on":
 			conn.send("chsysstate -o on -r lpar -m " + options["--managed"] + 
-				" -n " + options["--partition"] + 
+				" -n " + options["--plug"] + 
 				" -f `lssyscfg -r lpar -F curr_profile " +
 				" -m " + options["--managed"] +
-				" --filter \"lpar_names="+ options["--partition"] +"\"`\n" )
+				" --filter \"lpar_names="+ options["--plug"] +"\"`\n" )
 		else:
 			conn.send("chsysstate -o shutdown -r lpar --immed" +
-				" -m " + options["--managed"] + " -n " + options["--partition"] + "\n")		
+				" -m " + options["--managed"] + " -n " + options["--plug"] + "\n")		
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 def get_lpar_list(conn, options):
@@ -115,17 +115,10 @@ def define_new_opts():
 		"shortdesc" : "Force HMC version to use (3 or 4)",
 		"default" : "4", 
 		"order" : 1 }
-	all_opt["partition"] = {
-		"getopt" : "n:",
-		"longopt" : "partition",
-		"help" : "-n <id>                        Name of the partition",
-		"required" : "0",
-		"shortdesc" : "Partition name",
-		"order" : 1 }
 
 def main():
 	device_opt = [  "ipaddr", "ipport", "login", "passwd", "secure", "cmd_prompt", \
-	                "partition", "managed", "hmc_version" ]
+	                "port", "managed", "hmc_version" ]
 
 	atexit.register(atexit_handler)
 
@@ -145,9 +138,6 @@ def main():
 	if 0 == options.has_key("--managed"):
 		fail_usage("Failed: You have to enter name of managed system")
 
-	if (0 == ["list", "monitor"].count(options["--action"].lower())) and (0 == options.has_key("--partition")):
-		fail_usage("Failed: You have to enter name of the partition")
-
 	if 1 == options.has_key("--hmc-version") and (options["--hmc-version"] != "3" and options["--hmc-version"] != "4"):
 		fail_usage("Failed: You have to enter valid version number: 3 or 4")
 
-- 
1.7.7.6



  parent reply	other threads:[~2012-11-25 13:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-25 13:18 [Cluster-devel] [PATCH 1/7] COMPATIBILITY BREAK: remove option -T / --test / test Marek 'marx' Grac
2012-11-25 13:18 ` [Cluster-devel] [PATCH 2/7] COMPATIBILITY BREAK: fence_drac5 replace --m / --modulename / modulename / module_name with standard -n / --plug / port Marek 'marx' Grac
2012-11-25 13:18 ` Marek 'marx' Grac [this message]
2012-11-25 13:18 ` [Cluster-devel] [PATCH 4/7] COMPATIBILITY BREAK: fence_rsb replace -n / telnet_port with standard --ipport / ipport Marek 'marx' Grac
2012-11-25 13:18 ` [Cluster-devel] [PATCH 5/7] COMPATIBILITY BREAK: Remove obsolete options from STDIN Marek 'marx' Grac
2012-11-25 13:18 ` [Cluster-devel] [PATCH 6/7] COMPATIBILITY BREAK: replace udpport with ipport, make ipport dependent on ipaddress Marek 'marx' Grac
2012-11-25 13:18 ` [Cluster-devel] [PATCH 7/7] COMPATIBILITY BREAK: remove -q / quiet Marek 'marx' Grac

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=1353849490-15635-3-git-send-email-mgrac@redhat.com \
    --to=mgrac@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 NNTP newsgroup(s).