Skip to contentSkip to conversation

conga ricci/docs/storage_api.html ricci/common ...

Cluster-devel [email protected] 1 participant 1 message Dec 12, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-12-12 13:11:51

Modified files:
ricci/docs : storage_api.html
ricci/common : File.cpp
luci/site/luci/Extensions: ricci_bridge.py
luci/cluster : form-macros
. : conga.spec.in.in
ricci/modules/storage: LV.cpp LVM.cpp LVM.h PV.cpp
StorageModule.cpp VG.cpp
Added files:
ricci/test_suite/storage: disable_clustered_lvm.xml
enable_clustered_lvm.xml

Log message:
Fixed bz217703 (clustered vg creation fails)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/storage_api.html.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/File.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.128&r2=1.129
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/storage/disable_clustered_lvm.xml.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/storage/enable_clustered_lvm.xml.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LV.cpp.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.h.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PV.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/StorageModule.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/VG.cpp.diff?cvsroot=cluster&r1=1.8&r2=1.9

ricci/docs/storage_api.html +24 -0
@@ -374,6 +374,30 @@
 		especially unmount error if content fails to unmount</P>
 	</UL>
 </UL>
+	<LI><P>enable_clustered_lvm</P>
+	<UL>
+		<P>Enable LVM's cluster locking. 
+		It is an error to call this function if lvm2-cluster 
+		is not installed.
+		</P>
+		<P>No input variables.
+		</P>
+		<P>No output variables.</P>
+		<P>On failure:<BR>- No special errors defined, only generic ones
+		might get returned.</P>
+	</UL>
+	<LI><P>disable_clustered_lvm</P>
+	<UL>
+		<P>Disable LVM's cluster locking. 
+		It is an error to call this function if lvm2-cluster 
+		is not installed.
+		</P>
+		<P>No input variables.
+		</P>
+		<P>No output variables.</P>
+		<P>On failure:<BR>- No special errors defined, only generic ones
+		might get returned.</P>
+	</UL>
 <P ALIGN=LEFT><BR><BR>
 </P>
 </BODY>
ricci/common/File.cpp +1 -1
@@ -51,7 +51,7 @@
 	   bool rw)
 {
   if (access(filepath.c_str(), R_OK))
-    throw String("missing file ") + filepath;
+    throw String("unable to read file ") + filepath;
   ios_base::openmode mode = ios_base::in;
   if (rw)
     mode |= ios_base::out;
luci/site/luci/Extensions/ricci_bridge.py +67 -92

278 lines not on this page · raw message

luci/cluster/form-macros +1 -2
@@ -45,8 +45,7 @@
            <img src="rebooted.png" alt="[cluster node rebooted]" />
           </span>
 
-          <span tal:condition="
-				python: nodereport['statusindex'] == 4 or nodereport['statusindex'] == 5">
+          <span tal:condition="python: nodereport['statusindex'] == 4 or nodereport['statusindex'] == 5">
            <img src="configured.png" alt="[cluster node configured]" />
           </span>
 
conga.spec.in.in +2 -1
@@ -284,7 +284,7 @@
 
 %changelog
 
-* Wed Dec 06 2006 Stanko Kupcevic <[email protected]> 0.9.1-2
+* Tue Dec 12 2006 Stanko Kupcevic <[email protected]> 0.9.1-2
 
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 XXXXXXXXXXXXXXXXXXX UPDATE NOT RELEASED YET XXXXXXXXXXXXXXXXXXX
@@ -297,6 +297,7 @@
 - Fixed bz218040 (luci reports "unknown" as cluster name if cluster creation fails)
 - Fixed bz218941 (Conga/luci - cannot add node to cluster via luci web app)
 - Fixed bz219156 (Errors in performing node-specific tasks due to ricci outage not reflected in luci display)
+- Fixed bz217703 (clustered vg creation fails)
 
 
 

/cvs/cluster/conga/ricci/test_suite/storage/disable_clustered_lvm.xml,v --> standard output revision 1.1

- renamed from ricci/test_suite/storage/disable_clustered_lvm.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="disable_clustered_lvm" />
+</request>
+</module>
+
+</batch>
+</ricci>
+

/cvs/cluster/conga/ricci/test_suite/storage/enable_clustered_lvm.xml,v --> standard output revision 1.1

- renamed from ricci/test_suite/storage/enable_clustered_lvm.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="enable_clustered_lvm" />
+</request>
+</module>
+
+</batch>
+</ricci>
+
ricci/modules/storage/LV.cpp +3 -3
@@ -45,7 +45,7 @@
   
   
   // if VG is marked as clustered, but cluster locking is not available, throw
-  if (!LVM::clustered_available() &&
+  if (!LVM::clustered_enabled() &&
       bd_temp.props.get("clustered").get_bool())
     throw ClvmdError();
   
@@ -183,7 +183,7 @@
 {
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (_props.get("clustered").get_bool() &&
-      !LVM::clustered_available())
+      !LVM::clustered_enabled())
     throw ClvmdError();
   
   // snapshots neither resize nor replace content, see LV()
@@ -247,7 +247,7 @@
 {
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (_props.get("clustered").get_bool() &&
-      !LVM::clustered_available())
+      !LVM::clustered_enabled())
     throw ClvmdError();
   
   content->remove();
ricci/modules/storage/LVM.cpp +34 -4
@@ -83,6 +83,9 @@
 
 
 
+static String LVMCONF_PATH("/usr/sbin/lvmconf");
+
+
 // pvs
 static String PVS_OPTIONS = "pv_name,vg_name,pv_size,pv_free,pv_attr,pv_fmt,pv_uuid,vg_extent_size";
 static unsigned int PVS_NAME_IDX         = 0;
@@ -437,7 +440,7 @@
 	      const list<String>& pv_paths)
 {
   if (clustered &&
-      !clustered_available())
+      !clustered_enabled())
     throw ClvmdError();
   
   vector<String> args;
@@ -520,7 +523,7 @@
 	      bool clustered)
 {
   if (clustered &&
-      !clustered_available())
+      !clustered_enabled())
     throw ClvmdError();
   
   vector<String> args;
@@ -642,12 +645,39 @@
 
 
 bool 
-LVM::clustered_available()
+LVM::clustered_enabled()
 {
   String locking_type = get_locking_type();
   return (locking_type == "2" || locking_type == "3");
 }
 
+void 
+LVM::enable_clustered()
+{
+  String out, err;
+  int status;
+  vector<String> args;
+  args.push_back("--enable-cluster");
+  if (utils::execute(LVMCONF_PATH, args, out, err, status, false))
+    throw command_not_found_error_msg(LVMCONF_PATH);
+  if (status != 0)
+    throw String("Failed to enable LVM's clustered locking");
+}
+
+void 
+LVM::disable_clustered()
+{
+  String out, err;
+  int status;
+  vector<String> args;
+  args.push_back("--disable-cluster");
+  if (utils::execute(LVMCONF_PATH, args, out, err, status, false))
+    throw command_not_found_error_msg(LVMCONF_PATH);
+  if (status != 0)
+    throw String("Failed to disable LVM's clustered locking");
+}
+
+
 bool
 cluster_quorate()
 {
@@ -714,7 +744,7 @@
 void 
 LVM::check_locking()
 {
-  if (clustered_available()) {
+  if (clustered_enabled()) {
     if (!cluster_quorate())
       throw ClusterNotQuorateError();
     
ricci/modules/storage/LVM.h +4 -2
@@ -73,9 +73,11 @@
   static void lvreduce(const String& path, long long new_size);
   static void lvextend(const String& path, long long new_size);
   
-  static void check_locking();
-  static bool clustered_available();
   static bool vg_clustered(const String& vgname);
+  static void check_locking();
+  static bool clustered_enabled();
+  static void enable_clustered();
+  static void disable_clustered();
   
 };
 
ricci/modules/storage/PV.cpp +3 -3
@@ -94,7 +94,7 @@
   
   
   // if VG is marked as clustered, but cluster locking is not available, throw
-  if (!LVM::clustered_available() &&
+  if (!LVM::clustered_enabled() &&
       LVM::vg_clustered(vgname))
     throw ClvmdError();
   
@@ -121,7 +121,7 @@
   
   
   // if VG is marked as clustered, but cluster locking is not available, throw
-  if (!LVM::clustered_available() &&
+  if (!LVM::clustered_enabled() &&
       (LVM::vg_clustered(vgname_old) || 
        LVM::vg_clustered(vgname_new)))
     throw ClvmdError();
@@ -153,7 +153,7 @@
   
   
   // if VG is marked as clustered, but cluster locking is not available, throw
-  if (!LVM::clustered_available() &&
+  if (!LVM::clustered_enabled() &&
       LVM::vg_clustered(vgname))
     throw ClvmdError();
   
ricci/modules/storage/StorageModule.cpp +25 -0
@@ -24,6 +24,7 @@
 #include "StorageModule.h"
 #include "MapperFactory.h"
 #include "BDFactory.h"
+#include "LVM.h"
 
 
 using namespace std;
@@ -47,6 +48,9 @@
 static VarMap modify_bd(const VarMap& args);
 static VarMap remove_bd(const VarMap& args);
 
+static VarMap enable_clustered_lvm(const VarMap& args);
+static VarMap disable_clustered_lvm(const VarMap& args);
+
 static ApiFcnMap build_fcn_map();
 
 
@@ -80,6 +84,9 @@
   api_1_0["modify_bd"]                          = modify_bd;
   api_1_0["remove_bd"]                          = remove_bd;
   
+  api_1_0["enable_clustered_lvm"]                 = enable_clustered_lvm;
+  api_1_0["disable_clustered_lvm"]                = disable_clustered_lvm;
+  
   
   ApiFcnMap   api_fcn_map;
   api_fcn_map["1.0"] = api_1_0;
@@ -463,3 +470,21 @@
   
   return temp_list;
 }
+
+VarMap 
+enable_clustered_lvm(const VarMap& args)
+{
+  LVM::enable_clustered();
+  
+  VarMap ret;
+  return ret;
+}
+
+VarMap 
+disable_clustered_lvm(const VarMap& args)
+{
+  LVM::disable_clustered();
+  
+  VarMap ret;
+  return ret;
+}
ricci/modules/storage/VG.cpp +3 -3
@@ -207,7 +207,7 @@
 {
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (_props.get("clustered").get_bool() &&
-      !LVM::clustered_available())
+      !LVM::clustered_enabled())
     throw ClvmdError();
   
   String vgname;
@@ -252,7 +252,7 @@
 {
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (_props.get("clustered").get_bool() &&
-      !LVM::clustered_available())
+      !LVM::clustered_enabled())
     throw ClvmdError();
   
   String vgname = _props.get("vgname").get_string();
@@ -278,7 +278,7 @@
   bool clustered = temp.props.get("clustered").get_bool();
   
   if (clustered &&
-      !LVM::clustered_available())
+      !LVM::clustered_enabled())
     throw ClvmdError();
   
   try {