[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-10-04 15:11:10

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

Log message:
	labelling changes, fence code

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.80&r2=1.81
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceDevice.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&r1=1.1&r2=1.2

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/02 22:30:09	1.80
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/04 15:11:10	1.81
@@ -15,6 +15,7 @@
 from Netfs import Netfs
 from Script import Script
 from Samba import Samba
+from GeneralError import GeneralError
 
 #Policy for showing the cluster chooser menu:
 #1) If there are no clusters in the ManagedClusterSystems
@@ -583,7 +584,7 @@
     cldata['currentItem'] = False
 
   cladd = {}
-  cladd['Title'] = "Create"
+  cladd['Title'] = "Create a New Cluster"
   cladd['cfg_type'] = "clusteradd"
   cladd['absolute_url'] = url + "?pagetype=" + CLUSTER_ADD
   cladd['Description'] = "Create a Cluster"
@@ -2015,6 +2016,91 @@
 
   return resultlist
 
+def getFenceInfo(self, model, request=None):
+  map = list() 
+  level1 = list()
+  level2 = list()
+  map.append(level1)
+  map.append(level2)
+  nodename = ""
+  if request == None:  #this is being called by the fence device page
+    pass
+  else:
+    try:
+      nodename = request['nodename']
+    except KeyError, e:
+      raise GeneralError('FATAL', "Could not extract nodename from request")
+    
+    #here we need to get fences for a node - just the first two levels
+    #then fill in two data structures with all attr's 
+    try:
+      node = model.retrieveNodeByName(nodename)
+    except GeneralError, e:
+      raise GeneralError('FATAL', "Couldn't find node name in current node list")
+
+    levels = node.getFenceLevels()
+    len_levels = len(levels)
+
+    if len_levels == 0:
+      return map
+
+    for i in xrange(2):
+      fence_struct = {}
+      if levels[i] != None:
+        level = levels[i]
+      else:
+        #No more levels...
+        return map
+      kids = level.getChildren()
+      if len(kids) == 0:
+        continue
+      else:
+        #for each kid, 
+        ### resolve name, find fence device
+        ### Add fd to list, if it is not there yet 
+        ### determine if it is a shared fence type
+        ### if it is a shared device, add instance entry
+        fds = model.getFenceDevices()
+        fence_struct = None
+        for kid in kids:
+          name = kid.getName()
+          found_fd = False
+          for entry in map[i]:
+            if entry['name'] == name:
+              fence_struct = entry
+              found_fd = True
+              break
+          if found_fd == False:
+            for fd in fds:
+              if fd.getName() == name:  #Found the fence device
+                fence_struct = {}
+                fence_struct['isShareable'] = fd.isShared()
+                fd_attrs = fd.getAttributes()
+                kees = fd_attrs.keys()
+                for kee in kees:
+                  fence_struct[kee] = fd_attrs[kee]
+          fi_attrs = kid.getAttributes()
+          kees = fi_attrs.keys()
+          if fence_struct['isShareable'] == True:
+            instance_struct = {}
+            for kee in kees:
+              instance_struct[kee] = fi_attrs[kee]
+              try:
+                  check = fence_struct['instances']
+                  check.append(instance_struct)
+              except KeyError, e:
+                  fence_struct['instances'] = list()
+                  fence_struct['instances'].append(instance_struct) 
+          else:  #Not a shareable fence device type
+            for kee in kees:
+              fence_struct[kee] = fi_attrs[kee]
+      map[i].append(fence_struct)      
+
+    return map    
+      
+
+      
+
 def getLogsForNode(self, request):
   nodename = request['nodename']
   clustername = request['clustername']
--- conga/luci/site/luci/Extensions/FenceDevice.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/FenceDevice.py	2006/10/04 15:11:10	1.2
@@ -14,10 +14,28 @@
     self.fd_attrs = FenceHandler.FENCE_FD_ATTRS
     self.pretty_fence_names = FenceHandler.FENCE_OPTS
     self.pretty_name_attrs = FenceHandler.PRETTY_NAME_ATTRS
+    self.shared_fences = FenceHandler.FENCE_SHARED
+
+
 
   def getAgentType(self):
     return self.attr_hash["agent"]
 
+  def isShared(self):
+    agent = self.getAgentType()
+    if agent == "fence_drac": #2 variants of drac...
+      mname = self.getAttribute("modulename")
+      if mname == None or mname == "":
+        return False
+      else:
+        return True
+
+    try:
+      return self.shared_fences[agent]
+    except KeyError, e:
+      return False
+    
+
   def getProperties(self):
     stringbuf = ""
     agent_type = self.getAgentType()
--- conga/luci/site/luci/Extensions/FenceHandler.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/FenceHandler.py	2006/10/04 15:11:10	1.2
@@ -44,14 +44,32 @@
               "fence_vixel":"Vixel SAN Switch",
               "fence_gnbd":"Global Network Block Device",
               "fence_ilo":"HP ILO Device",
+              "fence_rsa":"IBM RSA II Device",
               "fence_sanbox2":"QLogic SANBox2",
               "fence_bladecenter":"IBM Blade Center",
               "fence_mcdata":"McDATA SAN Switch",
               "fence_egenera":"Egenera SAN Controller",
               "fence_bullpap":"Bull PAP",
+              "fence_drac":"DRAC",
               "fence_ipmilan":"IPMI Lan",
               "fence_manual":"Manual Fencing" }
 
+FENCE_SHARED = {"fence_apc":True,
+              "fence_wti":True,
+              "fence_brocade":True,
+              "fence_vixel":True,
+              "fence_gnbd":True,
+              "fence_ilo":False,
+              "fence_rsa":False,
+              "fence_sanbox2":True,
+              "fence_bladecenter":True,
+              "fence_mcdata":True,
+              "fence_egenera":True,
+              "fence_bullpap":True,
+              "fence_drac":False,
+              "fence_ipmilan":False,
+              "fence_manual":False }
+
 FENCE_FD_ATTRS = {"fence_apc":["name","ipaddr","login","passwd"],
               "fence_wti":["name","ipaddr","passwd"],
               "fence_brocade":["name","ipaddr","login","passwd"],


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