All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci/modules/cluster/clumon/src/daemon  ...
Date: 5 Dec 2007 16:46:17 -0000	[thread overview]
Message-ID: <20071205164617.3570.qmail@sourceware.org> (raw)

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



             reply	other threads:[~2007-12-05 16:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-05 16:46 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-05-12 15:15 [Cluster-devel] conga/ricci/modules/cluster/clumon/src/daemon rmccabe
2007-12-05 17:36 rmccabe
2007-11-21 17:42 rmccabe
2007-11-21 17:41 rmccabe
2007-11-21 17:39 rmccabe
2006-10-14 18:00 kupcevic

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=20071205164617.3570.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.