Skip to contentSkip to conversation

conga luci/cluster/index_html luci/docs/user_m ...

Cluster-devel [email protected] 1 participant 1 message Jun 27, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-06-27 08:14:23

Modified files:
luci/cluster : index_html
luci/docs : user_manual.html
luci/site/luci/Extensions: HelperFunctions.py LuciDB.py
RicciQueries.py cluster_adapters.py ricci_communicator.py storage_adapters.py
luci/site/luci/Extensions/ClusterModel: ModelBuilder.py luci/site/luci/var: Data.fs
luci/storage : form-macros index_html
ricci/modules/storage: FSController.cpp FSController.h Makefile
StorageModule.cpp
Added files:
ricci/test_suite/storage: get_fs_group_members.xml

Log message:
Sync with the RHEL5 branch

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/docs/user_manual.html.diff?cvsroot=cluster&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/HelperFunctions.py.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.257&r2=1.258
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/storage_adapters.py.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/Data.fs.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/form-macros.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/index_html.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/FSController.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/FSController.h.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Makefile.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/StorageModule.cpp.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/storage/get_fs_group_members.xml.diff?cvsroot=cluster&r1=1.1&r2=1.2

luci/cluster/index_html +2 -2
@@ -44,7 +44,7 @@
 			<tal:block tal:condition="firsttime">
 				<tal:block tal:define="global busywaiting python:True" />
 				<meta http-equiv="refresh"
-					tal:attributes="content isBusy/refreshurl | string:." />
+					tal:attributes="content isBusy/refreshurl | python:'3%surl=/luci/cluster' % chr(0x3b)" />
 			</tal:block>
 
 			<tal:block tal:define="global busy isBusy/busy | nothing" />
@@ -52,7 +52,7 @@
 			<tal:block tal:condition="busy">
 				<tal:block tal:define="global busywaiting python:True" />
 				<meta http-equiv="refresh"
-					tal:attributes="content isBusy/refreshurl | string:." />
+					tal:attributes="content isBusy/refreshurl | python:'3%surl=/luci/cluster' % chr(0x3b)" />
 			</tal:block>
 		</tal:block>
     </metal:headslot>
luci/docs/user_manual.html +2 -1
@@ -40,7 +40,8 @@
     can be started with the command "service luci start". The first time the
     server is started, it is initialized by generating https SSL certificates
     for that server and an initial password for the admin user is generated as a
-    random value. The admin password can be set any time by running the
+    random value. The admin password can be set any time by first stopping
+    the luci service with 'service luci stop, and then running the
     /usr/sbin/luci_admin application and specifying "password" on the command
     line. luci_admin can be run before luci is started for the first time to set
     up an initial password for the admin account. Other utilities available from
luci/site/luci/Extensions/HelperFunctions.py +34 -8

73 lines not on this page · raw message

luci/site/luci/Extensions/LuciDB.py +1 -1
@@ -158,7 +158,7 @@
 			return True
 
 		batch_id = item[1].getProperty(BATCH_ID)
-		batch_ret = rq.checkBatch(rc, batch_id)
+		batch_ret = rc.batch_status(batch_id)
 		finished = batch_ret[0]
 		if finished is True or finished == -1:
 			if finished == -1:
luci/site/luci/Extensions/RicciQueries.py +4 -44

65 lines not on this page · raw message

luci/site/luci/Extensions/cluster_adapters.py +3 -4
@@ -641,7 +641,7 @@
 	# abort the whole process.
 	try:
 		while True:
-			batch_ret = rq.checkBatch(cluster_ricci, batch_number)
+			batch_ret = cluster_ricci.batch_status(batch_number)
 			code = batch_ret[0]
 			if code is True:
 				break
@@ -2592,8 +2592,7 @@
 	54: validateFenceEdit,
 	55: validateDaemonProperties,
 	57: deleteFenceDevice,
-	58: validateNodeFenceConfig,
-	90: validate_svc_update
+	58: validateNodeFenceConfig
 }
 
 def validatePost(self, request):
@@ -3108,7 +3107,7 @@
 
 			if rc is not None:
 				batch_num = item[1].getProperty(BATCH_ID)
-				batch_res = rq.checkBatch(rc, batch_num)
+				batch_res = rc.batch_status(batch_num)
 				finished = batch_res[0]
 				err_msg = batch_res[1]
 
luci/site/luci/Extensions/ricci_communicator.py +54 -6

96 lines not on this page · raw message

luci/site/luci/Extensions/storage_adapters.py +14 -1
@@ -10,9 +10,13 @@
 	PT_MAPPER_TYPE, PT_PATH, STONAME, STORAGE, STORAGESYS, \
 	VIEW_BD, VIEW_BDS, VIEW_MAPPER, VIEW_MAPPERS
 
-from ricci_defines import MAPPER_SYS_TYPE, MAPPER_VG_TYPE, SYSTEM_PREFIX, VG_PREFIX
+from ricci_defines import MAPPER_SYS_TYPE, MAPPER_VG_TYPE, \
+	SYSTEM_PREFIX, VG_PREFIX
+
 from LuciZope import get_systems_statuses
 
+from StorageReport import invalidate_storage_report
+
 def createStorageChooser(self, request, systems):
   dummynode = {}
 
@@ -29,6 +33,15 @@
   except KeyError, e:
     url = "."
 
+  if stoname and request.has_key('reprobe_storage'):
+    try:
+      invalidate_storage_report(request.SESSION, stoname)
+      redirect_url = '%s?%s' % (request['ACTUAL_URL'], request['QUERY_STRING'])
+      redirect_url = redirect_url.replace('&reprobe_storage=true', '')
+      request.RESPONSE.redirect(redirect_url)
+    except:
+      pass
+
   try:
     pagetype = request[PAGETYPE]
   except KeyError, e:
luci/site/luci/Extensions/ClusterModel/ModelBuilder.py +3 -0
@@ -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:

Binary files /cvs/cluster/conga/luci/site/luci/var/Data.fs 2007/06/25 16:03:39 1.26 and /cvs/cluster/conga/luci/site/luci/var/Data.fs 2007/06/27 08:14:13 1.27 differ
rcsdiff: /cvs/cluster/conga/luci/site/luci/var/Data.fs: diff failed

luci/storage/form-macros +7 -7
@@ -103,7 +103,7 @@
         tal:define="batch_id     python:here.apply_storage_changes(ricci, storage_report, request); 
                     check_URL    context/storage/check-batch/absolute_url; 
                     check_url    python:check_URL + '?storagename=' + storagename + '&batch_id=' + batch_id">
-   <div metal:use-macro="here/form-macros/macros/display-commiting-changes"/>
+   <div metal:use-macro="here/form-macros/macros/display-committing-changes"/>
    <form id="urls_form">
     <input tal:attributes="type  string:hidden;
                            name  string:check_url;
@@ -148,7 +148,7 @@
          } else {
            m = msg;
          }
-         alert('An error has occured while commiting changes:\n\n' + m);
+         alert('An error has occured while committing changes:\n\n' + m);
          window.location = err_url;
       }
     } else {
@@ -179,7 +179,7 @@
 
 
 
-<div metal:define-macro="display-commiting-changes">
+<div metal:define-macro="display-committing-changes">
    <table style="width: 100%;">
     <tr>
      <td align="center">
@@ -188,7 +188,7 @@
     </tr>
     <tr>
      <td align="center">
-      <div style="padding-bottom: 4cm;">Commiting Changes</div>
+      <div style="padding-bottom: 4cm;">Committing Changes</div>
      </td>
     </tr>
    </table>
@@ -266,11 +266,11 @@
        <td>
         <select name="preferred_size_units" onchange="this.form.submit()">
          <option value="MB" 
-                 tal:attributes="selected python:preferred_size_units == 'MB'">MB - MegaBytes</option>
+                 tal:attributes="selected python:preferred_size_units == 'MB'">MB - Megabytes</option>
          <option value="GB" 
-                 tal:attributes="selected python:preferred_size_units == 'GB'">GB - GigaBytes</option>
+                 tal:attributes="selected python:preferred_size_units == 'GB'">GB - Gigabytes</option>
          <option value="TB" 
-                 tal:attributes="selected python:preferred_size_units == 'TB'">TB - TeraBytes</option>
+                 tal:attributes="selected python:preferred_size_units == 'TB'">TB - Terabytes</option>
         </select>
        </td>
       </tr>
luci/storage/index_html +13 -4
@@ -174,7 +174,7 @@
                         global storage_report nothing"/>
       <span tal:omit-tag=""
             tal:condition="storagename"
-            tal:define="report_cached python:here.is_storage_report_cached(request.SESSION, storagename)">
+            tal:define="global report_cached python:here.is_storage_report_cached(request.SESSION, storagename)">
        <span tal:omit-tag=""
              tal:condition="report_cached">
         <span tal:omit-tag=""
@@ -216,11 +216,20 @@
                       <h1 tal:content="storagename"></h1>
                     </span>
                   </div>
+				<metal:main-form-content use-macro="here/form-chooser/macros/main-form" />
+				<div style="padding-top: 10px;"
+					tal:condition="python: report_cached and not (request.has_key('pagetype') and request['pagetype']=='commit_changes')">
+					<form>
+						<input type="hidden" name="reprobe_url"
+							tal:attributes="value
+								python:'%s?%s&reprobe_storage=true' % (request['ACTUAL_URL'], request['QUERY_STRING'])" />
+						<input class="form_button" type="button" name="reprobe"
+							value="Reprobe Storage"
+							onclick="javascript:location=this.form.reprobe_url.value;" />
+					</form>
+				</div>
                 </div>
               </metal:block>
-              <metal:main-form-content use-macro="here/form-chooser/macros/main-form">
-                <h1>Future Site of Forms</h1>
-              </metal:main-form-content>
             </td>
             <tal:comment replace="nothing"> End of main content block </tal:comment>
           </tr>
ricci/modules/storage/FSController.cpp +24 -3
@@ -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 <[email protected]>
  */
 
-
 #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)
ricci/modules/storage/FSController.h +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();
ricci/modules/storage/Makefile +1 -1
@@ -56,7 +56,7 @@
 
 INCLUDE    += 
 CXXFLAGS   += 
-LDFLAGS    += -lmagic
+LDFLAGS    += -lgroup -lmagic
 
 all: ${TARGET}
 
ricci/modules/storage/StorageModule.cpp +32 -0
@@ -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> 
ricci/test_suite/storage/get_fs_group_members.xml +13 -0
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<ricci version="1.0" function="process_batch" async="false">
+	<batch>
+		<module name="storage">
+			<request sequence="1254" API_version="1.0">
+				<function_call name="get_fs_group_members" >
+					<var mutable="false" name="fsname" value="gfsname" type="string" />
+				</function_call>
+			</request>
+		</module>
+	</batch>
+</ricci>
+