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

[Cluster-devel] conga/luci/site/luci/Extensions RicciQueries.p ...



CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe sourceware org	2007-10-22 19:29:38

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

Log message:
	Generate node IDs for RHEL5 cman-based clusters

Patches:
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.6&r2=1.1.4.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.120.2.39&r2=1.120.2.40

--- conga/luci/site/luci/Extensions/RicciQueries.py	2007/08/08 21:14:38	1.1.4.6
+++ conga/luci/site/luci/Extensions/RicciQueries.py	2007/10/22 19:29:38	1.1.4.7
@@ -204,9 +204,10 @@
 	batch.append('<cluster config_version="1" name="%s" alias="%s">' % (cluster_name, cluster_alias))
 	batch.append('<fence_daemon post_fail_delay="0" post_join_delay="3"/>')
 	batch.append('<clusternodes>')
+
 	x = 1
 	for i in nodeList:
-		if os_str == 'rhel4':
+		if gulm_lockservers:
 			batch.append('<clusternode name="%s" votes="1"/>' % i)
 		else:
 			batch.append('<clusternode name="%s" votes="1" nodeid="%d"/>' % (i, x))
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/08/27 18:36:45	1.120.2.39
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/10/22 19:29:38	1.120.2.40
@@ -34,7 +34,7 @@
 	CLUSTER_ADD, CLUSTER_CONFIG, CLUSTER_DAEMON, CLUSTER_DELETE, \
 	CLUSTER_FOLDER_PATH, CLUSTER_RESTART, CLUSTER_START, CLUSTER_STOP, \
 	DISABLE_SVC_TASK, ENABLE_SVC_TASK, FDOM, FDOM_ADD, FENCEDEV, \
-	FENCEDEV_NODE_CONFIG, FENCEDEVS, FLAG_DESC, INSTALL_TASK, \
+	FENCEDEV_NODE_CONFIG, FENCEDEVS, FLAG_DESC, INSTALL_TASK, CLUSTER_PROCESS, \
 	LAST_STATUS, LUCI_DEBUG_MODE, NODE, NODE_ADD, NODE_DELETE, \
 	NODE_FENCE, NODE_FORCE_DELETE, NODE_JOIN_CLUSTER, NODE_LEAVE_CLUSTER, \
 	NODE_REBOOT, NODES, POSSIBLE_REBOOT_MESSAGE, PRE_CFG, PRE_INSTALL, \
@@ -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:
@@ -2318,14 +2327,16 @@
 			luci_log.debug('CTP0: no cluster task')
 		return 'No cluster task was given'
 
+	cluname = fvar['clustername']
 	if not model:
-		cluname = fvar['clustername']
 		model = LuciExtractCluModel(self, request, cluname)
 		if model is None:
 			if LUCI_DEBUG_MODE is True:
 				luci_log.debug_verbose('CTP2: No cluster model for %s' \
 					% cluname)
 			return 'Unable to retrieve the cluster configuration for %s. The configuration XML may contain errors.' % cluname
+	elif cluname is None:
+		cluname = model.getClusterName()
 
 	redirect_page = NODES
 	if task == CLUSTER_STOP:
@@ -2335,8 +2346,11 @@
 		from LuciClusterActions import ClusterStart
 		ClusterStart(self, model)
 	elif task == CLUSTER_RESTART:
-		from LuciClusterActions import ClusterRestart
-		ClusterRestart(self, model)
+		from LuciClusterActions import ClusterStop
+		ClusterStop(self, model)
+		request.RESPONSE.redirect('%s?pagetype=%s&clustername=%s&task=%s&busyfirst=true' \
+			% (baseurl, CLUSTER_PROCESS, cluname, CLUSTER_START))
+		return
 	elif task == CLUSTER_DELETE:
 		from LuciClusterActions import ClusterDelete
 		ret = ClusterDelete(self, model)


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