fence-agents: master - fence_cisco_ucs: Support for sub-organization

Marek Grác marx at fedoraproject.org
Tue Mar 22 14:03:23 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=71d6b61273be24289d1ef64e81af291305cb5660
Commit:        71d6b61273be24289d1ef64e81af291305cb5660
Parent:        e8253f37feb87c5f64db1c40f4c93fb27a248f34
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Tue Mar 22 15:00:46 2011 +0100
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Tue Mar 22 15:00:46 2011 +0100

fence_cisco_ucs: Support for sub-organization

Added new option --suborg where you can enter suborg path (e.g. org-myorg/org-sub).
Unlike in the other cases we do not automatically add prefixes as there can be more
levels of suborganizations.

Resolves: rhbz#678094
---
 fence/agents/cisco_ucs/fence_cisco_ucs.py |   12 ++++++++++--
 fence/agents/lib/fencing.py.py            |    8 ++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 07375b3..87c4bd2 100755
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -18,7 +18,7 @@ re_get_desc = re.compile(" descr=\"(.*?)\"", re.IGNORECASE)
 
 def get_power_status(conn, options):
 	try:
-		res = send_command(options, "<configResolveDn cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" dn=\"org-root/ls-" + options["-n"] + "/power\"/>")
+		res = send_command(options, "<configResolveDn cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" dn=\"org-root" + options["-s"] + "/ls-" + options["-n"] + "/power\"/>")
 	except pycurl.error, e:
 		sys.stderr.write(e[1] + "\n")
 		fail(EC_TIMED_OUT)
@@ -102,7 +102,7 @@ def main():
 			"action", "ipaddr", "login", "passwd", "passwd_script",
 			"ssl", "inet4_only", "inet6_only", "ipport", "port", 
 			"web", "separator", "power_wait", "power_timeout",
-			"shell_timeout" ]
+			"shell_timeout", "suborg" ]
 
 	atexit.register(atexit_handler)
 	
@@ -125,6 +125,14 @@ used with Cisco UCS to fence machines."
 	options["cookie"] = result.group(1);
 
 	##
+	## Modify suborg to format /suborg
+	if options["-s"] != "":
+		if options["-s"].startswith("/") == False:
+			options["-s"] = "/" + options["-s"]
+		if options["-s"].endswith("/") == True:
+			options["-s"] = options["-s"][0:-1]
+
+	##
 	## Fence operations
 	####
 	result = fence_action(None, options, set_power_status, get_power_status, get_list)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 4e5eb18..8bd6f45 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -215,6 +215,14 @@ all_opt = {
 		"required" : "0",
 		"shortdesc" : "Physical switch number on device",
 		"order" : 1 },
+	"suborg" : {
+		"getopt" : "s:",
+		"longopt" : "suborg",
+		"help" : "--suborg=<path>                Additional path needed to access suborganization",
+		"required" : "0",
+		"shortdesc" : "Additional path needed to access suborganization",
+		"default" : "",
+		"order" : 1 },
 	"partition" : {
 		"getopt" : "n:",
 		"help" : "-n <id>                        Name of the partition",


More information about the cluster-commits mailing list