cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/site/luci/Extensions LuciClusterAct ...
Date: 28 Sep 2007 05:36:40 -0000	[thread overview]
Message-ID: <20070928053640.12031.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at 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)



             reply	other threads:[~2007-09-28  5:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28  5:36 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-08-05 18:16 [Cluster-devel] conga/luci/site/luci/Extensions LuciClusterAct rmccabe
2007-10-22 19:24 rmccabe
2007-08-09 21:35 rmccabe
2007-07-26  4:21 rmccabe
2007-05-23 21:21 rmccabe
2007-05-22 21:52 rmccabe
2007-05-18  5:23 rmccabe
2007-05-14 18:00 rmccabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070928053640.12031.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).