[Cluster-devel] conga ricci/docs/storage_api.html ricci/common ...

kupcevic at sourceware.org kupcevic at sourceware.org
Tue Dec 12 13:11:53 UTC 2006


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

--- conga/ricci/docs/storage_api.html	2006/10/16 20:26:48	1.5
+++ conga/ricci/docs/storage_api.html	2006/12/12 13:11:50	1.6
@@ -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>
--- conga/ricci/common/File.cpp	2006/10/24 21:51:05	1.2
+++ conga/ricci/common/File.cpp	2006/12/12 13:11:50	1.3
@@ -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;
--- conga/luci/site/luci/Extensions/ricci_bridge.py	2006/12/10 19:19:32	1.49
+++ conga/luci/site/luci/Extensions/ricci_bridge.py	2006/12/12 13:11:50	1.50
@@ -43,15 +43,16 @@
 	return (-1, err_msg)
 
 def addClusterNodeBatch(os_str,
-						cluster_name,
-						install_base,
-						install_services,
-						install_shared_storage,
-						install_LVS,
-						upgrade_rpms):
-
+			cluster_name,
+			install_base,
+			install_services,
+			install_shared_storage,
+			install_LVS,
+			upgrade_rpms):
+	
 	batch = '<?xml version="1.0" ?>'
 	batch += '<batch>'
+	
 	batch += '<module name="rpm">'
 	batch += '<request API_version="1.0">'
 	batch += '<function_call name="install">'
@@ -61,9 +62,7 @@
 	else:
 		batch += 'false'
 	batch += '"/>'
-
 	batch += '<var name="sets" type="list_xml">'
-
 	if install_base or install_services or install_shared_storage:
 		batch += '<set name="Cluster Base"/>'
 	if install_services:
@@ -72,45 +71,42 @@
 		batch += '<set name="Clustered Storage"/>'
 	if install_LVS:
 		batch += '<set name="Linux Virtual Server"/>'
-
 	batch += '</var>'
 	batch += '</function_call>'
 	batch += '</request>'
 	batch += '</module>'
-
+	
+	batch += '<module name="service">'
+	batch += '<request API_version="1.0">'
+	batch += '<function_call name="disable">'
+	batch += '<var mutable="false" name="services" type="list_xml">'
+	if install_base or install_services or install_shared_storage:
+		batch += '<set name="Cluster Base"/>'
+	if install_services:
+		batch += '<set name="Cluster Service Manager"/>'
+	if install_shared_storage:
+		batch += '<set name="Clustered Storage"/>'
+	if install_LVS:
+		batch += '<set name="Linux Virtual Server"/>'
+	batch += '</var>'
+	batch += '</function_call>'
+	batch += '</request>'
+	batch += '</module>'
+	
 	need_reboot = install_base or install_services or install_shared_storage or install_LVS
 	if need_reboot:
-		batch += '<module name="service">'
-		batch += '<request API_version="1.0">'
-		batch += '<function_call name="disable">'
-		batch += '<var mutable="false" name="services" type="list_xml">'
-		if os_str == 'rhel4':
-			batch += '<service name="ccsd"/>'
-		batch += '<service name="cman"/>'
-		batch += '</var>'
-		batch += '</function_call>'
-		batch += '</request>'
-		batch += '</module>'
-
 		batch += '<module name="reboot">'
 		batch += '<request API_version="1.0">'
 		batch += '<function_call name="reboot_now"/>'
 		batch += '</request>'
 		batch += '</module>'
 	else:
-		# need 2 placeholders instead of disable services / reboot
 		batch += '<module name="rpm">'
 		batch += '<request API_version="1.0">'
 		batch += '<function_call name="install"/>'
 		batch += '</request>'
 		batch += '</module>'
-
-		batch += '<module name="rpm">'
-		batch += '<request API_version="1.0">'
-		batch += '<function_call name="install"/>'
-		batch += '</request>'
-		batch += '</module>'
-
+	
 	batch += '<module name="cluster">'
 	batch += '<request API_version="1.0">'
 	batch += '<function_call name="set_cluster.conf">'
@@ -127,27 +123,20 @@
 	batch += '</function_call>'
 	batch += '</request>'
 	batch += '</module>'
-
-	if need_reboot:
-		batch += '<module name="service">'
+	
+	if install_shared_storage:
+		batch += '<module name="storage">'
 		batch += '<request API_version="1.0">'
-		batch += '<function_call name="enable">'
-		batch += '<var mutable="false" name="services" type="list_xml">'
-		if os_str == 'rhel4':
-			batch += '<service name="ccsd"/>'
-		batch += '<service name="cman"/>'
-		batch += '</var>'
-		batch += '</function_call>'
+		batch += '<function_call name="enable_clustered_lvm"/>'
 		batch += '</request>'
 		batch += '</module>'
 	else:
-		# placeholder instead of enable services
 		batch += '<module name="rpm">'
 		batch += '<request API_version="1.0">'
 		batch += '<function_call name="install"/>'
 		batch += '</request>'
 		batch += '</module>'
-
+	
 	batch += '<module name="cluster">'
 	batch += '<request API_version="1.0">'
 	batch += '<function_call name="start_node"/>'
@@ -157,18 +146,19 @@
 
 	return minidom.parseString(batch).firstChild
 
-def createClusterBatch(	os_str,
-						cluster_name,
-						cluster_alias,
-						nodeList,
-						install_base,
-						install_services,
-						install_shared_storage,
-						install_LVS,
-						upgrade_rpms):
-
+def createClusterBatch(os_str,
+		       cluster_name,
+		       cluster_alias,
+		       nodeList,
+		       install_base,
+		       install_services,
+		       install_shared_storage,
+		       install_LVS,
+		       upgrade_rpms):
+	
 	batch = '<?xml version="1.0" ?>'
 	batch += '<batch>'
+	
 	batch += '<module name="rpm">'
 	batch += '<request API_version="1.0">'
 	batch += '<function_call name="install">'
@@ -179,7 +169,6 @@
 		batch += 'false'
 	batch += '"/>'
 	batch += '<var name="sets" type="list_xml">'
-
 	if install_base or install_services or install_shared_storage:
 		batch += '<set name="Cluster Base"/>'
 	if install_services:
@@ -192,40 +181,38 @@
 	batch += '</function_call>'
 	batch += '</request>'
 	batch += '</module>'
-
+	
+	batch += '<module name="service">'
+	batch += '<request API_version="1.0">'
+	batch += '<function_call name="disable">'
+	batch += '<var mutable="false" name="services" type="list_xml">'
+	if install_base or install_services or install_shared_storage:
+		batch += '<set name="Cluster Base"/>'
+	if install_services:
+		batch += '<set name="Cluster Service Manager"/>'
+	if install_shared_storage:
+		batch += '<set name="Clustered Storage"/>'
+	if install_LVS:
+		batch += '<set name="Linux Virtual Server"/>'
+	batch += '</var>'
+	batch += '</function_call>'
+	batch += '</request>'
+	batch += '</module>'
+	
 	need_reboot = install_base or install_services or install_shared_storage or install_LVS
 	if need_reboot:
-		batch += '<module name="service">'
-		batch += '<request API_version="1.0">'
-		batch += '<function_call name="disable">'
-		batch += '<var mutable="false" name="services" type="list_xml">'
-		if os_str == 'rhel4':
-			batch += '<service name="ccsd"/>'
-		batch += '<service name="cman"/>'
-		batch += '</var>'
-		batch += '</function_call>'
-		batch += '</request>'
-		batch += '</module>'
-
 		batch += '<module name="reboot">'
 		batch += '<request API_version="1.0">'
 		batch += '<function_call name="reboot_now"/>'
 		batch += '</request>'
 		batch += '</module>'
 	else:
-		# need 2 placeholders instead of disable services / reboot
 		batch += '<module name="rpm">'
 		batch += '<request API_version="1.0">'
 		batch += '<function_call name="install"/>'
 		batch += '</request>'
 		batch += '</module>'
-
-		batch += '<module name="rpm">'
-		batch += '<request API_version="1.0">'
-		batch += '<function_call name="install"/>'
-		batch += '</request>'
-		batch += '</module>'
-
+	
 	batch += '<module name="cluster">'
 	batch += '<request API_version="1.0">'
 	batch += '<function_call name="set_cluster.conf">'
@@ -233,9 +220,7 @@
 	batch += '<var mutable="false" name="cluster.conf" type="xml">'
 	batch += '<cluster config_version="1" name="' + cluster_name + '" alias="' + cluster_alias + '">'
 	batch += '<fence_daemon post_fail_delay="0" post_join_delay="3"/>'
-
 	batch += '<clusternodes>'
-
 	x = 1
 	for i in nodeList:
 		if os_str == "rhel4":
@@ -243,14 +228,11 @@
 		else:
 			batch += '<clusternode name="' + i + '" votes="1" nodeid="' + str(x) + '" />'
 		x = x + 1
-
 	batch += '</clusternodes>'
-
 	if len(nodeList) == 2:
 		batch += '<cman expected_votes="1" two_node="1"/>'
 	else:
 		batch += '<cman/>'
-
 	batch += '<fencedevices/>'
 	batch += '<rm/>'
 	batch += '</cluster>'
@@ -258,27 +240,20 @@
 	batch += '</function_call>'
 	batch += '</request>'
 	batch += '</module>'
-
-	if need_reboot:
-		batch += '<module name="service">'
+	
+	if install_shared_storage:
+		batch += '<module name="storage">'
 		batch += '<request API_version="1.0">'
-		batch += '<function_call name="enable">'
-		batch += '<var mutable="false" name="services" type="list_xml">'
-		if os_str == 'rhel4':
-			batch += '<service name="ccsd"/>'
-		batch += '<service name="cman"/>'
-		batch += '</var>'
-		batch += '</function_call>'
+		batch += '<function_call name="enable_clustered_lvm"/>'
 		batch += '</request>'
 		batch += '</module>'
 	else:
-		# placeholder instead of enable services
 		batch += '<module name="rpm">'
 		batch += '<request API_version="1.0">'
 		batch += '<function_call name="install"/>'
 		batch += '</request>'
 		batch += '</module>'
-
+	
 	batch += '<module name="cluster">'
 	batch += '<request API_version="1.0">'
 	batch += '<function_call name="start_node">'
--- conga/luci/cluster/form-macros	2006/12/11 22:42:34	1.128
+++ conga/luci/cluster/form-macros	2006/12/12 13:11:51	1.129
@@ -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/conga.spec.in.in	2006/12/11 23:52:41	1.59
+++ conga/conga.spec.in.in	2006/12/12 13:11:51	1.60
@@ -284,7 +284,7 @@
 
 %changelog
 
-* Wed Dec 06 2006 Stanko Kupcevic <kupcevic at redhat.com> 0.9.1-2
+* Tue Dec 12 2006 Stanko Kupcevic <kupcevic at redhat.com> 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
--- conga/ricci/test_suite/storage/disable_clustered_lvm.xml
+++ -	2006-12-12 13:11:52.960972000 +0000
@@ -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
--- conga/ricci/test_suite/storage/enable_clustered_lvm.xml
+++ -	2006-12-12 13:11:53.173341000 +0000
@@ -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>
+
--- conga/ricci/modules/storage/LV.cpp	2006/09/26 01:16:13	1.6
+++ conga/ricci/modules/storage/LV.cpp	2006/12/12 13:11:51	1.7
@@ -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();
--- conga/ricci/modules/storage/LVM.cpp	2006/11/29 16:39:34	1.9
+++ conga/ricci/modules/storage/LVM.cpp	2006/12/12 13:11:51	1.10
@@ -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();
     
--- conga/ricci/modules/storage/LVM.h	2006/08/10 22:53:09	1.4
+++ conga/ricci/modules/storage/LVM.h	2006/12/12 13:11:51	1.5
@@ -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();
   
 };
 
--- conga/ricci/modules/storage/PV.cpp	2006/08/10 22:53:09	1.4
+++ conga/ricci/modules/storage/PV.cpp	2006/12/12 13:11:51	1.5
@@ -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();
   
--- conga/ricci/modules/storage/StorageModule.cpp	2006/10/16 20:26:48	1.5
+++ conga/ricci/modules/storage/StorageModule.cpp	2006/12/12 13:11:51	1.6
@@ -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;
+}
--- conga/ricci/modules/storage/VG.cpp	2006/10/16 15:32:25	1.8
+++ conga/ricci/modules/storage/VG.cpp	2006/12/12 13:11:51	1.9
@@ -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 {




More information about the Cluster-devel mailing list