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

[Cluster-devel] conga ./conga.spec.in.in luci/site/luci/Extens ...



CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe sourceware org	2007-06-25 19:10:55

Modified files:
	.              : conga.spec.in.in 
	luci/site/luci/Extensions/ClusterModel: ModelBuilder.py 
	ricci/modules/storage: FSController.cpp FSController.h Makefile 
	                       StorageModule.cpp 
Added files:
	ricci/test_suite/storage: get_fs_group_members.xml 

Log message:
	Add a call to retrieve the list of nodes with a gfs volume mounted

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.40&r2=1.45.2.41
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.1&r2=1.1.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/FSController.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7&r2=1.7.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/FSController.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.12&r2=1.12.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/StorageModule.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.1&r2=1.5.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/storage/get_fs_group_members.xml.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1

--- conga/conga.spec.in.in	2007/06/25 16:17:27	1.45.2.40
+++ conga/conga.spec.in.in	2007/06/25 19:10:53	1.45.2.41
@@ -38,7 +38,7 @@
 
 BuildRequires: python-devel >= 2.4.1
 BuildRequires: glibc-devel gcc-c++ libxml2-devel sed
-#BuildRequires: pam-devel
+BuildRequires: cman-devel
 BuildRequires: cyrus-sasl-devel >= 2.1
 BuildRequires: openssl-devel dbus-devel pkgconfig file
 
--- conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py	2007/06/18 18:39:33	1.1.4.1
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py	2007/06/25 19:10:55	1.1.4.2
@@ -507,6 +507,9 @@
   def getNodeNames(self):
     return map(lambda x: x.getName(), self.clusternodes_ptr.getChildren())
 
+  def getNodeNameById(self, node_id):
+    return filter(lambda x: x.getAttribute('nodeid') == node_id, self.clusternodes_ptr.getChildren())[0].getName()
+
   def addNode(self, clusternode):
     self.clusternodes_ptr.addChild(clusternode)
     if self.usesMulticast is True:
--- conga/ricci/modules/storage/FSController.cpp	2006/09/26 03:20:47	1.7
+++ conga/ricci/modules/storage/FSController.cpp	2007/06/25 19:10:55	1.7.2.1
@@ -1,5 +1,5 @@
 /*
-  Copyright Red Hat, Inc. 2005
+  Copyright Red Hat, Inc. 2005-2007
 
   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
@@ -20,7 +20,6 @@
  * Author: Stanko Kupcevic <kupcevic redhat com>
  */
 
-
 #include "FSController.h"
 #include "ExtendedFS.h"
 #include "SwapFS.h"
@@ -28,10 +27,32 @@
 #include "GFS2.h"
 #include "UnsupportedFS.h"
 #include "utils.h"
-
+#include <errno.h>
+#include <libgroup.h>
 
 using namespace std;
 
+std::list<String>
+FSController::get_fs_group_ids(const String& name)
+{
+	list<String> members;
+	group_data_t fsgroup;
+
+	if (group_get_group(2, name.c_str(), &fsgroup) != 0)
+		throw String("error retrieving group members for " + name + ": " + strerror(errno));
+
+	if (!fsgroup.member)
+		throw String("the local node does not have " + name + " mounted");
+
+	for (int i = 0 ; i < fsgroup.member_count ; i++) {
+		char buf[8];
+		int ret = snprintf(buf, sizeof(buf), "%d", fsgroup.members[i]);
+		if (ret < 1 || (size_t) ret >= sizeof(buf))
+			throw String("invalid node id");
+    	members.push_back(String(buf));
+	}
+	return members;
+}
 
 counting_auto_ptr<Content> 
 FSController::get_fs(const String& path)
--- conga/ricci/modules/storage/FSController.h	2006/08/10 22:53:09	1.2
+++ conga/ricci/modules/storage/FSController.h	2007/06/25 19:10:55	1.2.2.1
@@ -33,7 +33,8 @@
 class FSController
 {
  public:
-  
+  std::list<String> get_fs_group_ids(const String& name);
+ 
   counting_auto_ptr<Content> get_fs(const String& path);
   
   std::list<counting_auto_ptr<ContentTemplate> > get_available_fss();
--- conga/ricci/modules/storage/Makefile	2006/09/26 03:17:41	1.12
+++ conga/ricci/modules/storage/Makefile	2007/06/25 19:10:55	1.12.2.1
@@ -56,7 +56,7 @@
 
 INCLUDE    += 
 CXXFLAGS   += 
-LDFLAGS    += -lmagic
+LDFLAGS    += -lgroup -lmagic
 
 all: ${TARGET}
 
--- conga/ricci/modules/storage/StorageModule.cpp	2006/12/12 13:26:24	1.5.2.1
+++ conga/ricci/modules/storage/StorageModule.cpp	2007/06/25 19:10:55	1.5.2.2
@@ -25,6 +25,7 @@
 #include "MapperFactory.h"
 #include "BDFactory.h"
 #include "LVM.h"
+#include "FSController.h"
 
 
 using namespace std;
@@ -47,6 +48,7 @@
 static VarMap get_bd(const VarMap& args);
 static VarMap modify_bd(const VarMap& args);
 static VarMap remove_bd(const VarMap& args);
+static VarMap get_fs_group_members(const VarMap& args);
 
 static VarMap enable_clustered_lvm(const VarMap& args);
 static VarMap disable_clustered_lvm(const VarMap& args);
@@ -83,6 +85,8 @@
   api_1_0["get_bd"]                             = get_bd;
   api_1_0["modify_bd"]                          = modify_bd;
   api_1_0["remove_bd"]                          = remove_bd;
+
+  api_1_0["get_fs_group_members"]                   = get_fs_group_members;
   
   api_1_0["enable_clustered_lvm"]                 = enable_clustered_lvm;
   api_1_0["disable_clustered_lvm"]                = disable_clustered_lvm;
@@ -416,8 +420,36 @@
   return ret;
 }
 
+VarMap 
+get_fs_group_members(const VarMap& args)
+{
+  String fsname;
+  try {
+    VarMap::const_iterator iter = args.find("fsname");
+    if (iter == args.end())
+      throw APIerror("missing fsname variable");
+    fsname = iter->second.get_string();
+    if (fsname == "")
+		throw APIerror("missing fsname value");
+  } catch ( String e ) {
+    throw APIerror(e);
+  }
 
+  list<XMLObject> ids_list;
+  list<String> group_ids = FSController().get_fs_group_ids(fsname);
+
+  for (list<String>::iterator iter = group_ids.begin() ; iter != group_ids.end() ; iter++)
+  {
+	XMLObject id_xml("group_member");
+	id_xml.set_attr("nodeid", String(*iter));
+	ids_list.push_back(id_xml);
+  }
 
+  Variable var("group_member_list", ids_list);
+  VarMap ret;
+  ret.insert(pair<String, Variable>(var.name(), var));
+  return ret;
+}
 
 
 list<XMLObject> 


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