[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci/site/luci/Extensions cluster_adapte ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	jparsons sourceware org	2006-11-07 01:32:34

Modified files:
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	separate fence info methods

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.148&r2=1.149

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/06 23:55:23	1.148
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/07 01:32:33	1.149
@@ -2867,7 +2867,7 @@
 
   return map
   
-def getFenceInfo(self, model, request):
+def getFenceInfo(self, model, request, fornode = None):
   clustername = request['clustername']
   baseurl = request['URL']
   map = {}
@@ -2882,7 +2882,7 @@
   map['shared2'] = shared2
   map['fencedevs'] = fencedevs
   nodename = ""
-  if request == None:  #this is being called by the fence device list page
+  if fornode == None:  #this is being called by the fence device list page
     #Get list of fence devices
     fds = model.getFenceDevices()
     for fd in fds:
@@ -3007,6 +3007,53 @@
 
     return map    
       
+def getFencesInfo(self, model, request):
+  clustername = request['clustername']
+  baseurl = request['URL']
+  map = {}
+  fencedevs = list() #This is for the fencedev list page
+  map['fencedevs'] = fencedevs
+  #Get list of fence devices
+  fds = model.getFenceDevices()
+  for fd in fds:
+    #create fencedev hashmap
+    if fd.isShared() == True:
+      fencedev = {}
+      attr_hash = fd.getAttributes()
+      kees = attr_hash.keys()
+      for kee in kees:
+        fencedev[kee] = attr_hash[kee] #copy attrs over
+      try:
+        fencedev['pretty_name'] = FENCE_OPTS[fd.getAgentType()]
+      except:
+        fencedev['pretty_name'] = fd.getAgentType()
+
+      nodes_used = list() #This section determines which nodes use the dev
+      nodes = model.getNodes()
+      for node in nodes:
+        flevels = node.getFenceLevels()
+        for flevel in flevels: #These are the method blocks...
+          kids = flevel.getChildren()
+          for kid in kids: #These are actual devices in each level
+            if kid.getName().strip == fd.getName().strip():
+              #See if this fd already has an entry for this node
+              found_duplicate = False
+              for item in nodes_used:
+                if item['nodename'] == node.getName().strip():
+                  found_duplicate = True
+              if found_duplicate == True:
+                continue
+              node_hash = {}
+              node_hash['nodename'] = node.getName().strip()
+              node_hash['nodeurl'] = baseurl + "#fence" + "?clustername=" + clustername + "&nodename=" + node.getName() + "&pagetype=" + NODE 
+              nodes_used.append(node_hash)
+
+      fencedev['nodesused'] = nodes_used
+    fencedevs.append(fencedev)
+    
+  return map
+
+    
 def getLogsForNode(self, request):
 	try:
 		nodename = request['nodename']


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]