Skip to contentSkip to conversation

conga/ricci common/Time.cpp docs/cluster_api.h ...

Cluster-devel [email protected] 1 participant 1 message Jun 20, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-06-20 19:37:23

Modified files:

	ricci/common   : Time.cpp 
	ricci/docs     : cluster_api.html 
	ricci/include  : Time.h 

ricci/modules/cluster: ClusterModule.cpp ClusterStatus.cpp
ClusterStatus.h

Log message:
cluster module: add optional cluster_startup/shutdown arguments to start/stop_node functions (cluster startup without fencing / shutdown without bouncing services)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/Time.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/cluster_api.html.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/include/Time.h.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterModule.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterStatus.cpp.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterStatus.h.diff?cvsroot=cluster&r1=1.2&r2=1.3

ricci/common/Time.cpp +8 -0
@@ -66,3 +66,11 @@
     req.tv_nsec = rem.tv_nsec;
   } while (nanosleep(&req, &rem) == -1 && errno == EINTR);
 }
+
+void
+sleep_sec(unsigned char num)
+{
+  for (unsigned char i=0; i<num; i++)
+    for (int j=0; j<4; j++)
+      sleep_mil(250);
+}
ricci/docs/cluster_api.html +24 -16
@@ -5,7 +5,7 @@
 	<TITLE>Cluster Module</TITLE>
 	<META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.2  (Linux)">
 	<META NAME="CREATED" CONTENT="20060410;13011800">
-	<META NAME="CHANGED" CONTENT="20060411;16472300">
+	<META NAME="CHANGED" CONTENT="20060620;15340700">
 </HEAD>
 <BODY LANG="en-US" DIR="LTR">
 <P>Cluster module manages Redhat Cluster Suite. 
@@ -63,9 +63,10 @@
 		online=&quot;true&quot; uptime=&quot;331625&quot;
 		votes=&quot;1&quot;/&gt;<BR>&lt;service autostart=&quot;true&quot;
 		failed=&quot;false&quot; name=&quot;dsa&quot; nodename=&quot;green&quot;
-		running=&quot;true&quot; time_since_transition=&quot;12345&quot;/&gt;<BR>&lt;service autostart=&quot;true&quot;
-		failed=&quot;false&quot; name=&quot;new_serv&quot; nodename=&quot;green&quot;
-		running=&quot;true&quot; time_since_transition=&quot;54321&quot;/&gt;<BR>&lt;/cluster&gt;</P>
+		running=&quot;true&quot; time_since_transition=&quot;12345&quot;/&gt;<BR>&lt;service
+		autostart=&quot;true&quot; failed=&quot;false&quot; name=&quot;new_serv&quot;
+		nodename=&quot;green&quot; running=&quot;true&quot;
+		time_since_transition=&quot;54321&quot;/&gt;<BR>&lt;/cluster&gt;</P>
 		<P ALIGN=LEFT>On failure:<BR>- No special errors defined, only
 		generic ones might get returned.</P>
 	</UL>
@@ -105,26 +106,33 @@
 		<P>On failure:<BR>- 1 ??? service manager is not running on this
 		managed system<BR>- generic ones</P>
 	</UL>
-	<LI><P>start_node</P>
+	<LI><P>start_node 
+	</P>
 	<UL>
-		<P>Start cluster infrastructure and configured services. It is not
-		an error to start already started node.</P>
-		<P>No input variables.</P>
-		<P>No output variables.</P>
+		<P>Start cluster infrastructure on this node (also, enable daemons'
+		boot startup). <BR>It is not an error to start already started
+		node.</P>
+		<P>Input variables:<BR>- ???cluster_startup??? (boolean) ???
+		optional, default ???false???, cluster is starting up (wait for all
+		to come up, then start services ??? avoid fencing on startup)</P>
+		<P>No output variables. 
+		</P>
 		<P>On failure:<BR>- No special errors defined, only generic ones
 		might get returned.</P>
 	</UL>
 	<LI><P>stop_node</P>
 	<UL>
-		<P>Stop cluster infrastructure and configured services. It is not
-		an error to stop already stopped node. 
-		</P>
-		<P>No input variables. 
-		</P>
+		<P>Stop cluster infrastructure on this node (also, disable daemons'
+		boot startup). <BR>It is not an error to stop already stopped node.
+				</P>
+		<P>Input variables:<BR>- ???cluster_shutdown??? (boolean) ???
+		optional, default ???false???, cluster is shutting down (don't
+		bounce services around)</P>
 		<P>No output variables. 
 		</P>
 		<P>On failure:<BR>- No special errors defined, only generic ones
-		might get returned.</P>
+		might get returned. 
+		</P>
 	</UL>
 	<LI><P>fence_node</P>
 	<UL>
@@ -140,4 +148,4 @@
 <P><BR><BR>
 </P>
 </BODY>
-</HTML>
+</HTML>
\ No newline at end of file
ricci/include/Time.h +2 -0
@@ -35,6 +35,8 @@
 
 // sleep num milliseconds
 void sleep_mil(unsigned char num);
+// sleep num seconds
+void sleep_sec(unsigned char num);
 
 std::string time_formated();
 
ricci/modules/cluster/ClusterModule.cpp +20 -2
@@ -205,7 +205,16 @@
 VarMap 
 start_node(const VarMap& args)
 {
-  Cluster::start_node();
+  bool cluster_startup = false;
+  try {
+    VarMap::const_iterator iter = args.find("cluster_startup");
+    if (iter != args.end())
+      cluster_startup = iter->second.get_bool();
+  } catch ( string e ) {
+    throw APIerror(e);
+  }
+  
+  Cluster::start_node(cluster_startup);
   
   VarMap ret;
   return ret;
@@ -214,7 +223,16 @@
 VarMap 
 stop_node(const VarMap& args)
 {
-  Cluster::stop_node();
+  bool cluster_shutdown = false;
+  try {
+    VarMap::const_iterator iter = args.find("cluster_shutdown");
+    if (iter != args.end())
+      cluster_shutdown = iter->second.get_bool();
+  } catch ( string e ) {
+    throw APIerror(e);
+  }
+  
+  Cluster::stop_node(cluster_shutdown);
   
   VarMap ret;
   return ret;
ricci/modules/cluster/ClusterStatus.cpp +38 -3

65 lines not on this page · raw message

ricci/modules/cluster/ClusterStatus.h +2 -2
@@ -32,8 +32,8 @@
  public:
   static XMLObject status();
   
-  static void start_node();
-  static void stop_node();
+  static void start_node(bool cluster_startup = false);
+  static void stop_node(bool cluster_shutdown = false);
   
 };