[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
Branch: 	RHEL4
Changes by:	rmccabe sourceware org	2007-08-22 20:57:26

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

Log message:
	Don't set the nodeid attribute for clusternode tags when adding a new node to a RHEL4 GULM cluster

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

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/08/09 21:28:52	1.227.2.20
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/08/22 20:57:26	1.227.2.21
@@ -544,21 +544,32 @@
 		request.SESSION.set('add_node', add_cluster)
 		return (False, { 'errors': errors, 'messages': messages })
 
+	gulm_ptr = None
+	next_node_id = 1
 	try:
 		model = getModelBuilder(None, cluster_ricci, cluster_ricci.dom0())
 		if not model:
 			errors.append('Unable to retrieve the cluster configuration for %s. The configuration XML may contain errors' % clustername)
 			raise Exception, 'unable to get model for %s' % clustername
-
 		nodesptr = model.getClusterNodesPtr()
-		used_ids = {}
+		gulm_ptr = model.getGULMPtr()
+		used_ids = []
+
 		for i in model.getNodes():
-			used_ids[int(i.getAttribute('nodeid'))] = 1
+			if not gulm_ptr:
+				used_ids.append(int(i.getAttribute('nodeid')))
+
 			node_name = str(i.getAttribute('name'))
 			if node_name in system_list:
 				system_list[node_name]['errors'] = True
 				errors.append('%s is already a member of %s' \
 					% (node_name, clustername))
+
+		if not gulm_ptr:
+			used_ids.sort()
+			used_list_len = len(used_ids)
+			if used_list_len > 0:
+				next_node_id = used_ids[used_list_len - 1] + 1
 	except Exception, e:
 		incomplete = True
 		errors.append('Unable to retrieve the cluster configuration for %s. The configuration XML may contain errors' % clustername)
@@ -569,8 +580,6 @@
 		request.SESSION.set('add_node', add_cluster)
 		return (False, { 'errors': errors, 'messages': messages })
 
-	next_node_id = 1
-
 	try:
 		for x in system_list:
 			i = system_list[x]
@@ -606,13 +615,13 @@
 						% (cur_host, e, str(e)))
 				continue
 
-			next_node_id += 1
 			new_node = ClusterNode()
 			new_node.attr_hash['name'] = str(i['host'])
 			new_node.attr_hash['votes'] = str(1)
-			while next_node_id in used_ids:
+
+			if not gulm_ptr:
+				new_node.attr_hash['nodeid'] = str(next_node_id)
 				next_node_id += 1
-			new_node.attr_hash['nodeid'] = str(next_node_id)
 			nodesptr.addChild(new_node)
 
 		if incomplete or len(errors) > 0:


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