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

rmccabe at sourceware.org rmccabe at sourceware.org
Mon Jul 16 21:35:18 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2007-07-16 21:35:17

Modified files:
	luci/site/luci/Extensions: LuciClusterInfo.py LuciDB.py 
	                           RicciQueries.py 

Log message:
	More fixes for 247521

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.2&r2=1.1.4.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.2&r2=1.1.4.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.2&r2=1.1.4.3

--- conga/luci/site/luci/Extensions/LuciClusterInfo.py	2007/06/19 15:54:10	1.1.4.2
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py	2007/07/16 21:35:17	1.1.4.3
@@ -149,12 +149,14 @@
 	if not doc:
 		try:
 			from LuciDB import getClusterStatusDB
-			fvars = GetReqVars(request, [ 'clustername' ])
-
-			clustername = fvars['clustername']
-			if clustername is None:
-				raise Exception, 'unable to determine cluster name'
+			if cluname:
+				clustername = cluname
+			else:
+				fvars = GetReqVars(request, [ 'clustername' ])
 
+				clustername = fvars['clustername']
+				if clustername is None:
+					raise Exception, 'unable to determine cluster name'
 			cinfo = getClusterStatusDB(self, clustername)
 			if not cinfo or len(cinfo) < 1:
 				raise Exception, 'cinfo is None'
@@ -1526,6 +1528,7 @@
 		model = ModelBuilder(0, None, None, cluster_conf_node)
 		if not model:
 			raise Exception, 'ModelBuilder() returned None'
+		model.setIsVirtualized(isVirtualized)
 	except Exception, e:
 		try:
 			if LUCI_DEBUG_MODE is True:
@@ -1535,7 +1538,6 @@
 				luci_log.debug_verbose('GMB1: ModelBuilder failed')
 		return None
 
-	model.setIsVirtualized(isVirtualized)
 	return model
 
 def getModelForCluster(self, clustername):
@@ -1544,19 +1546,18 @@
 	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)
+			luci_log.debug_verbose('GMFC0: no ricci agent for %s' % clustername)
 		return None
 
 	try:
 		model = getModelBuilder(None, rc, rc.dom0())
 		if not model:
 			raise Exception, 'model is none'
+		return model
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('GMFC1: unable to get model builder for %s: %r %s' % (clustername, e, str(e)))
-		return None
-
-	return model
+	return None
 
 def getClusterOS(self, rc):
 	from HelperFunctions import resolveOSType
--- conga/luci/site/luci/Extensions/LuciDB.py	2007/06/27 06:19:22	1.1.4.2
+++ conga/luci/site/luci/Extensions/LuciDB.py	2007/07/16 21:35:17	1.1.4.3
@@ -946,8 +946,8 @@
 
 	nodelist = getClusterDBNodes(self, clustername)
 	if len(nodelist) < 1:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('GCSDB0a: removing cluster %s because it has no nodes' % clustername)
+		luci_log.info('Removing cluster %s because it has no nodes' \
+			% clustername)
 		try:
 			clusters_dir = self.restrictedTraverse(CLUSTER_FOLDER_PATH)
 			clusters_dir.manage_delObjects([clustername])
@@ -960,7 +960,7 @@
 	for node in nodelist:
 		node_val = {}
 		node_val['type'] = 'node'
-		node_val['name'] = node
+		node_val['name'] = node[0]
 		node_val['clustered'] = '[unknown]'
 		node_val['online'] = '[unknown]'
 		node_val['error'] = True
--- conga/luci/site/luci/Extensions/RicciQueries.py	2007/06/27 06:19:22	1.1.4.2
+++ conga/luci/site/luci/Extensions/RicciQueries.py	2007/07/16 21:35:17	1.1.4.3
@@ -289,6 +289,9 @@
 	batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="status"/></request></module>'
 	ricci_xml = rc.batch_run(batch_str, async=False)
 
+	if not ricci_xml:
+		return None
+
 	try:
 		cluster_tags = ricci_xml.getElementsByTagName('cluster')
 	except Exception, e:
@@ -300,10 +303,12 @@
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('GCSB1: %d entries - expecting 1' \
 				% len(cluster_tags))
+			return None
 	elif len(cluster_tags) > 1:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('GCSB2: %d entries, expecting 1 use first' \
 				% len(cluster_tags))
+
 	try:
 		cluster_node = cluster_tags[0]
 		if not cluster_node:




More information about the Cluster-devel mailing list