conga/ricci/modules/cluster/clumon/src/daemon ...
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
ricci/modules/cluster/clumon/src/daemon/Monitor.cpp +57 -48
@@ -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