[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/ricci/modules/cluster ClusterStatus.cpp ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic sourceware org	2006-10-16 19:44:30

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

Log message:
	cluster module: mark services as being xenvms, in status report

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterStatus.cpp.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.cpp.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10

--- conga/ricci/modules/cluster/ClusterStatus.cpp	2006/10/06 03:10:13	1.14
+++ conga/ricci/modules/cluster/ClusterStatus.cpp	2006/10/16 19:44:30	1.15
@@ -59,6 +59,29 @@
 
 
 
+
+bool
+is_service_xenvm(const XMLObject& cluster_conf, const String& name)
+{
+  for (list<XMLObject>::const_iterator iter = cluster_conf.children().begin();
+       iter != cluster_conf.children().end();
+       iter++) {
+    const XMLObject& kid = *iter;
+    if (kid.tag() == "rm")
+      for (list<XMLObject>::const_iterator iter_s = kid.children().begin();
+	   iter_s != kid.children().end();
+	   iter_s++) {
+	const XMLObject& service_conf = *iter_s;
+	if (iter_s->tag() == "xenvm")
+	  if (iter_s->get_attr("name") == name)
+	    return true;;
+      }
+  }
+  return false;
+}
+
+
+
 XMLObject 
 Cluster::status()
 {
@@ -100,14 +123,35 @@
     if (read)
       xml_in += sock.recv();
     try {
-      return parseXML(xml_in);
+      parseXML(xml_in);
+      break;
     } catch ( ... ) {}
   }
   
-  return parseXML(xml_in);
+  const XMLObject status_xml(parseXML(xml_in));
+  
+  const XMLObject cluster_conf(ClusterConf::get());
+  if (cluster_conf.get_attr("name") != status_xml.get_attr("name"))
+    throw String("cluster names mismatch");
+  
+  // add "xenvm" attr to services
+  XMLObject status_new(status_xml.tag());
+  for (map<String, String>::const_iterator iter = status_xml.attrs().begin();
+       iter != status_xml.attrs().end();
+       iter++)
+    status_new.set_attr(iter->first, iter->second);
+  for (list<XMLObject>::const_iterator iter = status_xml.children().begin();
+       iter != status_xml.children().end();
+       iter++) {
+    XMLObject s(*iter);
+    if (s.tag() == "service")
+      s.set_attr("xenvm", 
+		 (is_service_xenvm(cluster_conf, s.get_attr("name"))) ? "true" : "false");
+    status_new.add_child(s);
+  }
+  return status_new;
 }
 
-
 void 
 Cluster::start_node(bool cluster_startup)
 {
--- conga/ricci/modules/cluster/Clusvcadm.cpp	2006/10/12 20:01:51	1.6
+++ conga/ricci/modules/cluster/Clusvcadm.cpp	2006/10/16 19:44:30	1.7
@@ -240,7 +240,6 @@
     else if (iter->tag() == "quorum")
       quorum_xml = *iter;
   
-  // TODO: groupmember missing in CS5
   if (quorum_xml.get_attr("groupmember") != "1")
     throw NoServiceManager();
   
--- conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp	2006/10/14 18:00:02	1.9
+++ conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp	2006/10/16 19:44:30	1.10
@@ -634,14 +634,14 @@
 	     iter++) {
 	  const XMLObject& group = *iter;
 	  XMLObject service("service");
+	  service.set_attr("xenvm", "false");
 	  
 	  // name
 	  String name(group.get_attr("name"));
-	  bool xenvm = false;
 	  String::size_type idx = name.find(":");
 	  if (idx != name.npos) {
 	    if (name.substr(0, idx) == "xenvm")
-	      xenvm = true;
+	      service.set_attr("xenvm", "true");
 	    name = name.substr(idx + 1);
 	  }
 	  service.set_attr("name", name);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]