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 2/7] COMPATIBILITY BREAK: fence_drac5 replace --m / --modulename / modulename / module_name with standard -n / --plug / port
Date: Sun, 25 Nov 2012 14:18:05 +0100	[thread overview]
Message-ID: <1353849490-15635-2-git-send-email-mgrac@redhat.com> (raw)
In-Reply-To: <1353849490-15635-1-git-send-email-mgrac@redhat.com>

This change apply to you only if you use fence agent against DRAC CMC, other DRACs are bound to one machine, so they
do not use this option at all. Device option no_port (no port is needed) was added, previously modulename was optional
and this is not true with 'port' option by default.
---
 fence/agents/drac5/fence_drac5.py |   10 ++++----
 fence/agents/lib/fencing.py.py    |   41 ++++++++----------------------------
 2 files changed, 14 insertions(+), 37 deletions(-)

diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index 09157fe..8560c39 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -24,7 +24,7 @@ BUILD_DATE="March, 2008"
 
 def get_power_status(conn, options):
 	if options["model"] == "DRAC CMC":
-		conn.send_eol("racadm serveraction powerstatus -m " + options["--module-name"])
+		conn.send_eol("racadm serveraction powerstatus -m " + options["--plug"])
 	elif options["model"] == "DRAC 5":
 		conn.send_eol("racadm serveraction powerstatus")
 		
@@ -43,7 +43,7 @@ def set_power_status(conn, options):
 	}[options["--action"]]
 
 	if options["model"] == "DRAC CMC":
-		conn.send_eol("racadm serveraction " + action + " -m " + options["--module-name"])
+		conn.send_eol("racadm serveraction " + action + " -m " + options["--plug"])
 	elif options["model"] == "DRAC 5":
 		conn.send_eol("racadm serveraction " + action)
 	conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
@@ -79,7 +79,7 @@ def define_new_opts():
 
 def main():
 	device_opt = [  "ipaddr", "ipport", "login", "passwd", "cmd_prompt", "secure", \
-			"drac_version", "module_name" ]
+			"drac_version", "port", "no_port" ]
 
 	atexit.register(atexit_handler)
 
@@ -105,8 +105,8 @@ By default, the telnet interface is not  enabled."
 	conn = fence_login(options)
 
 	if conn.before.find("CMC") >= 0:
-		if 0 == options.has_key("--module-name") and 0 == ["monitor", "list"].count(options["--action"].lower()):
-			fail_usage("Failed: You have to enter module name (-m)")
+		if 0 == options.has_key("--plug") and 0 == ["monitor", "list"].count(options["--action"].lower()):
+			fail_usage("Failed: You have to enter module name (-n)")
 			
 		options["model"] = "DRAC CMC"
 	elif conn.before.find("DRAC 5") >= 0:
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 0736f91..a9bc0b4 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -120,6 +120,10 @@ all_opt = {
 		"getopt" : "",
 		"help" : "",
 		"order" : 1 },
+	"no_port" : {
+		"getopt" : "",
+		"help" : "",
+		"order" : 1 },
 	"passwd" : {
 		"getopt" : "p:",
 		"longopt" : "password",
@@ -141,13 +145,6 @@ all_opt = {
 		"required" : "0",
 		"shortdesc" : "Identity file for ssh",
 		"order" : 1 },
-	"module_name" : {
-		"getopt" : "m:",
-		"longopt" : "module-name",
-		"help" : "-m, --module-name=<module>     DRAC/MC module name",
-		"required" : "0",
-		"shortdesc" : "DRAC/MC module name",
-		"order" : 1 },
 	"drac_version" : {
 		"getopt" : "d:",
 		"longopt" : "drac-version",
@@ -186,8 +183,8 @@ all_opt = {
 	"port" : {
 		"getopt" : "n:",
 		"longopt" : "plug",
-		"help" : "-n, --plug=<id>                Physical plug number on device, \n" + 
-        "                                        name of virtual machine or UUID",
+		"help" : "-n, --plug=<id>                Physical plug number on device, UUID or \n" + 
+        "                                        identification of machine",
 		"required" : "1",
 		"shortdesc" : "Physical plug number, name of virtual machine or UUID",
 		"order" : 1 },
@@ -545,11 +542,6 @@ def process_input(avail_opt):
 			else:
 				longopt_list.append(all_opt[k]["longopt"])
 
-	## Compatibility layer
-	if avail_opt.count("module_name") == 1:
-		getopt_string += "n:"
-		longopt_list.append("plug=")
-	
 	##
 	## Read options from command line or standard input
 	#####
@@ -574,16 +566,6 @@ def process_input(avail_opt):
 						("-" + all_opt[x]["getopt"] == o or "-" + all_opt[x]["getopt"].rstrip(":") == o):
 						opt["--" + all_opt[x]["longopt"]] = dict(old_opt)[o]
 				opt[o] = dict(old_opt)[o]
-
-		## Compatibility Layer
-		#####
-		z = dict(opt)
-		if z.has_key("--plug") == 1:
-			z["-m"] = z["--plug"]
-
-		opt = z
-		##
-		#####
 	else:
 		opt = { }
 		name = ""
@@ -605,10 +587,6 @@ def process_input(avail_opt):
 				name = "port"
 			elif name == "hostname":
 				name = "ipaddr"
-			elif name == "modulename":
-				name = "module_name"
-			elif name == "port" and 1 == avail_opt.count("drac_version"):
-				name = "module_name"
 
 			##
 			######
@@ -714,8 +692,8 @@ def check_input(device_opt, opt):
 			fail_usage("Failed: Identity file " + options["--identity-file"] + " does not exist")
 
 	if (0 == ["list", "monitor"].count(options["--action"].lower())) and \
-		0 == options.has_key("--plug") and device_opt.count("port"):
-		fail_usage("Failed: You have to enter plug number")
+		0 == options.has_key("--plug") and device_opt.count("port") and device_opt.count("no_port") == 0:
+		fail_usage("Failed: You have to enter plug number or machine identification")
 
 	if options.has_key("--password-script"):
 		options["--password"] = os.popen(options["--password-script"]).read().rstrip()
@@ -782,8 +760,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 		## Process options that manipulate fencing device
 		#####
 		if (options["--action"] == "list") and \
-			0 == options["device_opt"].count("port") and 0 == options["device_opt"].count("partition") and \
-			0 == options["device_opt"].count("module_name"):
+			0 == options["device_opt"].count("port") and 0 == options["device_opt"].count("partition"):
 			print "N/A"
 			return
 		elif (options["--action"] == "list" and get_outlet_list == None):
-- 
1.7.7.6



  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 ` Marek 'marx' Grac [this message]
2012-11-25 13:18 ` [Cluster-devel] [PATCH 3/7] COMPATIBILITY BREAK: fence_lpar replace --n / --partition / partition with standard -n / --plug / port Marek 'marx' Grac
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-2-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).