[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:	rmccabe sourceware org	2006-11-10 18:18:09

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

Log message:
	better debugging output

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

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/10 17:59:58	1.159
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/10 18:18:09	1.160
@@ -1505,15 +1505,15 @@
 	try:
 		clusterfolder = self.restrictedTraverse(path)
 		if not clusterfolder:
-			luci_log.debug('GRA: cluster folder %s for %s is missing.' \
+			luci_log.debug('GRA0: cluster folder %s for %s is missing.' \
 				% (path, clustername))
 			raise Exception, 'no cluster folder at %s' % path
 		nodes = clusterfolder.objectItems('Folder')
 		if len(nodes) < 1:
-			luci_log.debug('GRA: no cluster nodes for %s found.' % clustername)
+			luci_log.debug('GRA1: no cluster nodes for %s found.' % clustername)
 			raise Exception, 'no cluster nodes were found at %s' % path
 	except Exception, e:
-		luci_log.debug('GRA: cluster folder %s for %s is missing: %s.' \
+		luci_log.debug('GRA2: cluster folder %s for %s is missing: %s.' \
 			% (path, clustername, str(e)))
 		return None
 
@@ -1531,17 +1531,17 @@
 		try:
 			rc = RicciCommunicator(hostname)
 		except RicciError, e:
-			luci_log.debug('GRA: ricci error: %s' % str(e))
+			luci_log.debug('GRA3: ricci error: %s' % str(e))
 			continue
 
 		try:
 			clu_info = rc.cluster_info()
 		except Exception, e:
-			luci_log.debug('GRA: cluster_info error: %s' % str(e))
+			luci_log.debug('GRA4: cluster_info error: %s' % str(e))
 
 		if cluname != lower(clu_info[0]) and cluname != lower(clu_info[1]):
 			try:
-				luci_log.debug('GRA: %s reports it\'s in cluster %s:%s; we expect %s' \
+				luci_log.debug('GRA5: %s reports it\'s in cluster %s:%s; we expect %s' \
 					 % (hostname, clu_info[0], clu_info[1], cluname))
 				setNodeFlag(self, node, CLUSTER_NODE_NOT_MEMBER)
 			except:
@@ -1555,20 +1555,28 @@
 		except:
 			pass
 
-	luci_log.debug('GRA: no ricci agent could be found for cluster %s' % cluname)
+	luci_log.debug('GRA6: no ricci agent could be found for cluster %s' \
+		% cluname)
 	return None
 
 def getRicciAgentForCluster(self, req):
+	clustername = None
 	try:
 		clustername = req['clustername']
-	except KeyError, e:
+		if not clustername:
+			clustername = None
+			raise
+	except:
 		try:
 			clustername = req.form['clusterName']
 			if not clustername:
-				raise
+				clustername = None
 		except:
-			luci_log.debug('no cluster name was specified in getRicciAgentForCluster')
-			return None
+			pass
+
+	if clustername is None:
+		luci_log.debug('GRAFC0: no cluster name was found')
+		return None
 	return getRicciAgent(self, clustername)
 
 def getClusterStatus(self, rc):
@@ -4322,7 +4330,7 @@
 		if not mb_nodes or not len(mb_nodes):
 			raise Exception, 'node list is empty'
 	except Exception, e:
-		luci_log.debug_verbose('no model builder nodes found for %s: %s' \
+		luci_log.debug_verbose('RCC0: no model builder nodes found for %s: %s' \
 				% (str(e), clusterName))
 		return 'Unable to find cluster nodes for %s' % clusterName
 
@@ -4331,17 +4339,18 @@
 		if not cluster_node:
 			raise Exception, 'cluster node is none'
 	except Exception, e:
-		luci_log.debug('cant find cluster node for %s: %s'
+		luci_log.debug('RCC1: cant find cluster node for %s: %s'
 			% (clusterName, str(e)))
 		return 'Unable to find an entry for %s in the Luci database.' % clusterName
 
 	try:
 		db_nodes = map(lambda x: x[0], cluster_node.objectItems('Folder'))
 		if not db_nodes or not len(db_nodes):
-			raise
-	except:
+			raise Exception, 'no database nodes'
+	except Exception, e:
 		# Should we just create them all? Can this even happen?
-		return 'Unable to find database entries for any nodes in ' + clusterName
+		luci_log.debug('RCC2: error: %s' % str(e))
+		return 'Unable to find database entries for any nodes in %s' % clusterName
 
 	same_host = lambda x, y: x == y or x[:len(y) + 1] == y + '.' or y[:len(x) + 1] == x + '.'
 
@@ -4368,11 +4377,15 @@
 
 	messages = list()
 	for i in missing_list:
-		cluster_node.delObjects([i])
-		## or alternately
-		#new_node = cluster_node.restrictedTraverse(i)
-		#setNodeFlag(self, new_node, CLUSTER_NODE_NOT_MEMBER)
-		messages.append('Node \"' + i + '\" is no longer in a member of cluster \"' + clusterName + '.\". It has been deleted from the management interface for this cluster.')
+		try:
+			## or alternately
+			##new_node = cluster_node.restrictedTraverse(i)
+			##setNodeFlag(self, new_node, CLUSTER_NODE_NOT_MEMBER)
+			cluster_node.delObjects([i])
+			messages.append('Node \"%s\" is no longer in a member of cluster \"%s\." It has been deleted from the management interface for this cluster.' % (i, clusterName))
+			luci_log.debug_verbose('VCC3: deleted node %s' % i)
+		except Exception, e:
+			luci_log.debug_verbose('VCC4: delObjects: %s: %s' % (i, str(e)))
 
 	new_flags = CLUSTER_NODE_NEED_AUTH | CLUSTER_NODE_ADDED
 	for i in new_list:
@@ -4380,9 +4393,11 @@
 			cluster_node.manage_addFolder(i, '__luci__:csystem:' + clusterName)
 			new_node = cluster_node.restrictedTraverse(i)
 			setNodeFlag(self, new_node, new_flags)
-			messages.append('A new node, \"' + i + ',\" is now a member of cluster \"' + clusterName + '.\" It has added to the management interface for this cluster, but you must authenticate to it in order for it to be fully functional.')
-		except:
-			messages.append('A new node, \"' + i + ',\" is now a member of cluster \"' + clusterName + ',\". but has not added to the management interface for this cluster as a result of an error creating the database entry.')
+			messages.append('A new cluster node, \"%s,\" is now a member of cluster \"%s.\" It has been added to the management interface for this cluster, but you must authenticate to it in order for it to be fully functional.' % (i, clusterName))
+		except Exception, e:
+			messages.append('A new cluster node, \"%s,\" is now a member of cluster \"%s,\". but it has not been added to the management interface for this cluster as a result of an error creating a database entry for it.' % (i, clusterName))
+			luci_log.debug_verbose('VCC5: addFolder: %s/%s: %s' \
+				% (clusterName, i, str(e)))
 	
 	return messages
 
@@ -4465,7 +4480,7 @@
 		clusterfolder = self.restrictedTraverse(path)
 		objs = clusterfolder.objectItems('Folder')
 	except Exception, e:
-		luci_log.info('resolve_nodename failed for %s/%s: %s' \
+		luci_log.info('RNN0: error for %s/%s: %s' \
 			% (nodename, clustername, str(e)))
 		return nodename
 
@@ -4476,14 +4491,15 @@
 		except:
 			continue
 
-	luci_log.info('resolve_nodename failed for %s/%s' % (nodename, clustername))
+	luci_log.info('RNN1: failed for %s/%s: nothing found' \
+		% (nodename, clustername))
 	return nodename
 
 def noNodeFlagsPresent(self, nodefolder, flagname, hostname):
 	try:
 		items = nodefolder.objectItems('ManagedSystem')
 	except:
-		luci_log.debug('An error occurred while trying to list flags for cluster ' + nodefolder[0])
+		luci_log.debug('NNFP0: error getting flags for %s' % nodefolder[0])
 		return None
 
 	for item in items:
@@ -4494,8 +4510,8 @@
 		try:
 			# hostname must be a FQDN
 			rc = RicciCommunicator(hostname)
-		except RicciError, e:
-			luci_log.info('Unable to connect to the ricci daemon: %s' % str(e))
+		except Exception, e:
+			luci_log.info('NNFP1: ricci error %s: %s' % (hostname, str(e)))
 			return None
 
 		if not rc.authed():
@@ -4504,15 +4520,14 @@
 				setNodeFlag(snode, CLUSTER_NODE_NEED_AUTH)
 			except:
 				pass
-			luci_log.info('Node %s is not authenticated' % item[0])
-			return None
+			luci_log.info('NNFP2: %s not authenticated' % item[0])
 
 		finished = checkBatch(rc, item[1].getProperty(BATCH_ID))
 		if finished == True:
 			try:
 				nodefolder.manage_delObjects(item[0])
 			except Exception, e:
-				luci_log.info('manage_delObjects for %s failed: %s' \
+				luci_log.info('NNFP3: manage_delObjects for %s failed: %s' \
 					% (item[0], str(e)))
 				return None
 			return True
@@ -4577,7 +4592,7 @@
 		flag.manage_addProperty(TASKTYPE, task, 'string')
 		flag.manage_addProperty(FLAG_DESC, desc, 'string')
 	except Exception, e:
-		errmsg = 'Error creating flag (%s,%s,%s) at %s: %s' \
+		errmsg = 'SNF0: error creating flag (%s,%s,%s) at %s: %s' \
 					% (batch_id, task, desc, objpath, str(e))
 		luci_log.debug_verbose(errmsg)
 		raise Exception, errmsg


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