[Cluster-devel] conga/ricci/modules/cluster/clumon/src/daemon ...

rmccabe at sourceware.org rmccabe at sourceware.org
Wed Dec 5 16:46:17 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-12-05 16:46:16

Modified files:
	ricci/modules/cluster/clumon/src/daemon: Monitor.cpp 

Log message:
	Still return cluster.conf info when cman isn't running

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp.diff?cvsroot=cluster&r1=1.20&r2=1.21

--- conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp	2007/11/21 17:41:21	1.20
+++ conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp	2007/12/05 16:46:16	1.21
@@ -80,8 +80,8 @@
 		msg_arrived(my_nodename, msg);
 		_cluster = merge_data(clustername);
 	} catch (String e) {
-		log(__LINE__ + ": caught exception: " + e, LogCommunicator);
-	} catch ( ... ) {}
+		log(String(__FILE__) + ":" + __LINE__ + String(": caught exception: ") + e, LogCommunicator);
+	} catch (...) { }
 }
 
 void
@@ -110,7 +110,7 @@
 				_cluster = merge_data(clustername);
 			}
 		} catch (String e) {
-			log(__LINE__ + ": caught exception: " + e, LogCommunicator);
+			log(String(__FILE__) + ":" + __LINE__ + String(": caught exception: ") + e, LogCommunicator);
 			MutexLocker l(_mutex);
 			_cluster = counting_auto_ptr<Cluster>();
 		} catch ( ... ) {
@@ -153,9 +153,9 @@
 		try {
 			return cluster2xml(*_cluster) + "\n";
 		} catch (String e) {
-			log(__LINE__ + ": caught exception: " + e, LogCommunicator);
+			log(String(__FILE__) + ":" + __LINE__ + String(": caught exception: ") + e, LogCommunicator);
 			return def;
-		} catch ( ... ) {
+		} catch (...) {
 			return def;
 		}
 	}
@@ -192,7 +192,7 @@
 			}
 		}
 	} catch (String e) {
-		log(__LINE__ + ": caught exception: " + e, LogCommunicator);
+		log(String(__FILE__) + ":" + __LINE__ + String(": caught exception: ") + e, LogCommunicator);
 	} catch ( ... ) {}
 }
 
@@ -221,61 +221,69 @@
 
 	try {
 		cluster.set_attr("minQuorum", probe_quorum());
-	} catch ( ... ) {}
+	} catch (...) {}
 
 	cluster.set_attr("cluster_version", _cl_version);
 
-	// insert current node info
-	const vector<String> clustered_nodes = this->clustered_nodes();
-	for (list<XMLObject>::const_iterator
-			iter = cluster.children().begin() ;
-			iter != cluster.children().end() ;
-			iter++)
-	{
-		XMLObject& kid = (XMLObject&) *iter;
-		if (kid.tag() == "node") {
-			String name(kid.get_attr("name"));
-			if (name == nodename) {
-				// insert info about this node -> self
-				kid.set_attr("uptime", uptime());
-			}
+	try {
+		// insert current node info
+		const vector<String> clustered_nodes = this->clustered_nodes();
+		for (list<XMLObject>::const_iterator
+				iter = cluster.children().begin() ;
+				iter != cluster.children().end() ;
+				iter++)
+		{
+			XMLObject& kid = (XMLObject&) *iter;
+			if (kid.tag() == "node") {
+				String name(kid.get_attr("name"));
+				if (name == nodename) {
+					// insert info about this node -> self
+					kid.set_attr("uptime", uptime());
+				}
 
-			if (find(clustered_nodes.begin(), clustered_nodes.end(), name) !=
-				clustered_nodes.end())
-			{
-				kid.set_attr("online", "true");
-				kid.set_attr("clustered", "true");
+				if (find(clustered_nodes.begin(), clustered_nodes.end(), name) !=
+					clustered_nodes.end())
+				{
+					kid.set_attr("online", "true");
+					kid.set_attr("clustered", "true");
+				}
 			}
 		}
-	}
+	} catch (String e) {
+		log(String(__FILE__) + ":" + __LINE__ + ": caught exception: " + e, LogCommunicator);
+	} catch (...) { }
 
 	// insert current service info
-	const vector<XMLObject> services_info = this->services_info();
-	for (vector<XMLObject>::const_iterator
-			iter_i = services_info.begin() ;
-			iter_i != services_info.end() ;
-			iter_i++)
-	{
-		const XMLObject& service = *iter_i;
-		for (list<XMLObject>::const_iterator
-				iter_c = cluster.children().begin() ;
-				iter_c != cluster.children().end() ;
-				iter_c++)
+	try {
+		const vector<XMLObject> services_info = this->services_info();
+		for (vector<XMLObject>::const_iterator
+				iter_i = services_info.begin() ;
+				iter_i != services_info.end() ;
+				iter_i++)
 		{
-			XMLObject& kid = (XMLObject&) *iter_c;
-			if (kid.tag() == "service") {
-				if (kid.get_attr("name") == service.get_attr("name")) {
-					for (map<String, String>::const_iterator
+			const XMLObject& service = *iter_i;
+			for (list<XMLObject>::const_iterator
+					iter_c = cluster.children().begin() ;
+					iter_c != cluster.children().end() ;
+					iter_c++)
+			{
+				XMLObject& kid = (XMLObject&) *iter_c;
+				if (kid.tag() == "service") {
+					if (kid.get_attr("name") == service.get_attr("name")) {
+						for (map<String, String>::const_iterator
 							iter = service.attrs().begin() ;
 							iter != service.attrs().end() ;
 							iter++)
-					{
-						kid.set_attr(iter->first, iter->second);
+						{
+							kid.set_attr(iter->first, iter->second);
+						}
 					}
 				}
 			}
 		}
-	}
+	} catch (String e) {
+		log(String(__FILE__) + ":" + __LINE__ + ": caught exception: " + e, LogCommunicator);
+	} catch (...) { }
 
 	// ** return values **
 
@@ -289,6 +297,7 @@
 	vector<String>::iterator iter = find(nodes.begin(), nodes.end(), nodename);
 	if (iter != nodes.end())
 		nodes.erase(iter);
+
 	return nodes;
 }
 
@@ -593,7 +602,7 @@
 			}
 		} catch (...) {
 			free(node_array);
-			throw;
+			throw String("error getting node names");
 		}
 		free(node_array);
 	} else if (_cl_version == "4") {
@@ -789,7 +798,7 @@
 			}
 		}
 	} catch (String e) {
-		log(__LINE__ + ": caught exception: " + e, LogCommunicator);
+		log(String(__FILE__) + ":" + __LINE__ + String(": caught exception: ") + e, LogCommunicator);
 	} catch ( ... ) {}
 
 	return services;
@@ -893,7 +902,7 @@
 merge_xmls(const XMLObject& what, const XMLObject& with)
 {
 	if (what.tag() != with.tag())
-		throw String("merge_xmls(): tag mismatch");
+		throw String("merge_xmls(): tag mismatch: \"" + what.tag() + "\" \"" + with.tag() + "\"");
 
 	XMLObject new_xml(what.tag());
 	for (map<String, String>::const_iterator




More information about the Cluster-devel mailing list