[Cluster-devel] conga/ricci modules/cluster/ClusterStatus.cpp ...

kupcevic at sourceware.org kupcevic at sourceware.org
Thu Jul 20 08:29:50 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic at sourceware.org	2006-07-20 08:29:49

Modified files:
	ricci/modules/cluster: ClusterStatus.cpp 
	ricci/ricci    : Ricci.cpp RicciWorker.cpp 

Log message:
	ricci: code cleanup

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterStatus.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Ricci.cpp.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/RicciWorker.cpp.diff?cvsroot=cluster&r1=1.8&r2=1.9

--- conga/ricci/modules/cluster/ClusterStatus.cpp	2006/06/20 19:37:23	1.7
+++ conga/ricci/modules/cluster/ClusterStatus.cpp	2006/07/20 08:29:49	1.8
@@ -36,13 +36,15 @@
 
 
 #define INITD_DIR_PATH        "/etc/init.d/"
-#define CMAN_LEAVE_TIMEOUT    "120"
-
 #define CMAN_TOOL_PATH        "/sbin/cman_tool"
 #define LSMOD_PATH            "/sbin/lsmod"
 #define MODPROBE_PATH         "/sbin/modprobe"
 #define CHKCONFIG_PATH        "/sbin/chkconfig"
 
+#define CMAN_LEAVE_TIMEOUT    "120"  // seconds (string)
+#define CLUMON_SYNC_TIME      8      // seconds
+#define CMAN_SETTLE_TIME      3      // seconds
+
 
 
 static void run_initd(const string& servname,
@@ -67,9 +69,8 @@
     // start clumon
     run_initd("ricci-modclusterd", true, true);
     
-    // wait for it to come up and sync, 8 secs
-    for (int i=0; i<8*4; i++)
-      sleep_mil(250);
+    // wait for it to come up and sync
+    sleep_sec(CLUMON_SYNC_TIME);
     
     // try again
     ClientSocket s("/var/run/clumond.sock");
@@ -132,7 +133,7 @@
 	  if (iter->get_attr("clustered") == "false")
 	    all_in = false;
       if (all_in == false)
-	sleep_sec(8);
+	sleep_sec(CLUMON_SYNC_TIME);
     }
   }
   
@@ -244,8 +245,7 @@
   
   if (cman_loaded) {
     // wait until things settle down
-    for (int i=0; i<12; i++)
-      sleep_mil(250);
+    sleep_sec(CMAN_SETTLE_TIME);
     
     args.clear();
     args.push_back("leave");
@@ -256,8 +256,7 @@
     utils::execute(CMAN_TOOL_PATH, args, out, err, status, false);
     
     // bz149282
-    for (int i=0; i<12; i++)
-      sleep_mil(250);
+    sleep_sec(CMAN_SETTLE_TIME);
     
     args.clear();
     args.push_back("-r");
--- conga/ricci/ricci/Ricci.cpp	2006/07/12 18:46:08	1.13
+++ conga/ricci/ricci/Ricci.cpp	2006/07/20 08:29:49	1.14
@@ -194,8 +194,10 @@
       for (list<XMLObject>::const_iterator iter = req.children().begin();
 	   iter != req.children().end();
 	   iter++)
-	if (iter->tag() == "batch")
+	if (iter->tag() == "batch") {
 	  batch_xml = &(*iter);
+	  break;
+	}
       if (batch_xml) {
 	try {
 	  long long id;
--- conga/ricci/ricci/RicciWorker.cpp	2006/04/12 15:47:09	1.8
+++ conga/ricci/ricci/RicciWorker.cpp	2006/07/20 08:29:49	1.9
@@ -191,7 +191,7 @@
 	// wait until rebooted, 
 	// ricci will start new worker (after reboot) to pickup where I left
 	while (true)
-	  sleep_mil(255);
+	  sleep_sec(255);
 	return;
       }
     } else {




More information about the Cluster-devel mailing list