All of lore.kernel.org
 help / color / mirror / Atom feed
From: kupcevic@sourceware.org <kupcevic@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci common/XML.cpp modules/cluster/clu ...
Date: 13 Oct 2006 09:36:16 -0000	[thread overview]
Message-ID: <20061013093616.29720.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic at sourceware.org	2006-10-13 09:36:16

Modified files:
	ricci/common   : XML.cpp 
	ricci/modules/cluster/clumon/src/daemon: Monitor.cpp Monitor.h 
	                                         main.cpp 

Log message:
	modcluster: perform probe on request if autoprobe hasn't been completed

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/XML.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/Monitor.h.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/main.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3

--- conga/ricci/common/XML.cpp	2006/09/26 00:54:26	1.5
+++ conga/ricci/common/XML.cpp	2006/10/13 09:36:15	1.6
@@ -231,6 +231,8 @@
 {
   char* buff = 0;
   try {
+    if (access(filename.c_str(), R_OK))
+      throw String("missing ") + filename;
     ifstream is(filename.c_str());
     is.seekg(0, ios::end);
     unsigned int length = is.tellg();
--- conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp	2006/10/12 20:01:51	1.7
+++ conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp	2006/10/13 09:36:16	1.8
@@ -84,6 +84,20 @@
 }
 
 
+void 
+Monitor::update_now()
+{
+  try {
+    MutexLocker l(_mutex);
+    String my_nodename, clustername, msg;
+    vector<String> nodenames = get_local_info(my_nodename,
+					      clustername,
+					      msg);
+    msg_arrived(my_nodename, msg);
+    _cluster = merge_data(clustername);
+  } catch ( ... ) {}
+}
+
 void
 Monitor::run()
 {
@@ -132,7 +146,11 @@
 {
   MutexLocker l(_mutex);
   if (msg == "GET") {
-    String def(generateXML(XMLObject("cluster")) + "\n");
+    XMLObject def_xml("cluster");
+    def_xml.set_attr("cluster_version", _cl_version);
+    String def(generateXML(def_xml) + "\n");
+    if (_cluster.get() == NULL) 
+      update_now();
     if (_cluster.get() == NULL) 
       return def;
     try {
@@ -178,7 +196,7 @@
 			String& clustername,
 			String& msg)
 {
-  XMLObject cluster = parse_cluster_conf();
+  XMLObject cluster(parse_cluster_conf());
   
   // nodes
   vector<String> nodes;
@@ -255,30 +273,11 @@
 XMLObject 
 Monitor::parse_cluster_conf()
 {
-  XMLObject cluster_conf;
-  char* buff = 0;
-  try {
-    if (access("/etc/cluster/cluster.conf", R_OK))
-      throw String("missing /etc/cluster/cluster.conf");
-    ifstream is("/etc/cluster/cluster.conf");
-    is.seekg(0, ios::end);
-    unsigned int length = is.tellg();
-    is.seekg(0, ios::beg);
-    if (length < 5)
-      throw String("cluster.conf too short");
-    buff = new char[length];
-    is.read(buff, length);
-    String conf(buff, length);
-    delete [] buff; buff = 0;
-    cluster_conf = parseXML(conf);
-    if (cluster_conf.tag() != "cluster" ||
-	utils::strip(cluster_conf.get_attr("name")).empty())
-      throw String("parse_cluster_conf(): invalid cluster.conf");
-  } catch ( ... ) {
-    delete [] buff;
-    throw;
-  }
-  
+  XMLObject cluster_conf(readXML("/etc/cluster/cluster.conf"));
+  if (cluster_conf.tag() != "cluster" ||
+      utils::strip(cluster_conf.get_attr("name")).empty() ||
+      utils::strip(cluster_conf.get_attr("config_version")).empty())
+    throw String("parse_cluster_conf(): invalid cluster.conf");
   
   XMLObject cluster("cluster");
   for (map<String, String>::const_iterator iter = cluster_conf.attrs().begin();
@@ -311,12 +310,17 @@
 	   iter_s != kid.children().end();
 	   iter_s++) {
 	const XMLObject& service_conf = *iter_s;
-	if (service_conf.tag() == "service") {
+	if (service_conf.tag() == "service" ||
+	    service_conf.tag() == "xenvm") {
 	  XMLObject service("service");
 	  for (map<String, String>::const_iterator iter_a = service_conf.attrs().begin();
 	       iter_a != service_conf.attrs().end();
 	       iter_a++)
 	    service.set_attr(iter_a->first, iter_a->second);
+	  if (service_conf.tag() == "xenvm")
+	    service.set_attr("xenvm", "true");
+	  else
+	    service.set_attr("xenvm", "false");
 	  cluster.add_child(service);
 	}
       }
--- conga/ricci/modules/cluster/clumon/src/daemon/Monitor.h	2006/08/15 00:12:33	1.4
+++ conga/ricci/modules/cluster/clumon/src/daemon/Monitor.h	2006/10/13 09:36:16	1.5
@@ -70,6 +70,8 @@
   
   bool _cman_locking;
   
+  void update_now();
+  
   // return (nodenames - my_nodename)
   std::vector<String> get_local_info(String& nodename,
 				     String& clustername,
--- conga/ricci/modules/cluster/clumon/src/daemon/main.cpp	2006/08/10 22:53:08	1.2
+++ conga/ricci/modules/cluster/clumon/src/daemon/main.cpp	2006/10/13 09:36:16	1.3
@@ -182,9 +182,8 @@
 	}
 	if (poll_info.revents & (POLLERR | POLLHUP | POLLNVAL))
 	  throw String("serve_clients(): server socket error????");
-      }
-      // client socket
-      else {
+      } else {
+	// client socket
 	if (poll_info.revents & POLLIN) {
 	  ClientInfo& info = clients[poll_info.fd];
 	  try {



             reply	other threads:[~2006-10-13  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-13  9:36 kupcevic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-09-05 22:27 [Cluster-devel] conga/ricci common/XML.cpp modules/cluster/clu rmccabe

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=20061013093616.29720.qmail@sourceware.org \
    --to=kupcevic@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.