All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga ./conga.spec.in.in luci/site/luci/Extens ...
Date: 25 Jun 2007 19:10:56 -0000	[thread overview]
Message-ID: <20070625191056.21624.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at 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> 



             reply	other threads:[~2007-06-25 19:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-25 19:10 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-09-17  6:29 [Cluster-devel] conga ./conga.spec.in.in luci/site/luci/Extens rmccabe
2008-07-15 18:20 rmccabe
2008-07-14 16:29 rmccabe
2008-05-12 17:09 rmccabe
2008-05-12 17:04 rmccabe
2008-04-28  3:54 rmccabe
2008-04-28  3:49 rmccabe
2008-04-18 20:34 rmccabe
2008-04-14 15:58 rmccabe
2008-01-14 20:51 rmccabe
2007-10-09 21:41 rmccabe
2007-10-09 21:33 rmccabe
2007-10-09 21:31 rmccabe
2007-10-03  2:16 rmccabe
2007-09-20 22:37 rmccabe
2007-08-17 20:26 rmccabe
2007-05-02  2:39 rmccabe
2007-05-02  2:36 rmccabe
2006-12-14  0:01 rmccabe
2006-11-29 22:33 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=20070625191056.21624.qmail@sourceware.org \
    --to=rmccabe@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.