[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-08-16 21:51:46

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

Log message:
	fdom support

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

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/08/16 19:14:03	1.55
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/08/16 21:51:46	1.56
@@ -1093,13 +1093,23 @@
   response = req.RESPONSE
   response.redirect(req['HTTP_REFERER'] + "&busyfirst=true")
 
-def getFdomsInfo(self, modelb, request):
-  map = {}
+def getFdomsInfo(self, modelb, request, clustatus):
+  slist = list()
+  nlist = list()
+  for item in clustatus:
+  if item['type'] == "node":
+    nlist.append(item)
+  elif item['type'] == "service":
+    slist.append(item)
+  fdomlist = list()
+  clustername = request['clustername']
+  baseurl = req['URL']
   fdoms = modelb.getFailoverDomains()
   svcs = modelb.getServices()
   for fdom in fdoms:
     fdom_map = {}
     fdom_map['name'] = fdom.getName()
+    fdom_map['cfgurl'] = baseurl + "?pagetype=" + FDOM_LIST + "&clustername=" clustername
     ordered_attr = fdom.getAttribute('ordered')
     restricted_attr = fdom.getAttribute('restricted')
     if ordered_attr != None and (ordered_attr == "true" or ordered_attr == "1"):
@@ -1111,12 +1121,46 @@
     else:
       fdom_map['restricted'] = False
     nodes = fdom.getChildren()
+    nodelist = list()
     for node in nodes:
       nodesmap = {}
-      nodesmap['nodename'] = node.getName() 
+      ndname = node.getName()
+      for nitem in nlist:
+        if nitem['name'] == ndname:
+          break
+      nodesmap['nodename'] = ndname 
+      nodesmap['nodecfgurl'] = baseurl + "?clustername=" + clustername + "&nodename=" + ndname + "&pagetype=" + NODE
+      if nitem['clustered'] == "true":
+        nodesmap['status'] = NODE_ACTIVE
+      elif nitem['online'] == "false":
+        nodesmap['status'] = NODE_UNKNOWN
+      else:
+        nodesmap['status'] = NODE_INACTIVE
       priority_attr =  node.getAttribute('priority')
       if priority_attr != None:
-        nodesmap['priority'] = priority_attr
+        nodesmap['priority'] = "0"
+      nodelist.append(nodesmap)
+    fdom_map['nodeslist'] = nodelist
+
+    svclist = list()
+    for svc in svcs:
+      svcname = svc.getName()
+      for sitem in slist:
+        if sitem['name'] == svcname:
+          break  #found more info about service...
+
+      domain = svc.getAttribute("domain")
+      if domain != None:
+        if domain == fdom.getName():
+          svcmap = {}
+          svcmap['name'] = svcname
+          svcmap['status'] = sitem['running']
+          svcmap['svcurl'] = baseurl + "?pagetype=" + SERVICE + "&clustername=" + clustername + "&servicename=" + svcname
+          svcmap['location'] = sitem['nodename']
+          svclist.append(svcmap)
+    fdom_map['svclist'] = svclist
+    fdomlist.append(fdom_map)
+  return fdomlist
  
 def processClusterProps(self, ricci_agent, request):
   #First, retrieve cluster.conf from session


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