From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 5 Dec 2007 16:46:17 -0000 Subject: [Cluster-devel] conga/ricci/modules/cluster/clumon/src/daemon ... Message-ID: <20071205164617.3570.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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(); } 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 clustered_nodes = this->clustered_nodes(); - for (list::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 clustered_nodes = this->clustered_nodes(); + for (list::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 services_info = this->services_info(); - for (vector::const_iterator - iter_i = services_info.begin() ; - iter_i != services_info.end() ; - iter_i++) - { - const XMLObject& service = *iter_i; - for (list::const_iterator - iter_c = cluster.children().begin() ; - iter_c != cluster.children().end() ; - iter_c++) + try { + const vector services_info = this->services_info(); + for (vector::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::const_iterator + const XMLObject& service = *iter_i; + for (list::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::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::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::const_iterator