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/modules/cluster ClusterStatus.cpp  ...
Date: 16 Oct 2006 19:44:31 -0000	[thread overview]
Message-ID: <20061016194431.14900.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic at 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);



             reply	other threads:[~2006-10-16 19:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-16 19:44 kupcevic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-10-24 14:31 [Cluster-devel] conga/ricci/modules/cluster ClusterStatus.cpp kupcevic
2006-10-24 14:56 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=20061016194431.14900.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.