Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > f48a5cd9ad8f17ad8b10b2d4229901f6 > files > 100

cman-2.0.115-109.el5_9.4.src.rpm

From 4f9c0c57af4f9eb2fa6ac463dafd351a6c657998 Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Tue, 22 Mar 2011 15:00:46 +0100
Subject: [PATCH] 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 f7c565a..055a7f5 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",
-- 
1.7.4