Skip to contentSkip to conversation

conga/luci/site/luci/Extensions LuciClusterInf ...

Cluster-devel [email protected] 1 participant 1 message May 16, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Branch: EXPERIMENTAL
Changes by: rmccabe at sourceware.org 2007-05-16 21:27:22

Modified files:
luci/site/luci/Extensions: LuciClusterInfo.py LuciDB.py
LuciZope.py cluster_adapters.py

Log message:
More cleanup and refactor.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.3&r2=1.1.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.6&r2=1.1.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZope.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.4&r2=1.1.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.255.2.5&r2=1.255.2.6

luci/site/luci/Extensions/Attic/LuciClusterInfo.py +1063 -983
@@ -5,7 +5,9 @@
 # GNU General Public License as published by the
 # Free Software Foundation.
 
+from Products.Archetypes.utils import make_uuid
 from ClusterModel.GeneralError import GeneralError
+from ClusterModel.ModelBuilder import ModelBuilder
 import RicciQueries as rq
 from ricci_communicator import RicciCommunicator
 from FenceHandler import FENCE_OPTS
@@ -29,7 +31,8 @@
 	try:
 		return map(lambda x: str(x.getName()), model.getNodes())
 	except Exception, e:
-		luci_log.debug_verbose('getnodes0: %s' % str(e))
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('getnodes0: %r' % e)
 	return []
 
 def getResourceInfo(model, name, res=None):
@@ -59,13 +62,68 @@
 def getResources(model):
 	return map(lambda x: getResourcesInfo(model, None, x), model.getResources())
 
+def getClusterStatusModel(model):
+	results = list()
+	vals = {}
+
+	try:
+		clustername = model.getClusterName()
+		clusteralias = model.getClusterAlias()
+		vals['type'] = 'cluster'
+		vals['alias'] = clusteralias
+		vals['name'] = clustername
+		vals['error'] = True
+		vals['votes'] = '[unknown]'
+		vals['quorate'] = '[unknown]'
+		vals['minQuorum'] = '[unknown]'
+		results.append(vals)
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('GCSM0: %r' % e)
+		return None
+
+	try:
+		nodelist = model.getNodes()
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('GCSM1: %r' % e)
+		return None
+
+	for node in nodelist:
+		node_val = {}
+		node_val['type'] = 'node'
+		try:
+			node_name = node.getName()
+			if not node_name:
+				raise Exception, 'cluster node name is unknown'
+		except:
+			node_name = '[unknown]'
+
+		node_val['name'] = node_name
+		node_val['clustered'] = '[unknown]'
+		node_val['online'] = '[unknown]'
+		node_val['error'] = True
+
+		try:
+			votes = node.getVotes()
+			if not votes:
+				raise Exception, 'unknown unmber of votes'
+		except:
+			votes = '[unknown]'
+
+		node_val['votes'] = votes
+		results.append(node_val)
+	return results
+
 def getClusterStatus(self, request, rc, cluname=None):
+
 	try:
 		doc = rq.getClusterStatusBatch(rc)
 		if not doc:
 			raise Exception, 'doc is None'
 	except Exception, e:
-		luci_log.debug_verbose('GCS0: error: %s' % str(e))
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('GCS0: error: %r' % e)
 		doc = None
 
 	if doc is None and not cluname:
@@ -76,11 +134,14 @@
 				raise Exception, 'cinfo is None'
 			return cinfo
 		except Exception, e:
-			luci_log.debug_verbose('GCS1: %s' % str(e))
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('GCS1: %r' % e)
 			doc = None
 
 	if not doc:
 		try:
+			from LuciDB import getClusterStatusDB
+
 			clustername = cluname
 			if clustername is None:
 				try:
@@ -99,12 +160,13 @@
 				raise Exception, 'cinfo is None'
 			return cinfo
 		except Exception, e:
-			luci_log.debug_verbose('GCS1a: unable to get cluster info from DB: %s' % str(e))
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('GCS1a: unable to get cluster info from DB: %r' % e)
 		return []
 
 	results = list()
 	vals = {}
-	vals['type'] = "cluster"
+	vals['type'] = 'cluster'
 
 	try:
 		vals['alias'] = doc.firstChild.getAttribute('alias')
@@ -120,7 +182,7 @@
 	for node in doc.firstChild.childNodes:
 		if node.nodeName == 'node':
 			vals = {}
-			vals['type'] = "node"
+			vals['type'] = 'node'
 			vals['clustered'] = node.getAttribute('clustered')
 			vals['name'] = node.getAttribute('name')
 			vals['online'] = node.getAttribute('online')
@@ -167,14 +229,14 @@
 			cluname = '[error retrieving cluster name]'
 
 	for item in status:
-		if item['type'] == "service":
+		if item['type'] == 'service':
 			itemmap = {}
 			itemmap['name'] = item['name']
 
 			cur_node = None
-			if item['running'] == "true":
+			if item['running'] == 'true':
 				cur_node = item['nodename']
-				itemmap['running'] = "true"
+				itemmap['running'] = 'true'
 				itemmap['nodename'] = cur_node
 				itemmap['disableurl'] = '%s?clustername=%s&servicename=%s&pagetype=%s' % (baseurl, cluname, item['name'], SERVICE_STOP)
 				itemmap['restarturl'] = '%s?clustername=%s&servicename=%s&pagetype=%s' % (baseurl, cluname, item['name'], SERVICE_RESTART)
@@ -213,11 +275,11 @@
 
 			itemmap['links'] = starturls
 
-			dom = svc.getAttribute("domain")
+			dom = svc.getAttribute('domain')
 			if dom is not None:
 				itemmap['faildom'] = dom
 			else:
-				itemmap['faildom'] = "No Failover Domain"
+				itemmap['faildom'] = 'No Failover Domain'
 			maplist.append(itemmap)
 
 	svc_map['services'] = maplist
@@ -228,6 +290,7 @@
 	#Next, check for children of it
 	#Call yourself on every children
 	#then return
+
 	rc_map = {}
 	if parent is not None:
 		rc_map['parent'] = parent
@@ -266,7 +329,6 @@
 
 
 def getServiceInfo(self, status, model, req):
-	from Products.Archetypes.utils import make_uuid
 	#set up struct for service config page
 	hmap = {}
 	root_uuid = 'toplevel'
@@ -340,7 +402,7 @@
 					innermap['links'] = starturls
 				else:
 					#Do not set ['running'] in this case...ZPT will detect it is missing
-					innermap['current'] = "Stopped"
+					innermap['current'] = 'Stopped'
 					innermap['enableurl'] = '%s?clustername=%s&servicename=%s&pagetype=%s' % (baseurl, cluname, servicename, SERVICE_START)
 					innermap['delurl'] = '%s?clustername=%s&servicename=%s&pagetype=%s' % (baseurl, cluname, servicename, SERVICE_DELETE)
 
@@ -400,19 +462,20 @@
 	try:
 		fdom = model.getFailoverDomainByName(request['fdomname'])
 	except Exception, e:
-		luci_log.debug_verbose('getFdomInfo0: %s' % str(e))
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('getFdomInfo0: %r' % e)
 		return fhash
 
 	fhash['name'] = fdom.getName()
 
 	ordered_attr = fdom.getAttribute('ordered')
-	if ordered_attr is not None and (ordered_attr == "true" or ordered_attr == "1"):
+	if ordered_attr is not None and (ordered_attr == 'true' or ordered_attr == '1'):
 		fhash['prioritized'] = '1'
 	else:
 		fhash['prioritized'] = '0'
 
 	restricted_attr = fdom.getAttribute('restricted')
-	if restricted_attr is not None and (restricted_attr == "true" or restricted_attr == "1"):
+	if restricted_attr is not None and (restricted_attr == 'true' or restricted_attr == '1'):
 		fhash['restricted'] = '1'
 	else:
 		fhash['restricted'] = '0'
@@ -426,972 +489,989 @@
 		fhash['members'][node.getName()] = { 'priority': priority }
 	return fhash
 
-
 def getFdomsInfo(self, model, 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 = request['URL']
-  fdoms = model.getFailoverDomains()
-  svcs = model.getServices()
-  for fdom in fdoms:
-    fdom_map = {}
-    fdom_map['name'] = fdom.getName()
-    fdom_map['cfgurl'] = '%s?pagetype=%s&clustername=%s&fdomname=%s' \
-		% (baseurl, FDOM, clustername, fdom.getName())
-    ordered_attr = fdom.getAttribute('ordered')
-    restricted_attr = fdom.getAttribute('restricted')
-    if ordered_attr is not None and (ordered_attr == "true" or ordered_attr == "1"):
-      fdom_map['ordered'] = True
-    else:
-      fdom_map['ordered'] = False
-    if restricted_attr is not None and (restricted_attr == "true" or restricted_attr == "1"):
-      fdom_map['restricted'] = True
-    else:
-      fdom_map['restricted'] = False
-    nodes = fdom.getChildren()
-    nodelist = list()
-    for node in nodes:
-      nodesmap = {}
-      ndname = node.getName()
-      for nitem in nlist:
-        if nitem['name'] == ndname:
-          break
-      nodesmap['nodename'] = ndname
-      nodesmap['nodecfgurl'] = '%s?clustername=%s&nodename=%s&pagetype=%s' \
-		% (baseurl, clustername, ndname, 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 is not None:
-        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 is not None:
-        if domain == fdom.getName():
-          svcmap = {}
-          svcmap['name'] = svcname
-          svcmap['status'] = sitem['running']
-          svcmap['svcurl'] = '%s?pagetype=%s&clustername=%s&servicename=%s' \
-			% (baseurl, SERVICE, clustername, svcname)
-          svcmap['location'] = sitem['nodename']
-          svclist.append(svcmap)
-    fdom_map['svclist'] = svclist
-    fdomlist.append(fdom_map)
-  return fdomlist
+	slist = list()
+	nlist = list()
+	fdomlist = list()
+
+	for item in clustatus:
+		if item['type'] == 'node':
+			nlist.append(item)
+		elif item['type'] == 'service':
+			slist.append(item)
+
+	clustername = request['clustername']
+	baseurl = request['URL']
+	fdoms = model.getFailoverDomains()
+	svcs = model.getServices()
+
+	for fdom in fdoms:
+		fdom_map = {}
+		fdom_name = fdom.getName()
+		fdom_map['name'] = fdom_name
+		fdom_map['cfgurl'] = '%s?pagetype=%s&clustername=%s&fdomname=%s' \
+			% (baseurl, FDOM, clustername, fdom.getName())
+
+		ordered_attr = fdom.getAttribute('ordered')
+		if ordered_attr is not None and (ordered_attr == 'true' or ordered_attr == '1'):
+			fdom_map['ordered'] = True
+		else:
+			fdom_map['ordered'] = False
+
+		restricted_attr = fdom.getAttribute('restricted')
+		if restricted_attr is not None and (restricted_attr == 'true' or restricted_attr == '1'):
+			fdom_map['restricted'] = True
+		else:
+			fdom_map['restricted'] = False
+
+		nodes = fdom.getChildren()
+		nodelist = list()
+		for node in nodes:
+			nodesmap = {}
+			ndname = node.getName()
+
+			for nitem in nlist:
+				if nitem['name'] == ndname:
+					nodesmap['nodename'] = ndname
+					nodesmap['nodecfgurl'] = '%s?clustername=%s&nodename=%s&pagetype=%s' \
+						% (baseurl, clustername, ndname, 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 is not None:
+						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:
+					domain = svc.getAttribute('domain')
+					if domain == fdom_name:
+						svcmap = {}
+						svcmap['name'] = svcname
+						svcmap['status'] = sitem['running']
+						svcmap['svcurl'] = '%s?pagetype=%s&clustername=%s&servicename=%s' \
+							% (baseurl, SERVICE, clustername, svcname)
+						svcmap['location'] = sitem['nodename']
+						svclist.append(svcmap)
+		fdom_map['svclist'] = svclist
+		fdomlist.append(fdom_map)
+
+	return fdomlist
 
 def getClusterInfo(self, model, req):
-  try:
-    cluname = req[CLUNAME]
-  except:
-    try:
-      cluname = req.form['clustername']
-    except:
-      try:
-        cluname = req.form['clusterName']
-      except:
-        luci_log.debug_verbose('GCI0: unable to determine cluster name')
-        return {}
-
-  clumap = {}
-  if model is None:
-    try:
-      model = getModelForCluster(self, cluname)
-      if not model:
-        raise Exception, 'model is none'
-      req.SESSION.set('model', model)
-    except Exception, e:
-      luci_log.debug_verbose('GCI1: unable to get model for cluster %s: %s' % (cluname, str(e)))
-      return {}
-  else:
-    totem = model.getTotemPtr()
-    if totem:
-      clumap['totem'] = totem.getAttributes()
+	try:
+		cluname = req[CLUNAME]
+	except:
+		try:
+			cluname = req.form['clustername']
+		except:
+			try:
+				cluname = req.form['clusterName']
+			except:
+				if LUCI_DEBUG_MODE is True:
+					luci_log.debug_verbose('GCI0: unable to determine cluster name')
+				return {}
 
-  prop_baseurl = '%s?pagetype=%s&clustername=%s&' \
+	clumap = {}
+	if model is None:
+		try:
+			model = getModelForCluster(self, cluname)
+			if not model:
+				raise Exception, 'model is none'
+			req.SESSION.set('model', model)
+		except Exception, e:
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('GCI1: unable to get model for cluster %s: %r' % (cluname, e))
+			return {}
+	else:
+		totem = model.getTotemPtr()
+		if totem:
+			clumap['totem'] = totem.getAttributes()
+
+	prop_baseurl = '%s?pagetype=%s&clustername=%s&' \
 	% (req['URL'], CLUSTER_CONFIG, cluname)
-  basecluster_url = '%stab=%s' % (prop_baseurl, PROP_GENERAL_TAB)
-  #needed:
-  clumap['basecluster_url'] = basecluster_url
-  #name field
-  clumap['clustername'] = model.getClusterAlias()
-  #config version
-  cp = model.getClusterPtr()
-  clumap['config_version'] = cp.getConfigVersion()
-  #-------------
-  #new cluster params - if rhel5
-  #-------------
-
-  clumap['fence_xvmd'] = model.hasFenceXVM()
-  gulm_ptr = model.getGULMPtr()
-  if not gulm_ptr:
-    #Fence Daemon Props
-    fencedaemon_url = '%stab=%s' % (prop_baseurl, PROP_FENCE_TAB)
-    clumap['fencedaemon_url'] = fencedaemon_url
-    fdp = model.getFenceDaemonPtr()
-    pjd = fdp.getAttribute('post_join_delay')
-    if pjd is None:
-      pjd = "6"
-    pfd = fdp.getAttribute('post_fail_delay')
-    if pfd is None:
-      pfd = "0"
-    #post join delay
-    clumap['pjd'] = pjd
-    #post fail delay
-    clumap['pfd'] = pfd
-
-    #-------------
-    #if multicast
-    multicast_url = '%stab=%s' % (prop_baseurl, PROP_MCAST_TAB)
-    clumap['multicast_url'] = multicast_url
-    #mcast addr
-    is_mcast = model.isMulticast()
-    if is_mcast:
-      clumap['mcast_addr'] = model.getMcastAddr()
-      clumap['is_mcast'] = "True"
-    else:
-      clumap['is_mcast'] = "False"
-      clumap['mcast_addr'] = "1.2.3.4"
-    clumap['gulm'] = False
-  else:
-    #-------------
-    #GULM params (rhel4 only)
-    lockserv_list = list()
-    clunodes = model.getNodes()
-    gulm_lockservs = map(lambda x: x.getName(), gulm_ptr.getChildren())
-    lockserv_list = map(lambda x: (x, True), gulm_lockservs)
-    for node in clunodes:
-      n = node.getName()
-      if not n in gulm_lockservs:
-        lockserv_list.append((n, False))
-    clumap['gulm'] = True
-    clumap['gulm_url'] = '%stab=%s' % (prop_baseurl, PROP_GULM_TAB)
-    clumap['gulm_lockservers'] = lockserv_list
-
-  #-------------
-  #quorum disk params
-  quorumd_url = '%stab=%s' % (prop_baseurl, PROP_QDISK_TAB)
-  clumap['quorumd_url'] = quorumd_url
-  is_quorumd = model.isQuorumd()
-  clumap['is_quorumd'] = is_quorumd
-  clumap['interval'] = ""
-  clumap['tko'] = ""
-  clumap['votes'] = ""
-  clumap['min_score'] = ""
-  clumap['device'] = ""
-  clumap['label'] = ""
-
-  #list struct for heuristics...
-  hlist = list()
-
-  if is_quorumd:
-    qdp = model.getQuorumdPtr()
-    interval = qdp.getAttribute('interval')
-    if interval is not None:
-      clumap['interval'] = interval
-
-    tko = qdp.getAttribute('tko')
-    if tko is not None:
-      clumap['tko'] = tko
-
-    votes = qdp.getAttribute('votes')
-    if votes is not None:
-      clumap['votes'] = votes
-
-    min_score = qdp.getAttribute('min_score')
-    if min_score is not None:
-      clumap['min_score'] = min_score
-
-    device = qdp.getAttribute('device')
-    if device is not None:
-      clumap['device'] = device
-
-    label = qdp.getAttribute('label')
-    if label is not None:
-      clumap['label'] = label
-
-    heuristic_kids = qdp.getChildren()
-
-    for kid in heuristic_kids:
-      hmap = {}
-      hprog = kid.getAttribute('program')
-      if hprog is None:
-        continue
-
-      hscore = kid.getAttribute('score')
-      hmap['hprog'] = hprog
-      if hscore is not None:
-        hmap['hscore'] = hscore
-      else:
-        hmap['hscore'] = ""
-
-      hinterval = kid.getAttribute('interval')
-      if hinterval is not None:
-        hmap['hinterval'] = hinterval
-      else:
-        hmap['hinterval'] = ""
-      hlist.append(hmap)
-  clumap['hlist'] = hlist
+	basecluster_url = '%stab=%s' % (prop_baseurl, PROP_GENERAL_TAB)
+	#needed:
+	clumap['basecluster_url'] = basecluster_url
+	#name field
+	clumap['clustername'] = model.getClusterAlias()
+	#config version
+	cp = model.getClusterPtr()
+	clumap['config_version'] = cp.getConfigVersion()
+	#-------------
+	#new cluster params - if rhel5
+	#-------------
+
+	clumap['fence_xvmd'] = model.hasFenceXVM()
+	gulm_ptr = model.getGULMPtr()
+	if not gulm_ptr:
+		#Fence Daemon Props
+		fencedaemon_url = '%stab=%s' % (prop_baseurl, PROP_FENCE_TAB)
+		clumap['fencedaemon_url'] = fencedaemon_url
+		fdp = model.getFenceDaemonPtr()
+		pjd = fdp.getAttribute('post_join_delay')
+		if pjd is None:
+			pjd = '6'
+		pfd = fdp.getAttribute('post_fail_delay')
+		if pfd is None:
+			pfd = '0'
+		#post join delay
+		clumap['pjd'] = pjd
+		#post fail delay
+		clumap['pfd'] = pfd
+
+		#-------------
+		#if multicast
+		multicast_url = '%stab=%s' % (prop_baseurl, PROP_MCAST_TAB)
+		clumap['multicast_url'] = multicast_url
+		#mcast addr
+		is_mcast = model.isMulticast()
+		if is_mcast:
+			clumap['mcast_addr'] = model.getMcastAddr()
+			clumap['is_mcast'] = 'True'
+		else:
+			clumap['is_mcast'] = 'False'
+			clumap['mcast_addr'] = '1.2.3.4'
+		clumap['gulm'] = False
+	else:
+		#-------------
+		#GULM params (rhel4 only)
+		lockserv_list = list()
+		clunodes = model.getNodes()
+		gulm_lockservs = map(lambda x: x.getName(), gulm_ptr.getChildren())
+		lockserv_list = map(lambda x: (x, True), gulm_lockservs)
+		for node in clunodes:
+			n = node.getName()
+			if not n in gulm_lockservs:
+				lockserv_list.append((n, False))
+		clumap['gulm'] = True
+		clumap['gulm_url'] = '%stab=%s' % (prop_baseurl, PROP_GULM_TAB)
+		clumap['gulm_lockservers'] = lockserv_list
+
+	#-------------
+	#quorum disk params
+	quorumd_url = '%stab=%s' % (prop_baseurl, PROP_QDISK_TAB)
+	clumap['quorumd_url'] = quorumd_url
+	is_quorumd = model.isQuorumd()
+	clumap['is_quorumd'] = is_quorumd
+	clumap['interval'] = ''
+	clumap['tko'] = ''
+	clumap['votes'] = ''
+	clumap['min_score'] = ''
+	clumap['device'] = ''
+	clumap['label'] = ''
+
+	#list struct for heuristics...
+	hlist = list()
+
+	if is_quorumd:
+		qdp = model.getQuorumdPtr()
+		interval = qdp.getAttribute('interval')
+		if interval is not None:
+			clumap['interval'] = interval
+
+		tko = qdp.getAttribute('tko')
+		if tko is not None:
+			clumap['tko'] = tko
+
+		votes = qdp.getAttribute('votes')
+		if votes is not None:
+			clumap['votes'] = votes
+
+		min_score = qdp.getAttribute('min_score')
+		if min_score is not None:
+			clumap['min_score'] = min_score
+
+		device = qdp.getAttribute('device')
+		if device is not None:
+			clumap['device'] = device
+
+		label = qdp.getAttribute('label')
+		if label is not None:
+			clumap['label'] = label
+
+		heuristic_kids = qdp.getChildren()
+
+		for kid in heuristic_kids:
+			hmap = {}
+			hprog = kid.getAttribute('program')
+			if hprog is None:
+				continue
+
+			hscore = kid.getAttribute('score')
+			hmap['hprog'] = hprog
+			if hscore is not None:
+				hmap['hscore'] = hscore
+			else:
+				hmap['hscore'] = ''
+
+			hinterval = kid.getAttribute('interval')
+			if hinterval is not None:
+				hmap['hinterval'] = hinterval
+			else:
+				hmap['hinterval'] = ''
+			hlist.append(hmap)
+	clumap['hlist'] = hlist
 
-  return clumap
+	return clumap
 
 def getClustersInfo(self, status, req):
-  clu_map = {}
-  nodelist = list()
-  svclist = list()
-  clulist = list()
-  baseurl = req['URL']
-
-  for item in status:
-    if item['type'] == "node":
-      nodelist.append(item)
-    elif item['type'] == "service":
-      svclist.append(item)
-    elif item['type'] == "cluster":
-      clulist.append(item)
-    else:
-      continue
-  if len(clulist) < 1:
-    return {}
-  clu = clulist[0]
-  if 'error' in clu:
-    clu_map['error'] = True
-  clustername = clu['name']
-  if clu['alias'] != "":
-    clu_map['clusteralias'] = clu['alias']
-  else:
-    clu_map['clusteralias'] = clustername
-  clu_map['clustername'] = clustername
-  if clu['quorate'] == "true":
-    clu_map['status'] = "Quorate"
-    clu_map['running'] = "true"
-  else:
-    clu_map['status'] = "Not Quorate"
-    clu_map['running'] = "false"
-  clu_map['votes'] = clu['votes']
-  clu_map['minquorum'] = clu['minQuorum']
+	clu_map = {}
+	nodelist = list()
+	svclist = list()
+	clulist = list()
+	baseurl = req['URL']
 
-  clu_map['clucfg'] = '%s?pagetype=%s&clustername=%s' \
+	for item in status:
+		if item['type'] == 'node':
+			nodelist.append(item)
+		elif item['type'] == 'service':
+			svclist.append(item)
+		elif item['type'] == 'cluster':
+			clulist.append(item)
+		else:
+			continue
+	if len(clulist) < 1:
+		return {}
+	clu = clulist[0]
+	if 'error' in clu:
+		clu_map['error'] = True
+	clustername = clu['name']
+	if not clu['alias']:
+		clu_map['clusteralias'] = clu['alias']
+	else:
+		clu_map['clusteralias'] = clustername
+	clu_map['clustername'] = clustername
+	if clu['quorate'] == 'true':
+		clu_map['status'] = 'Quorate'
+		clu_map['running'] = 'true'
+	else:
+		clu_map['status'] = 'Not Quorate'
+		clu_map['running'] = 'false'
+	clu_map['votes'] = clu['votes']
+	clu_map['minquorum'] = clu['minQuorum']
+
+	clu_map['clucfg'] = '%s?pagetype=%s&clustername=%s' \
 	% (baseurl, CLUSTER_CONFIG, clustername)
 
-  clu_map['restart_url'] = '%s?pagetype=%s&clustername=%s&task=%s' \
+	clu_map['restart_url'] = '%s?pagetype=%s&clustername=%s&task=%s' \
 	% (baseurl, CLUSTER_PROCESS, clustername, CLUSTER_RESTART)
-  clu_map['stop_url'] = '%s?pagetype=%s&clustername=%s&task=%s' \
+	clu_map['stop_url'] = '%s?pagetype=%s&clustername=%s&task=%s' \
 	% (baseurl, CLUSTER_PROCESS, clustername, CLUSTER_STOP)
-  clu_map['start_url'] = '%s?pagetype=%s&clustername=%s&task=%s' \
+	clu_map['start_url'] = '%s?pagetype=%s&clustername=%s&task=%s' \
 	% (baseurl, CLUSTER_PROCESS, clustername, CLUSTER_START)
-  clu_map['delete_url'] = '%s?pagetype=%s&clustername=%s&task=%s' \
+	clu_map['delete_url'] = '%s?pagetype=%s&clustername=%s&task=%s' \
 	% (baseurl, CLUSTER_PROCESS, clustername, CLUSTER_DELETE)
 
-  svc_dict_list = list()
-  for svc in svclist:
-      svc_dict = {}
-      svc_dict['nodename'] = svc['nodename']
-      svcname = svc['name']
-      svc_dict['name'] = svcname
-      svc_dict['srunning'] = svc['running']
-      svc_dict['servicename'] = svcname
-
-      if svc.has_key('is_vm') and svc['is_vm'] is True:
-        target_page = VM_CONFIG
-      else:
-        target_page = SERVICE
-
-      svcurl = '%s?pagetype=%s&clustername=%s&servicename=%s' \
-		% (baseurl, target_page, clustername, svcname)
-      svc_dict['svcurl'] = svcurl
-      svc_dict_list.append(svc_dict)
-  clu_map['currentservices'] = svc_dict_list
-  node_dict_list = list()
-
-  for item in nodelist:
-    nmap = {}
-    name = item['name']
-    nmap['nodename'] = name
-    cfgurl = '%s?pagetype=%s&clustername=%s&nodename=%s' \
+	svc_dict_list = list()
+	for svc in svclist:
+		svc_dict = {}
+		svc_dict['nodename'] = svc['nodename']
+		svcname = svc['name']
+		svc_dict['name'] = svcname
+		svc_dict['srunning'] = svc['running']
+		svc_dict['servicename'] = svcname
+
+		if svc.has_key('is_vm') and svc['is_vm'] is True:
+			target_page = VM_CONFIG
+		else:
+			target_page = SERVICE
+
+		svcurl = '%s?pagetype=%s&clustername=%s&servicename=%s' \
+			% (baseurl, target_page, clustername, svcname)
+		svc_dict['svcurl'] = svcurl
+		svc_dict_list.append(svc_dict)
+
+	clu_map['currentservices'] = svc_dict_list
+	node_dict_list = list()
+
+	for item in nodelist:
+		nmap = {}
+		name = item['name']
+		nmap['nodename'] = name
+		cfgurl = '%s?pagetype=%s&clustername=%s&nodename=%s' \
 		% (baseurl, NODE, clustername, name)
-    nmap['configurl'] = cfgurl
-    if item['clustered'] == "true":
-      nmap['status'] = NODE_ACTIVE
-    elif item['online'] == "false":
-      nmap['status'] = NODE_UNKNOWN
-    else:
-      nmap['status'] = NODE_INACTIVE
-    node_dict_list.append(nmap)
+		nmap['configurl'] = cfgurl
+		if item['clustered'] == 'true':
+			nmap['status'] = NODE_ACTIVE
+		elif item['online'] == 'false':
+			nmap['status'] = NODE_UNKNOWN
+		else:
+			nmap['status'] = NODE_INACTIVE
+		node_dict_list.append(nmap)
 
-  clu_map['currentnodes'] = node_dict_list
-  return clu_map
+	clu_map['currentnodes'] = node_dict_list
+	return clu_map
 
 def getNodeInfo(self, model, status, request):
-  infohash = {}
-  item = None
-  baseurl = request['URL']
-  nodestate = NODE_ACTIVE
-  svclist = list()
-  for thing in status:
-    if thing['type'] == "service":
-      svclist.append(thing)
-
-  #Get cluster name and node name from request
-  try:
-    clustername = request['clustername']
-    nodename = request['nodename']
-  except Exception, e:
-    luci_log.debug_verbose('getNodeInfo0: %s' % str(e))
-    return {}
-
-  #extract correct node line from cluster status
-  found = False
-  for item in status:
-    if (item['type'] == "node") and (item['name'] == nodename):
-      found = True
-      break
-  if found is False:
-    luci_log.debug_verbose('getNodeInfo1: Unable to resolve node name in cluster status')
-    return {}
-
-  #Now determine state of node...
-  if item['online'] == "false":
-    nodestate = NODE_UNKNOWN
-  elif item['clustered'] == "true":
-    nodestate = NODE_ACTIVE
-  else:
-    nodestate = NODE_INACTIVE
-
-  infohash['nodestate'] = nodestate
-  infohash['nodename'] = nodename
-
-  #set up drop down links
-  if nodestate == NODE_ACTIVE:
-    infohash['jl_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-      % (baseurl, NODE_PROCESS, NODE_LEAVE_CLUSTER, nodename, clustername)
-    infohash['reboot_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-      % (baseurl, NODE_PROCESS, NODE_REBOOT, nodename, clustername)
-    infohash['fence_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-      % (baseurl, NODE_PROCESS, NODE_FENCE, nodename, clustername)
-    infohash['delete_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-      % (baseurl, NODE_PROCESS, NODE_DELETE, nodename, clustername)
-  elif nodestate == NODE_INACTIVE:
-    infohash['jl_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-      % (baseurl, NODE_PROCESS, NODE_JOIN_CLUSTER, nodename, clustername)
-    infohash['reboot_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-      % (baseurl, NODE_PROCESS, NODE_REBOOT, nodename, clustername)
-    infohash['fence_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-      % (baseurl, NODE_PROCESS, NODE_FENCE, nodename, clustername)
-    infohash['delete_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-      % (baseurl, NODE_PROCESS, NODE_DELETE, nodename, clustername)
-  else:
-    infohash['fence_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-      % (baseurl, NODE_PROCESS, NODE_FENCE, nodename, clustername)
-
-  #figure out current services running on this node
-  svc_dict_list = list()
-  for svc in svclist:
-    if svc['nodename'] == nodename:
-      svc_dict = {}
-      svcname = svc['name']
-      svcurl = '%s?pagetype=%s&clustername=%s&servicename=%s' \
-        % (baseurl, SERVICE, clustername, svcname)
-      svc_dict['servicename'] = svcname
-      svc_dict['svcurl'] = svcurl
-      svc_dict_list.append(svc_dict)
-
-  infohash['currentservices'] = svc_dict_list
-
-  fdom_dict_list = list()
-  gulm_cluster = False
-  if model:
-    gulm_cluster = model.getGULMPtr() is not None
-    try:
-      infohash['gulm_lockserver'] = model.isNodeLockserver(nodename)
-    except:
-      infohash['gulm_lockserver'] = False
-    #next is faildoms
-    fdoms = model.getFailoverDomainsForNode(nodename)
-    for fdom in fdoms:
-      fdom_dict = {}
-      fdom_dict['name'] = fdom.getName()
-      fdomurl = '%s?pagetype=%s&clustername=%s&fdomname=%s' \
+	infohash = {}
+	item = None
+	baseurl = request['URL']
+	nodestate = NODE_ACTIVE
+	svclist = list()
+	for thing in status:
+		if thing['type'] == 'service':
+			svclist.append(thing)
+
+	# Get cluster name and node name from request
+	try:
+		clustername = request['clustername']
+		nodename = request['nodename']
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('getNodeInfo0: %r' % e)
+		return {}
+
+	# extract correct node line from cluster status
+	found = False
+	for item in status:
+		if (item['type'] == 'node') and (item['name'] == nodename):
+			found = True
+			break
+
+	if found is False:
+		item = {}
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('getNodeInfo1: Unable to resolve node name in cluster status')
+		return item
+
+	# Now determine state of node...
+	if item['online'] == 'false':
+		nodestate = NODE_UNKNOWN
+	elif item['clustered'] == 'true':
+		nodestate = NODE_ACTIVE
+	else:
+		nodestate = NODE_INACTIVE
+
+	infohash['nodestate'] = nodestate
+	infohash['nodename'] = nodename
+
+	# set up drop down links
+	if nodestate == NODE_ACTIVE:
+		infohash['jl_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+			% (baseurl, NODE_PROCESS, NODE_LEAVE_CLUSTER, nodename, clustername)
+		infohash['reboot_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+			% (baseurl, NODE_PROCESS, NODE_REBOOT, nodename, clustername)
+		infohash['fence_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+			% (baseurl, NODE_PROCESS, NODE_FENCE, nodename, clustername)
+		infohash['delete_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+			% (baseurl, NODE_PROCESS, NODE_DELETE, nodename, clustername)
+	elif nodestate == NODE_INACTIVE:
+		infohash['jl_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+			% (baseurl, NODE_PROCESS, NODE_JOIN_CLUSTER, nodename, clustername)
+		infohash['reboot_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+			% (baseurl, NODE_PROCESS, NODE_REBOOT, nodename, clustername)
+		infohash['fence_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+			% (baseurl, NODE_PROCESS, NODE_FENCE, nodename, clustername)
+		infohash['delete_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+			% (baseurl, NODE_PROCESS, NODE_DELETE, nodename, clustername)
+	else:
+		infohash['fence_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+			% (baseurl, NODE_PROCESS, NODE_FENCE, nodename, clustername)
+
+	# figure out current services running on this node
+	svc_dict_list = list()
+	for svc in svclist:
+		if svc['nodename'] == nodename:
+			svc_dict = {}
+			svcname = svc['name']
+			svcurl = '%s?pagetype=%s&clustername=%s&servicename=%s' \
+				% (baseurl, SERVICE, clustername, svcname)
+			svc_dict['servicename'] = svcname
+			svc_dict['svcurl'] = svcurl
+			svc_dict_list.append(svc_dict)
+
+	infohash['currentservices'] = svc_dict_list
+
+	fdom_dict_list = list()
+	gulm_cluster = False
+	if model:
+		gulm_cluster = model.getGULMPtr() is not None
+		try:
+			infohash['gulm_lockserver'] = model.isNodeLockserver(nodename)
+		except:
+			infohash['gulm_lockserver'] = False
+		# next is faildoms
+		fdoms = model.getFailoverDomainsForNode(nodename)
+		for fdom in fdoms:
+			fdom_dict = {}
+			fdom_dict['name'] = fdom.getName()
+			fdomurl = '%s?pagetype=%s&clustername=%s&fdomname=%s' \
 		% (baseurl, FDOM_CONFIG, clustername, fdom.getName())
-      fdom_dict['fdomurl'] = fdomurl
-      fdom_dict_list.append(fdom_dict)
-  else:
-    infohash['gulm_lockserver'] = False
-
-  infohash['fdoms'] = fdom_dict_list
-
-  #return infohash
-  infohash['d_states'] = None
-
-  nodename_resolved = resolve_nodename(self, clustername, nodename)
-
-  if nodestate == NODE_ACTIVE or nodestate == NODE_INACTIVE:
-  #call service module on node and find out which daemons are running
-    try:
-      rc = RicciCommunicator(nodename_resolved)
-      if not rc:
-        raise Exception, 'rc is none'
-    except Exception, e:
-      rc = None
-      infohash['ricci_error'] = True
-      luci_log.info('Error connecting to %s: %s' \
-          % (nodename_resolved, str(e)))
-
-    if rc is not None:
-      dlist = list()
-      dlist.append("ccsd")
-      if not gulm_cluster:
-        dlist.append("cman")
-        dlist.append("fenced")
-      else:
-        dlist.append("lock_gulmd")
-      dlist.append("rgmanager")
-      states = rq.getDaemonStates(rc, dlist)
-      infohash['d_states'] = states
-  else:
-    infohash['ricci_error'] = True
-
-  infohash['logurl'] = '/luci/logs/?nodename=%s&clustername=%s' \
-	% (nodename_resolved, clustername)
-  return infohash
+			fdom_dict['fdomurl'] = fdomurl
+			fdom_dict_list.append(fdom_dict)
+	else:
+		infohash['gulm_lockserver'] = False
+
+	infohash['fdoms'] = fdom_dict_list
+
+	# return infohash
+	infohash['d_states'] = None
+
+	nodename_resolved = resolve_nodename(self, clustername, nodename)
+
+	if nodestate == NODE_ACTIVE or nodestate == NODE_INACTIVE:
+	# call service module on node and find out which daemons are running
+		try:
+			rc = RicciCommunicator(nodename_resolved)
+			if not rc:
+				raise Exception, 'rc is none'
+		except Exception, e:
+			rc = None
+			infohash['ricci_error'] = True
+			luci_log.info('Error connecting to %s: %s' \
+				% (nodename_resolved, str(e)))
+
+		if rc is not None:
+			dlist = list()
+			dlist.append('ccsd')
+			if not gulm_cluster:
+				dlist.append('cman')
+				dlist.append('fenced')
+			else:
+				dlist.append('lock_gulmd')
+			dlist.append('rgmanager')
+			states = rq.getDaemonStates(rc, dlist)
+			infohash['d_states'] = states
+	else:
+		infohash['ricci_error'] = True
+
+	infohash['logurl'] = '/luci/logs/?nodename=%s&clustername=%s' \
+		% (nodename_resolved, clustername)
+	return infohash
 
 def getNodesInfo(self, model, status, req):
-  resultlist = list()
-  nodelist = list()
-  svclist = list()
-
-  #Sort into lists...
-  for item in status:
-    if item['type'] == "node":
-      nodelist.append(item)
-    elif item['type'] == "service":
-      svclist.append(item)
-    else:
-      continue
-
-  try:
-    clustername = req['clustername']
-    if not clustername:
-      raise KeyError, 'clustername is blank'
-  except:
-    try:
-      clustername = req.form['clustername']
-      raise KeyError, 'clustername is blank'
-    except:
-      try:
-        clustername = req.form['clusterName']
-      except:
-        try:
-          clustername = model.getClusterName()
-        except:
-          luci_log.debug_verbose('GNI0: unable to determine cluster name')
-          return {}
-
-  for item in nodelist:
-    nl_map = {}
-    name = item['name']
-    nl_map['nodename'] = name
-    try:
-      nl_map['gulm_lockserver'] = model.isNodeLockserver(name)
-    except:
-      nl_map['gulm_lockserver'] = False
-
-    try:
-      baseurl = req['URL']
-    except:
-      baseurl = '/luci/cluster/index_html'
-
-    cfgurl = '%s?pagetype=%s&clustername=%s&nodename=%s' \
-      % (baseurl, NODE, clustername, name)
-    nl_map['configurl'] = cfgurl
-    nl_map['fenceurl'] = '%s#fence' % cfgurl
-    if item['clustered'] == "true":
-      nl_map['status'] = NODE_ACTIVE
-      nl_map['status_str'] = NODE_ACTIVE_STR
-    elif item['online'] == "false":
-      nl_map['status'] = NODE_UNKNOWN
-      nl_map['status_str'] = NODE_UNKNOWN_STR
-    else:
-      nl_map['status'] = NODE_INACTIVE
-      nl_map['status_str'] = NODE_INACTIVE_STR
+	resultlist = list()
+	nodelist = list()
+	svclist = list()
+
+	#Sort into lists...
+	for item in status:
+		if item['type'] == 'node':
+			nodelist.append(item)
+		elif item['type'] == 'service':
+			svclist.append(item)
+		else:
+			continue
+
+	try:
+		clustername = req['clustername']
+		if not clustername:
+			raise KeyError, 'clustername is blank'
+	except:
+		try:
+			clustername = req.form['clustername']
+			raise KeyError, 'clustername is blank'
+		except:
+			try:
+				clustername = req.form['clusterName']
+			except:
+				try:
+					clustername = model.getClusterName()
+				except:
+					if LUCI_DEBUG_MODE is True:
+						luci_log.debug_verbose('GNI0: unable to determine cluster name')
+					return {}
+
+	for item in nodelist:
+		nl_map = {}
+		name = item['name']
+		nl_map['nodename'] = name
+		try:
+			nl_map['gulm_lockserver'] = model.isNodeLockserver(name)
+		except:
+			nl_map['gulm_lockserver'] = False
 
-    nodename_resolved = resolve_nodename(self, clustername, name)
+		try:
+			baseurl = req['URL']
+		except:
+			baseurl = '/luci/cluster/index_html'
 
-    nl_map['logurl'] = '/luci/logs?nodename=%s&clustername=%s' \
+		cfgurl = '%s?pagetype=%s&clustername=%s&nodename=%s' \
+			% (baseurl, NODE, clustername, name)
+		nl_map['configurl'] = cfgurl
+		nl_map['fenceurl'] = '%s#fence' % cfgurl
+		if item['clustered'] == 'true':
+			nl_map['status'] = NODE_ACTIVE
+			nl_map['status_str'] = NODE_ACTIVE_STR
+		elif item['online'] == 'false':
+			nl_map['status'] = NODE_UNKNOWN
+			nl_map['status_str'] = NODE_UNKNOWN_STR
+		else:
+			nl_map['status'] = NODE_INACTIVE
+			nl_map['status_str'] = NODE_INACTIVE_STR
+
+		nodename_resolved = resolve_nodename(self, clustername, name)
+
+		nl_map['logurl'] = '/luci/logs?nodename=%s&clustername=%s' \
 		% (nodename_resolved, clustername)
 
-    #set up URLs for dropdown menu...
-    if nl_map['status'] == NODE_ACTIVE:
-      nl_map['jl_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-        % (baseurl, NODE_PROCESS, NODE_LEAVE_CLUSTER, name, clustername)
-      nl_map['reboot_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-        % (baseurl, NODE_PROCESS, NODE_REBOOT, name, clustername)
-      nl_map['fence_it_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-        % (baseurl, NODE_PROCESS, NODE_FENCE, name, clustername)
-      nl_map['delete_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-        % (baseurl, NODE_PROCESS, NODE_DELETE, name, clustername)
-    elif nl_map['status'] == NODE_INACTIVE:
-      nl_map['jl_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-        % (baseurl, NODE_PROCESS, NODE_JOIN_CLUSTER, name, clustername)
-      nl_map['reboot_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-        % (baseurl, NODE_PROCESS, NODE_REBOOT, name, clustername)
-      nl_map['fence_it_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-        % (baseurl, NODE_PROCESS, NODE_FENCE, name, clustername)
-      nl_map['delete_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-        % (baseurl, NODE_PROCESS, NODE_DELETE, name, clustername)
-    else:
-      nl_map['fence_it_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
-        % (baseurl, NODE_PROCESS, NODE_FENCE, name, clustername)
-
-    #figure out current services running on this node
-    svc_dict_list = list()
-    for svc in svclist:
-      if svc['nodename'] == name:
-        svc_dict = {}
-        svcname = svc['name']
-        svcurl = '%s?pagetype=%s&clustername=%s&servicename=%s' \
-          % (baseurl, SERVICE, clustername, svcname)
-        svc_dict['servicename'] = svcname
-        svc_dict['svcurl'] = svcurl
-        svc_dict_list.append(svc_dict)
-
-    nl_map['currentservices'] = svc_dict_list
-    #next is faildoms
-
-    if model:
-      fdoms = model.getFailoverDomainsForNode(name)
-    else:
-      nl_map['ricci_error'] = True
-      fdoms = list()
-    fdom_dict_list = list()
-    for fdom in fdoms:
-      fdom_dict = {}
-      fdom_dict['name'] = fdom.getName()
-      fdomurl = '%s?pagetype=%s&clustername=%s&fdomname=%s' \
+		#set up URLs for dropdown menu...
+		if nl_map['status'] == NODE_ACTIVE:
+			nl_map['jl_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+				% (baseurl, NODE_PROCESS, NODE_LEAVE_CLUSTER, name, clustername)
+			nl_map['reboot_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+				% (baseurl, NODE_PROCESS, NODE_REBOOT, name, clustername)
+			nl_map['fence_it_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+				% (baseurl, NODE_PROCESS, NODE_FENCE, name, clustername)
+			nl_map['delete_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+				% (baseurl, NODE_PROCESS, NODE_DELETE, name, clustername)
+		elif nl_map['status'] == NODE_INACTIVE:
+			nl_map['jl_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+				% (baseurl, NODE_PROCESS, NODE_JOIN_CLUSTER, name, clustername)
+			nl_map['reboot_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+				% (baseurl, NODE_PROCESS, NODE_REBOOT, name, clustername)
+			nl_map['fence_it_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+				% (baseurl, NODE_PROCESS, NODE_FENCE, name, clustername)
+			nl_map['delete_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+				% (baseurl, NODE_PROCESS, NODE_DELETE, name, clustername)
+		else:
+			nl_map['fence_it_url'] = '%s?pagetype=%s&task=%s&nodename=%s&clustername=%s' \
+				% (baseurl, NODE_PROCESS, NODE_FENCE, name, clustername)
+
+		#figure out current services running on this node
+		svc_dict_list = list()
+		for svc in svclist:
+			if svc['nodename'] == name:
+				svc_dict = {}
+				svcname = svc['name']
+				svcurl = '%s?pagetype=%s&clustername=%s&servicename=%s' \
+					% (baseurl, SERVICE, clustername, svcname)
+				svc_dict['servicename'] = svcname
+				svc_dict['svcurl'] = svcurl
+				svc_dict_list.append(svc_dict)
+
+		nl_map['currentservices'] = svc_dict_list
+		#next is faildoms
+
+		if model:
+			fdoms = model.getFailoverDomainsForNode(name)
+		else:
+			nl_map['ricci_error'] = True
+			fdoms = list()
+		fdom_dict_list = list()
+		for fdom in fdoms:
+			fdom_dict = {}
+			fdom_dict['name'] = fdom.getName()
+			fdomurl = '%s?pagetype=%s&clustername=%s&fdomname=%s' \
 		% (baseurl, FDOM_CONFIG, clustername, fdom.getName())
-      fdom_dict['fdomurl'] = fdomurl
-      fdom_dict_list.append(fdom_dict)
+			fdom_dict['fdomurl'] = fdomurl
+			fdom_dict_list.append(fdom_dict)
 
-    nl_map['fdoms'] = fdom_dict_list
-    resultlist.append(nl_map)
+		nl_map['fdoms'] = fdom_dict_list
+		resultlist.append(nl_map)
 
-  return resultlist
+	return resultlist
 
 def getFence(self, model, request):
-  if not model:
-    luci_log.debug_verbose('getFence0: model is None')
-    return {}
-
-  fence_map = {}
-  fencename = request['fencename']
-  fencedevs = model.getFenceDevices()
-  for fencedev in fencedevs:
-    if fencedev.getName().strip() == fencename:
-      fence_map = fencedev.getAttributes()
-      try:
-        fence_map['pretty_name'] = FENCE_OPTS[fencedev.getAgentType()]
-      except:
-        fence_map['unknown'] = True
-        fence_map['pretty_name'] = fencedev.getAgentType()
-
-      nodes_used = list()
-      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() == fencedev.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 is True:
-                continue
-              baseurl = request['URL']
-              clustername = model.getClusterName()
-              node_hash = {}
-              cur_nodename = node.getName().strip()
-              node_hash['nodename'] = cur_nodename
-              node_hash['nodeurl'] = '%s?clustername=%s&nodename=%s&pagetype=%s' \
-                % (baseurl, clustername, cur_nodename, NODE)
-              nodes_used.append(node_hash)
+	if not model:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('getFence0: model is None')
+		return {}
 
-      fence_map['nodesused'] = nodes_used
-      return fence_map
+	fence_map = {}
+	fencename = request['fencename']
+	fencedevs = model.getFenceDevices()
+	for fencedev in fencedevs:
+		if fencedev.getName().strip() == fencename:
+			fence_map = fencedev.getAttributes()
+			try:
+				fence_map['pretty_name'] = FENCE_OPTS[fencedev.getAgentType()]
+			except:
+				fence_map['unknown'] = True
+				fence_map['pretty_name'] = fencedev.getAgentType()
+
+			nodes_used = list()
+			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() == fencedev.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 is True:
+								continue
+							baseurl = request['URL']
+							clustername = model.getClusterName()
+							node_hash = {}
+							cur_nodename = node.getName().strip()
+							node_hash['nodename'] = cur_nodename
+							node_hash['nodeurl'] = '%s?clustername=%s&nodename=%s&pagetype=%s' \
+								% (baseurl, clustername, cur_nodename, NODE)
+							nodes_used.append(node_hash)
+
+			fence_map['nodesused'] = nodes_used
+			return fence_map
 
-  return fence_map
+	return fence_map
 
 def getFDForInstance(fds, name):
-  for fd in fds:
-    if fd.getName().strip() == name:
-      return fd
+	for fd in fds:
+		if fd.getName().strip() == name:
+			return fd
 
-  raise
+	raise
 
 def getFenceInfo(self, model, request):
-  if not model:
-    luci_log.debug_verbose('getFenceInfo00: model is None')
-    return {}
-
-  try:
-    clustername = request['clustername']
-  except:
-    try:
-      clustername = request.form['clustername']
-    except:
-      luci_log.debug_verbose('getFenceInfo0: unable to determine cluster name')
-      return {}
-
-  try:
-    baseurl = request['URL']
-  except Exception, e:
-    luci_log.debug_verbose('getFenceInfo1: no request.URL')
-    return {}
-
-  fence_map = {}
-  level1 = list() #First level fence devices
-  level2 = list() #Second level fence devices
-  shared1 = list() #List of available sharable fence devs not used in level1
-  shared2 = list() #List of available sharable fence devs not used in level2
-  fence_map['level1'] = level1
-  fence_map['level2'] = level2
-  fence_map['shared1'] = shared1
-  fence_map['shared2'] = shared2
-
-  major_num = 1
-  minor_num = 100
-
-  try:
-    nodename = request['nodename']
-  except:
-    try:
-      nodename = request.form['nodename']
-    except:
-      luci_log.debug_verbose('getFenceInfo2: unable to extract nodename: %s' \
-          % str(e))
-      return {}
-
-  #Here we need to get fences for a node - just the first two levels
-  #Each level has its own list of fence devs used in that level
-  #For each fence dev, a list of instance structs is appended
-  #In addition, for each level, a list of available but unused fence devs
-  #is returned.
-  try:
-    node = model.retrieveNodeByName(nodename)
-  except GeneralError, e:
-    luci_log.debug_verbose('getFenceInfo3: unabel to find node name %s in current node list' % (str(nodename), str(e)))
-    return {}
-
-  fds = model.getFenceDevices()
-
-  levels = node.getFenceLevels()
-  len_levels = len(levels)
-
-  if len_levels == 0:
-    return fence_map
-
-  if len_levels >= 1:
-    first_level = levels[0]
-    kids = first_level.getChildren()
-    last_kid_fd = None  #This is a marker for allowing multi instances
-                        #beneath a fencedev
-    for kid in kids:
-      instance_name = kid.getName().strip()
-      try:
-        fd = getFDForInstance(fds, instance_name)
-      except:
-        fd = None #Set to None in case last time thru loop
-        continue
-
-      if fd is not None:
-        if fd.isShared() is False:  #Not a shared dev...build struct and add
-          fencedev = {}
-          try:
-            fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
-          except:
-            fencedev['unknown'] = True
-            fencedev['prettyname'] = fd.getAgentType()
-          fencedev['isShared'] = False
-          fencedev['id'] = str(major_num)
-          major_num = major_num + 1
-          devattrs = fd.getAttributes()
-          kees = devattrs.keys()
-          for kee in kees:
-            fencedev[kee] = devattrs[kee]
-          kidattrs = kid.getAttributes()
-          kees = kidattrs.keys()
-          for kee in kees:
-            if kee == "name":
-              continue #Don't duplicate name attr
-            fencedev[kee] = kidattrs[kee]
-          #This fencedev struct is complete, and needs to be placed on the
-          #level1 Q. Because it is non-shared, we should set last_kid_fd
-          #to none.
-          last_kid_fd = None
-          level1.append(fencedev)
-        else:  #This dev is shared
-          if (last_kid_fd is not None) and (fd.getName().strip() == last_kid_fd['name'].strip()):  #just append a new instance struct to last_kid_fd
-            instance_struct = {}
-            instance_struct['id'] = str(minor_num)
-            minor_num = minor_num + 1
-            kidattrs = kid.getAttributes()
-            kees = kidattrs.keys()
-            for kee in kees:
-              if kee == "name":
-                continue
-              instance_struct[kee] = kidattrs[kee]
-            #Now just add this struct to last_kid_fd and reset last_kid_fd
-            ilist = last_kid_fd['instance_list']
-            ilist.append(instance_struct)
-            #last_kid_fd = fd
-            continue
-          else: #Shared, but not used above...so we need a new fencedev struct
-            fencedev = {}
-            try:
-              fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
-            except:
-              fencedev['unknown'] = True
-              fencedev['prettyname'] = fd.getAgentType()
-            fencedev['isShared'] = True
-            fencedev['cfgurl'] = '%s?clustername=%s&fencename=%s&pagetype=%s' \
-              % (baseurl, clustername, fd.getName().strip(), FENCEDEV)
-            fencedev['id'] = str(major_num)
-            major_num = major_num + 1
-            inlist = list()
-            fencedev['instance_list'] = inlist
-            devattrs = fd.getAttributes()
-            kees = devattrs.keys()
-            for kee in kees:
-              fencedev[kee] = devattrs[kee]
-            instance_struct = {}
-            kidattrs = kid.getAttributes()
-            kees = kidattrs.keys()
-            for kee in kees:
-              if kee == "name":
-                continue
-              instance_struct[kee] = kidattrs[kee]
-            inlist.append(instance_struct)
-            level1.append(fencedev)
-            last_kid_fd = fencedev
-            continue
-    fence_map['level1'] = level1
-
-    #level1 list is complete now, but it is still necessary to build shared1
-    for fd in fds:
-      isUnique = True
-      if fd.isShared() is False:
-        continue
-      for fdev in level1:
-        if fd.getName().strip() == fdev['name']:
-          isUnique = False
-          break
-      if isUnique is True:
-        shared_struct = {}
-        shared_struct['name'] = fd.getName().strip()
-        agentname = fd.getAgentType()
-        shared_struct['agent'] = agentname
-        try:
-          shared_struct['prettyname'] = FENCE_OPTS[agentname]
-        except:
-          shared_struct['unknown'] = True
-          shared_struct['prettyname'] = agentname
-        shared1.append(shared_struct)
-    fence_map['shared1'] = shared1
-
-  #YUK: This next section violates the DRY rule, :-(
-  if len_levels >= 2:
-    second_level = levels[1]
-    kids = second_level.getChildren()
-    last_kid_fd = None  #This is a marker for allowing multi instances
-                        #beneath a fencedev
-    for kid in kids:
-      instance_name = kid.getName().strip()
-      try:
-        fd = getFDForInstance(fds, instance_name)
-      except:
-        fd = None #Set to None in case last time thru loop
-        continue
-      if fd is not None:
-        if fd.isShared() is False:  #Not a shared dev...build struct and add
-          fencedev = {}
-          try:
-            fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
-          except:
-            fencedev['unknown'] = True
-            fencedev['prettyname'] = fd.getAgentType()
-          fencedev['isShared'] = False
-          fencedev['id'] = str(major_num)
-          major_num = major_num + 1
-          devattrs = fd.getAttributes()
-          kees = devattrs.keys()
-          for kee in kees:
-            fencedev[kee] = devattrs[kee]
-          kidattrs = kid.getAttributes()
-          kees = kidattrs.keys()
-          for kee in kees:
-            if kee == "name":
-              continue #Don't duplicate name attr
-            fencedev[kee] = kidattrs[kee]
-          #This fencedev struct is complete, and needs to be placed on the
-          #level2 Q. Because it is non-shared, we should set last_kid_fd
-          #to none.
-          last_kid_fd = None
-          level2.append(fencedev)
-        else:  #This dev is shared
-          if (last_kid_fd is not None) and (fd.getName().strip() == last_kid_fd['name'].strip()):  #just append a new instance struct to last_kid_fd
-            instance_struct = {}
-            instance_struct['id'] = str(minor_num)
-            minor_num = minor_num + 1
-            kidattrs = kid.getAttributes()
-            kees = kidattrs.keys()
-            for kee in kees:
-              if kee == "name":
-                continue
-              instance_struct[kee] = kidattrs[kee]
-            #Now just add this struct to last_kid_fd and reset last_kid_fd
-            ilist = last_kid_fd['instance_list']
-            ilist.append(instance_struct)
-            #last_kid_fd = fd
-            continue
-          else: #Shared, but not used above...so we need a new fencedev struct
-            fencedev = {}
-            try:
-              fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
-            except:
-              fencedev['unknown'] = True
-              fencedev['prettyname'] = fd.getAgentType()
-            fencedev['isShared'] = True
-            fencedev['cfgurl'] = '%s?clustername=%s&fencename=%s&pagetype=%s' \
-              % (baseurl, clustername, fd.getName().strip(), FENCEDEV)
-            fencedev['id'] = str(major_num)
-            major_num = major_num + 1
-            inlist = list()
-            fencedev['instance_list'] = inlist
-            devattrs = fd.getAttributes()
-            kees = devattrs.keys()
-            for kee in kees:
-              fencedev[kee] = devattrs[kee]
-            instance_struct = {}
-            kidattrs = kid.getAttributes()
-            kees = kidattrs.keys()
-            for kee in kees:
-              if kee == "name":
-                continue
-              instance_struct[kee] = kidattrs[kee]
-            inlist.append(instance_struct)
-            level2.append(fencedev)
-            last_kid_fd = fencedev
-            continue
-    fence_map['level2'] = level2
-
-    #level2 list is complete but like above, we need to build shared2
-    for fd in fds:
-      isUnique = True
-      if fd.isShared() is False:
-        continue
-      for fdev in level2:
-        if fd.getName().strip() == fdev['name']:
-          isUnique = False
-          break
-      if isUnique is True:
-        shared_struct = {}
-        shared_struct['name'] = fd.getName().strip()
-        agentname = fd.getAgentType()
-        shared_struct['agent'] = agentname
-        try:
-          shared_struct['prettyname'] = FENCE_OPTS[agentname]
-        except:
-          shared_struct['unknown'] = True
-          shared_struct['prettyname'] = agentname
-        shared2.append(shared_struct)
-    fence_map['shared2'] = shared2
+	if not model:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('getFenceInfo00: model is None')
+		return {}
+
+	try:
+		clustername = request['clustername']
+	except:
+		try:
+			clustername = request.form['clustername']
+		except:
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('getFenceInfo0: unable to determine cluster name')
+			return {}
+
+	try:
+		baseurl = request['URL']
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('getFenceInfo1: no request.URL')
+		return {}
 
-  return fence_map
+	fence_map = {}
+	level1 = list() #First level fence devices
+	level2 = list() #Second level fence devices
+	shared1 = list() #List of available sharable fence devs not used in level1
+	shared2 = list() #List of available sharable fence devs not used in level2
+	fence_map['level1'] = level1
+	fence_map['level2'] = level2
+	fence_map['shared1'] = shared1
+	fence_map['shared2'] = shared2
+
+	major_num = 1
+	minor_num = 100
+
+	try:
+		nodename = request['nodename']
+	except:
+		try:
+			nodename = request.form['nodename']
+		except:
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('getFenceInfo2: unable to extract nodename: %r' % e)
+			return {}
+
+	# Here we need to get fences for a node - just the first two levels
+	# Each level has its own list of fence devs used in that level
+	# For each fence dev, a list of instance structs is appended
+	# In addition, for each level, a list of available but unused fence devs
+	# is returned.
+	try:
+		node = model.retrieveNodeByName(nodename)
+	except GeneralError, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('getFenceInfo3: unable to find node name "%s" in current node list: %r' % (str(nodename), e))
+		return {}
+
+	fds = model.getFenceDevices()
+
+	levels = node.getFenceLevels()
+	len_levels = len(levels)
+
+	if len_levels == 0:
+		return fence_map
+
+	if len_levels >= 1:
+		first_level = levels[0]
+		kids = first_level.getChildren()
+		last_kid_fd = None	#This is a marker for allowing multi instances
+												#beneath a fencedev
+		for kid in kids:
+			instance_name = kid.getName().strip()
+			try:
+				fd = getFDForInstance(fds, instance_name)
+			except:
+				fd = None #Set to None in case last time thru loop
+				continue
+
+			if fd is not None:
+				if fd.isShared() is False:	#Not a shared dev...build struct and add
+					fencedev = {}
+					try:
+						fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+					except:
+						fencedev['unknown'] = True
+						fencedev['prettyname'] = fd.getAgentType()
+					fencedev['isShared'] = False
+					fencedev['id'] = str(major_num)
+					major_num = major_num + 1
+					devattrs = fd.getAttributes()
+					kees = devattrs.keys()
+					for kee in kees:
+						fencedev[kee] = devattrs[kee]
+					kidattrs = kid.getAttributes()
+					kees = kidattrs.keys()
+					for kee in kees:
+						if kee == 'name':
+							continue #Don't duplicate name attr
+						fencedev[kee] = kidattrs[kee]
+					#This fencedev struct is complete, and needs to be placed on the
+					#level1 Q. Because it is non-shared, we should set last_kid_fd
+					#to none.
+					last_kid_fd = None
+					level1.append(fencedev)
+				else:	#This dev is shared
+					if (last_kid_fd is not None) and (fd.getName().strip() == last_kid_fd['name'].strip()):	#just append a new instance struct to last_kid_fd
+						instance_struct = {}
+						instance_struct['id'] = str(minor_num)
+						minor_num = minor_num + 1
+						kidattrs = kid.getAttributes()
+						kees = kidattrs.keys()
+						for kee in kees:
+							if kee == 'name':
+								continue
+							instance_struct[kee] = kidattrs[kee]
+						#Now just add this struct to last_kid_fd and reset last_kid_fd
+						ilist = last_kid_fd['instance_list']
+						ilist.append(instance_struct)
+						#last_kid_fd = fd
+						continue
+					else: #Shared, but not used above...so we need a new fencedev struct
+						fencedev = {}
+						try:
+							fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+						except:
+							fencedev['unknown'] = True
+							fencedev['prettyname'] = fd.getAgentType()
+						fencedev['isShared'] = True
+						fencedev['cfgurl'] = '%s?clustername=%s&fencename=%s&pagetype=%s' \
+							% (baseurl, clustername, fd.getName().strip(), FENCEDEV)
+						fencedev['id'] = str(major_num)
+						major_num = major_num + 1
+						inlist = list()
+						fencedev['instance_list'] = inlist
+						devattrs = fd.getAttributes()
+						kees = devattrs.keys()
+						for kee in kees:
+							fencedev[kee] = devattrs[kee]
+						instance_struct = {}
+						kidattrs = kid.getAttributes()
+						kees = kidattrs.keys()
+						for kee in kees:
+							if kee == 'name':
+								continue
+							instance_struct[kee] = kidattrs[kee]
+						inlist.append(instance_struct)
+						level1.append(fencedev)
+						last_kid_fd = fencedev
+						continue
+		fence_map['level1'] = level1
+
+		#level1 list is complete now, but it is still necessary to build shared1
+		for fd in fds:
+			isUnique = True
+			if fd.isShared() is False:
+				continue
+			for fdev in level1:
+				if fd.getName().strip() == fdev['name']:
+					isUnique = False
+					break
+			if isUnique is True:
+				shared_struct = {}
+				shared_struct['name'] = fd.getName().strip()
+				agentname = fd.getAgentType()
+				shared_struct['agent'] = agentname
+				try:
+					shared_struct['prettyname'] = FENCE_OPTS[agentname]
+				except:
+					shared_struct['unknown'] = True
+					shared_struct['prettyname'] = agentname
+				shared1.append(shared_struct)
+		fence_map['shared1'] = shared1
+
+	#YUK: This next section violates the DRY rule, :-(
+	if len_levels >= 2:
+		second_level = levels[1]
+		kids = second_level.getChildren()
+		last_kid_fd = None	#This is a marker for allowing multi instances
+												#beneath a fencedev
+		for kid in kids:
+			instance_name = kid.getName().strip()
+			try:
+				fd = getFDForInstance(fds, instance_name)
+			except:
+				fd = None #Set to None in case last time thru loop
+				continue
+			if fd is not None:
+				if fd.isShared() is False:	#Not a shared dev...build struct and add
+					fencedev = {}
+					try:
+						fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+					except:
+						fencedev['unknown'] = True
+						fencedev['prettyname'] = fd.getAgentType()
+					fencedev['isShared'] = False
+					fencedev['id'] = str(major_num)
+					major_num = major_num + 1
+					devattrs = fd.getAttributes()
+					kees = devattrs.keys()
+					for kee in kees:
+						fencedev[kee] = devattrs[kee]
+					kidattrs = kid.getAttributes()
+					kees = kidattrs.keys()
+					for kee in kees:
+						if kee == 'name':
+							continue #Don't duplicate name attr
+						fencedev[kee] = kidattrs[kee]
+					#This fencedev struct is complete, and needs to be placed on the
+					#level2 Q. Because it is non-shared, we should set last_kid_fd
+					#to none.
+					last_kid_fd = None
+					level2.append(fencedev)
+				else:	#This dev is shared
+					if (last_kid_fd is not None) and (fd.getName().strip() == last_kid_fd['name'].strip()):	#just append a new instance struct to last_kid_fd
+						instance_struct = {}
+						instance_struct['id'] = str(minor_num)
+						minor_num = minor_num + 1
+						kidattrs = kid.getAttributes()
+						kees = kidattrs.keys()
+						for kee in kees:
+							if kee == 'name':
+								continue
+							instance_struct[kee] = kidattrs[kee]
+						#Now just add this struct to last_kid_fd and reset last_kid_fd
+						ilist = last_kid_fd['instance_list']
+						ilist.append(instance_struct)
+						#last_kid_fd = fd
+						continue
+					else: #Shared, but not used above...so we need a new fencedev struct
+						fencedev = {}
+						try:
+							fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+						except:
+							fencedev['unknown'] = True
+							fencedev['prettyname'] = fd.getAgentType()
+						fencedev['isShared'] = True
+						fencedev['cfgurl'] = '%s?clustername=%s&fencename=%s&pagetype=%s' \
+							% (baseurl, clustername, fd.getName().strip(), FENCEDEV)
+						fencedev['id'] = str(major_num)
+						major_num = major_num + 1
+						inlist = list()
+						fencedev['instance_list'] = inlist
+						devattrs = fd.getAttributes()
+						kees = devattrs.keys()
+						for kee in kees:
+							fencedev[kee] = devattrs[kee]
+						instance_struct = {}
+						kidattrs = kid.getAttributes()
+						kees = kidattrs.keys()
+						for kee in kees:
+							if kee == 'name':
+								continue
+							instance_struct[kee] = kidattrs[kee]
+						inlist.append(instance_struct)
+						level2.append(fencedev)
+						last_kid_fd = fencedev
+						continue
+		fence_map['level2'] = level2
+
+		#level2 list is complete but like above, we need to build shared2
+		for fd in fds:
+			isUnique = True
+			if fd.isShared() is False:
+				continue
+			for fdev in level2:
+				if fd.getName().strip() == fdev['name']:
+					isUnique = False
+					break
+			if isUnique is True:
+				shared_struct = {}
+				shared_struct['name'] = fd.getName().strip()
+				agentname = fd.getAgentType()
+				shared_struct['agent'] = agentname
+				try:
+					shared_struct['prettyname'] = FENCE_OPTS[agentname]
+				except:
+					shared_struct['unknown'] = True
+					shared_struct['prettyname'] = agentname
+				shared2.append(shared_struct)
+		fence_map['shared2'] = shared2
+
+	return fence_map
 
 def getFencesInfo(self, model, request):
-  fences_map = {}
-  if not model:
-    if LUCI_DEBUG_MODE is True:
-      luci_log.debug_verbose('getFencesInfo0: model is None')
-    fences_map['fencedevs'] = list()
-    return fences_map
-
-  clustername = request['clustername']
-  baseurl = request['URL']
-  fencedevs = list() #This is for the fencedev list page
-
-  #Get list of fence devices
-  fds = model.getFenceDevices()
-  for fd in fds:
-    #This section determines which nodes use the dev
-    #create fencedev hashmap
-    nodes_used = list()
-
-    if fd.isShared() is 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['unknown'] = True
-        fencedev['pretty_name'] = fd.getAgentType()
-
-      fencedev['agent'] = fd.getAgentType()
-      #Add config url for this fencedev
-      fencedev['cfgurl'] = '%s?clustername=%s&fencename=%s&pagetype=%s' \
-        % (baseurl, clustername, fd.getName().strip(), FENCEDEV)
-
-      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 is True:
-                continue
-              node_hash = {}
-              cur_nodename = node.getName().strip()
-              node_hash['nodename'] = cur_nodename
-              node_hash['nodeurl'] = '%s?clustername=%s&nodename=%s&pagetype=%s' \
-                % (baseurl, clustername, cur_nodename, NODE)
-              nodes_used.append(node_hash)
+	fences_map = {}
+	if not model:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('getFencesInfo0: model is None')
+		fences_map['fencedevs'] = list()
+		return fences_map
+
+	clustername = request['clustername']
+	baseurl = request['URL']
+	fencedevs = list() #This is for the fencedev list page
+
+	#Get list of fence devices
+	fds = model.getFenceDevices()
+	for fd in fds:
+		#This section determines which nodes use the dev
+		#create fencedev hashmap
+		nodes_used = list()
+
+		if fd.isShared() is True:
+			fencedev = {}
+			attr_hash = fd.getAttributes()
+			kees = attr_hash.keys()
 
-      fencedev['nodesused'] = nodes_used
-      fencedevs.append(fencedev)
+			for kee in kees:
+				fencedev[kee] = attr_hash[kee] #copy attrs over
+			try:
+				fencedev['pretty_name'] = FENCE_OPTS[fd.getAgentType()]
+			except:
+				fencedev['unknown'] = True
+				fencedev['pretty_name'] = fd.getAgentType()
 
-  fences_map['fencedevs'] = fencedevs
-  return fences_map
+			fencedev['agent'] = fd.getAgentType()
+			#Add config url for this fencedev
+			fencedev['cfgurl'] = '%s?clustername=%s&fencename=%s&pagetype=%s' \
+				% (baseurl, clustername, fd.getName().strip(), FENCEDEV)
+
+			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 is True:
+								continue
+							node_hash = {}
+							cur_nodename = node.getName().strip()
+							node_hash['nodename'] = cur_nodename
+							node_hash['nodeurl'] = '%s?clustername=%s&nodename=%s&pagetype=%s' \
+								% (baseurl, clustername, cur_nodename, NODE)
+							nodes_used.append(node_hash)
+
+			fencedev['nodesused'] = nodes_used
+			fencedevs.append(fencedev)
+
+	fences_map['fencedevs'] = fencedevs
+	return fences_map
 
 def getVMInfo(self, model, request):
 	vm_map = {}
@@ -1447,63 +1527,63 @@
 	#CALL LUCICLUSTERINFO
 	return resList
 
-def getResourceInfo(model, request):
+def getClusterName(self, model):
+	return model.getClusterName()
+
+def getClusterAlias(self, model):
 	if not model:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('GRI0: no model object in session')
-		return {}
+			luci_log.debug_verbose('GCA0: no model')
+		return ''
+	alias = model.getClusterAlias()
+	if not alias:
+		return model.getClusterName()
+	return alias
 
-	name = None
+def getModelBuilder(self, rc, isVirtualized):
 	try:
-		name = request['resourcename']
-	except:
-		try:
-			name = request.form['resourcename']
-		except:
-			pass
-
-	if name is None:
-		try:
-			res_type = request.form['type']
-			if res_type == 'ip':
-				name = request.form['value'].strip()
-		except:
-			pass
-
-	if name is None:
+		cluster_conf_node = rq.getClusterConf(rc)
+		if not cluster_conf_node:
+			raise Exception, 'getClusterConf returned None'
+	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('GRI1: missing res name')
-		return {}
+			luci_log.debug_verbose('GMB0: unable to get cluster_conf_node in getModelBuilder: %r' % e)
+		return None
 
 	try:
-		cluname = request['clustername']
-	except:
+		model = ModelBuilder(0, None, None, cluster_conf_node)
+		if not model:
+			raise Exception, 'ModelBuilder() returned None'
+	except Exception, e:
 		try:
-			cluname = request.form['clustername']
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('GMB1: An error occurred while trying to get model for conf "%r": %r' % (cluster_conf_node.toxml(), e))
 		except:
 			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('GRI2: missing cluster name')
-			return {}
+				luci_log.debug_verbose('GMB1: ModelBuilder failed')
+		return None
 
-	try:
-		baseurl = request['URL']
-	except:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('GRI3: missing URL')
-		return {}
+	model.setIsVirtualized(isVirtualized)
+	return model
 
-	#CALL
-	return {}
+def getModelForCluster(self, clustername):
+	from LuciDB import getRicciAgent
 
-def getClusterName(self, model):
-	return model.getClusterName()
+	rc = getRicciAgent(self, clustername)
+	if not rc:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('GMFC0: unable to find a ricci agent for %s' \
+				% clustername)
+		return None
 
-def getClusterAlias(self, model):
-	if not model:
+	try:
+		model = getModelBuilder(None, rc, rc.dom0())
+		if not model:
+			raise Exception, 'model is none'
+	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('GCA0: no model')
-		return ''
-	alias = model.getClusterAlias()
-	if not alias:
-		return model.getClusterName()
-	return alias
+			luci_log.debug_verbose('GMFC1: unable to get model builder for %s: %r' \
+				 % (clustername, e))
+		return None
+
+	return model
luci/site/luci/Extensions/Attic/LuciDB.py +47 -0

50 lines not on this page · raw message

luci/site/luci/Extensions/Attic/LuciZope.py +15 -2
@@ -7,6 +7,10 @@
 
 from LuciZopePerm import userAuthenticated
 from LuciDB import allowed_systems
+from LuciSyslog import get_logger
+from conga_constants import LUCI_DEBUG_MODE
+
+luci_log = get_logger()
 
 def siteIsSetup(self):
 	import os
@@ -14,8 +18,9 @@
 
 	try:
 		return os.path.isfile('%sprivkey.pem' % CERTS_DIR_PATH) and os.path.isfile('%scacert.pem' % CERTS_DIR_PATH)
-	except:
-		pass
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('SIS0: %r' % e)
 	return False
 
 def strFilter(regex, replaceChar, arg):
@@ -110,3 +115,11 @@
 		htab['isSelected'] = True
 
 	return [ htab, ctab, stab ]
+
+def appendModel(request, model):
+	try:
+		request.SESSION.set('model', model)
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('Appending model to request failed: %r' % e)
+		return 'An error occurred while storing the cluster model'
luci/site/luci/Extensions/cluster_adapters.py +1356 -1199

699 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.