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

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



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2007-09-28 05:36:39

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

Log message:
	Add and disable cluster services at boot time only when adding or deleting nodes. When starting and stopping nodes, don't don't disable them automatically.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterActions.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&r1=1.7&r2=1.8

--- conga/luci/site/luci/Extensions/LuciClusterActions.py	2007/09/11 16:04:33	1.6
+++ conga/luci/site/luci/Extensions/LuciClusterActions.py	2007/09/28 05:36:39	1.7
@@ -227,8 +227,13 @@
 # Cluster node membership-related tasks
 #
 
-def NodeJoinCluster(self, rc, clustername, nodename_resolved):
-	batch_number, result = rq.nodeJoinCluster(rc)
+def NodeJoinCluster(self,
+					rc,
+					clustername,
+					nodename_resolved,
+					enable_services=True):
+
+	batch_number, result = rq.nodeJoinCluster(rc, enable_services=enable_services)
 	if batch_number is None or result is None:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('NJ0: batch_number and/or result is None')
@@ -249,7 +254,8 @@
 						rc,
 						clustername,
 						nodename_resolved,
-						stop_cluster=False):
+						stop_cluster=False,
+						disable_services=True):
 	reported_cluname = None
 	try:
 		cluster_info = rc.cluster_info()
@@ -270,7 +276,9 @@
 				% nodename_resolved)
 		return None
 
-	batch_number, result = rq.nodeLeaveCluster(rc, cluster_shutdown=stop_cluster)
+	batch_number, result = rq.nodeLeaveCluster(rc,
+							cluster_shutdown=stop_cluster,
+							disable_services=disable_services)
 	if batch_number is None or result is None:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('NLC2: %s: batch_number or result is None' \
@@ -375,7 +383,9 @@
 	# First, delete cluster.conf from node to be deleted.
 	# next, have node leave cluster.
 
-	batch_number, result = rq.nodeLeaveCluster(rc, purge=True)
+	batch_number, result = rq.nodeLeaveCluster(rc,
+							purge=True,
+							disable_services=True)
 	if batch_number is None or result is None:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('ND5: batch_number and/or result is None')
@@ -473,7 +483,7 @@
 			errors += 1
 			continue
 
-		if NodeJoinCluster(self, rc, clustername, nodename_resolved) is None:
+		if NodeJoinCluster(self, rc, clustername, nodename_resolved, enable_services=False) is None:
 			if LUCI_DEBUG_MODE is True:
 				luci_log.debug_verbose('CStart1: nodeJoin %s' \
 					% nodename_resolved)
@@ -514,7 +524,8 @@
 				errors += 1
 		else:
 			ret = NodeLeaveCluster(self, rc, clustername,
-					nodename_resolved, stop_cluster=True)
+					nodename_resolved, stop_cluster=True,
+					disable_services=False)
 			if ret is None:
 				if LUCI_DEBUG_MODE is True:
 					luci_log.debug_verbose('CStop2: [0] nodeLeave %s' \
@@ -528,13 +539,14 @@
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('cluRestart0: ClusterStop: %d errs' \
 				% snum_err)
+		return snum_err
 
 	jnum_err = ClusterStart(self, model)
 	if jnum_err:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('cluRestart1: ClusterStart: %d errs' \
 				% jnum_err)
-	return snum_err + jnum_err
+	return jnum_err
 
 def ClusterDelete(self, model):
 	try:
--- conga/luci/site/luci/Extensions/RicciQueries.py	2007/08/08 21:00:07	1.7
+++ conga/luci/site/luci/Extensions/RicciQueries.py	2007/09/28 05:36:39	1.8
@@ -113,7 +113,9 @@
 
 	batch.append('<module name="cluster">')
 	batch.append('<request API_version="1.0">')
-	batch.append('<function_call name="start_node"/>')
+	batch.append('<function_call name="start_node">')
+	batch.append('<var mutable="false" name="enable_services" type="boolean" value="true"/>"')
+	batch.append('</function_call>')
 	batch.append('</request>')
 	batch.append('</module>')
 	batch.append('</batch>')
@@ -412,7 +414,10 @@
 	ricci_xml = rc.batch_run(batch_str)
 	return batchAttemptResult(ricci_xml)
 
-def nodeLeaveCluster(rc, cluster_shutdown=False, purge=False):
+def nodeLeaveCluster(	rc,
+						cluster_shutdown=False,
+						purge=False,
+						disable_services=True):
 	cshutdown = 'false'
 	if cluster_shutdown is True:
 		cshutdown = 'true'
@@ -421,7 +426,11 @@
 	if purge is False:
 		purge_conf = 'false'
 
-	batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="stop_node"><var mutable="false" name="cluster_shutdown" type="boolean" value="%s"/><var mutable="false" name="purge_conf" type="boolean" value="%s"/></function_call></request></module>' % (cshutdown, purge_conf)
+	disable_svc = 'true'
+	if disable_services is False:
+		disable_svc = 'false'
+		
+	batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="stop_node"><var mutable="false" name="cluster_shutdown" type="boolean" value="%s"/><var mutable="false" name="purge_conf" type="boolean" value="%s"/><var mutable="false" name="disable_services" type="boolean" value="%s"/></function_call></request></module>' % (cshutdown, purge_conf, disable_svc)
 
 	ricci_xml = rc.batch_run(batch_str)
 	return batchAttemptResult(ricci_xml)
@@ -432,12 +441,16 @@
 	ricci_xml = rc.batch_run(batch_str)
 	return batchAttemptResult(ricci_xml)
 
-def nodeJoinCluster(rc, cluster_startup=False):
+def nodeJoinCluster(rc, cluster_startup=False, enable_services=True):
 	cstartup = 'false'
 	if cluster_startup is True:
 		cstartup = 'true'
 
-	batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="start_node"><var mutable="false" name="cluster_startup" type="boolean" value="%s"/></function_call></request></module>' % cstartup
+	enable_services = 'true'
+	if enable_services is False:
+		enable_services = 'false'
+
+	batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="start_node"><var mutable="false" name="cluster_startup" type="boolean" value="%s"/><var mutable="false" name="enable_services" type="boolean" value="%s"/></function_call></request></module>' % (cstartup, enable_services)
 
 	ricci_xml = rc.batch_run(batch_str)
 	return batchAttemptResult(ricci_xml)


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