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

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



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic sourceware org	2006-10-12 20:01:51

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

Log message:
	rpm module & modcluster: implement changes in `clustat -x` output

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.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.6&r2=1.7

--- conga/ricci/modules/cluster/Clusvcadm.cpp	2006/10/06 03:10:13	1.5
+++ conga/ricci/modules/cluster/Clusvcadm.cpp	2006/10/12 20:01:51	1.6
@@ -51,15 +51,18 @@
   
   ServiceStatus(const String& name,
 		const String& node, 
-		state status) :
+		state status,
+		bool xenvm) :
     name(name),
     node(node),
-    status(status) {}
+    status(status),
+    xenvm(xenvm) {}
   virtual ~ServiceStatus() {}
   
   String name;
   String node;
   state status;
+  bool xenvm;
 };
 
 
@@ -101,8 +104,12 @@
 	  iter->status == ServiceStatus::RG_STATE_DISABLED)
 	flag = "-e";
       else if (iter->status == ServiceStatus::RG_STATE_STARTED ||
-	       iter->status == ServiceStatus::RG_STATE_STARTING)
-	flag = "-r";
+	       iter->status == ServiceStatus::RG_STATE_STARTING) {
+	if (iter->xenvm)
+	  flag = "-M";
+	else
+	  flag = "-r";
+      }
       
       if (flag.size()) {
 	String out, err;
@@ -215,7 +222,7 @@
   args.push_back("-x");
   if (utils::execute(CLUSTAT_TOOL_PATH, args, out, err, status, false))
     throw command_not_found_error_msg(CLUSTAT_TOOL_PATH);
-  if (status != 0)
+  if (status)
     throw String("clustat failed");
   
   XMLObject xml = parseXML(out);
@@ -249,11 +256,18 @@
        iter != groups_xml.children().end();
        iter++)
     if (iter->tag() == "group") {
+      bool xenvm = false;
       String name(iter->get_attr("name"));
+      String::size_type idx = name.find(":");
+      if (idx != name.npos) {
+	if (name.substr(0, idx) == "xenvm")
+	  xenvm = true;
+	name = name.substr(idx + 1);
+      }
       String node(iter->get_attr("owner"));
       ServiceStatus::state state = (ServiceStatus::state) 
 	utils::to_long(iter->get_attr("state"));
-      services.push_back(ServiceStatus(name, node, state));
+      services.push_back(ServiceStatus(name, node, state, xenvm));
     }
   
   return pair<list<String>, list<ServiceStatus> >(nodes, services);
--- conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp	2006/08/15 00:12:33	1.6
+++ conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp	2006/10/12 20:01:51	1.7
@@ -628,7 +628,16 @@
 	  XMLObject service("service");
 	  
 	  // name
-	  service.set_attr("name", group.get_attr("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;
+	    name = name.substr(idx + 1);
+	  }
+	  service.set_attr("name", name);
+	  
 	  
 	  // state
 	  bool failed, running;


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