[Cluster-devel] conga luci/site/luci/Extensions/StorageReport. ...

kupcevic at sourceware.org kupcevic at sourceware.org
Mon Mar 5 20:14:01 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	kupcevic at sourceware.org	2007-03-05 20:14:00

Modified files:
	luci/site/luci/Extensions: StorageReport.py 
	ricci/test_suite: README 
	ricci/modules/storage: ClusterNotQuorateError.h ClvmdError.h 
	                       LV.cpp LVM.cpp PV.cpp VG.cpp 
Added files:
	ricci/modules/storage: ClusterNotRunningError.h 
	                       LVMClusterLockingError.h 

Log message:
	modstorage: Improve error reporting of clustered nodes

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.20.2.2&r2=1.20.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/README.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/ClusterNotRunningError.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVMClusterLockingError.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ClusterNotQuorateError.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/ClvmdError.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/LV.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.1&r2=1.6.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7.2.4&r2=1.7.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PV.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.1&r2=1.4.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/VG.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.1&r2=1.8.2.2

--- conga/luci/site/luci/Extensions/StorageReport.py	2006/12/08 18:27:32	1.20.2.2
+++ conga/luci/site/luci/Extensions/StorageReport.py	2007/03/05 20:13:59	1.20.2.3
@@ -1409,13 +1409,23 @@
                 # clvmd error
                 error  = True
                 url   += '?' + STONAME + '=' + storagename + '&' + PAGETYPE + '=' + STORAGE
-                msg    = 'either clvmd (clustered LVM daemon) is not running or is not cluster-enabled on ' + storagename
+                msg    = 'clvmd (clustered LVM daemon) is not running on ' + storagename
             elif code == 5:
                 # not quorate
                 error  = True
                 url   += '?' + STONAME + '=' + storagename + '&' + PAGETYPE + '=' + STORAGE
                 msg    = 'Cluster quorum is required, and yet cluster is not quorate. Start cluster, and try again.'
-            elif code > 5:
+            elif code == 6:
+                # LVM cluster locking not enabled
+                error  = True
+                url   += '?' + STONAME + '=' + storagename + '&' + PAGETYPE + '=' + STORAGE
+                msg    = 'LVM cluster locking is not enabled on ' + storagename
+            elif code == 7:
+                # cluster not running
+                error  = True
+                url   += '?' + STONAME + '=' + storagename + '&' + PAGETYPE + '=' + STORAGE
+                msg    = 'Cluster infrastructure is not running on ' + storagename
+            elif code > 8:
                 error  = True
                 url   += '?' + STONAME + '=' + storagename + '&' + PAGETYPE + '=' + STORAGE
                 msg    = err_msg
--- conga/ricci/test_suite/README	2007/03/01 00:31:20	1.1.4.1
+++ conga/ricci/test_suite/README	2007/03/05 20:13:59	1.1.4.2
@@ -1,14 +1,15 @@
-1. make SSL certs
+1. generate SSL cert/key pair
 	./generate_certs.sh
 	this step needs to be performed only once 
 	(cert can be used for multiple riccis - each requires authentication)
 2. modify ricci/authenticate.xml, writing root password of machine hosting ricci to 'password' attribute
-3. run ./ricci_test ricci_hostname ricci/authenticate.xml
-	you are authenticated to that ricci, and don't have to repeat authentication to it
+3. execute `./send_to_ricci ricci_hostname ricci/authenticate.xml`
+	from now on, you are authenticated to that ricci, and don't have to repeat authentication to it
 4. pick/modify one of XML files
 	check ../docs/ for API
-5. execute ./ricci_test ricci_hostname xml_file
+5. execute `./send_to_ricci ricci_hostname xml_file`
 	ricci's response will be printed to stdout
 
+...
 
 15. send ricci/unauthenticate.xml to unauthenticate from that ricci
--- conga/ricci/modules/storage/ClusterNotQuorateError.h	2006/08/10 22:53:09	1.2
+++ conga/ricci/modules/storage/ClusterNotQuorateError.h	2007/03/05 20:13:59	1.2.2.1
@@ -31,7 +31,7 @@
 {
  public:
   ClusterNotQuorateError()
-    : Except(5, String("Quorum required, but cluster not quorate")) {}
+    : Except(5, String("Cluster is not quorate")) {}
   virtual ~ClusterNotQuorateError()
     {}
   
--- conga/ricci/modules/storage/ClvmdError.h	2006/08/10 22:53:09	1.2
+++ conga/ricci/modules/storage/ClvmdError.h	2007/03/05 20:13:59	1.2.2.1
@@ -31,7 +31,7 @@
 {
  public:
   ClvmdError()
-    : Except(4, String("clvmd required, but unable to start. Start cluster infrastructure.")) {}
+    : Except(4, String("clvmd failed to start")) {}
   virtual ~ClvmdError()
     {}
   
--- conga/ricci/modules/storage/LV.cpp	2006/12/12 13:26:24	1.6.2.1
+++ conga/ricci/modules/storage/LV.cpp	2007/03/05 20:13:59	1.6.2.2
@@ -29,7 +29,7 @@
 #include "utils.h"
 #include "ContentFactory.h"
 #include "ContentNone.h"
-#include "ClvmdError.h"
+#include "LVMClusterLockingError.h"
 
 
 using namespace std;
@@ -47,7 +47,7 @@
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (!LVM::clustered_enabled() &&
       bd_temp.props.get("clustered").get_bool())
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   
   String lvname = bd_temp.props.get("lvname").get_string();
@@ -184,7 +184,7 @@
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (_props.get("clustered").get_bool() &&
       !LVM::clustered_enabled())
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   // snapshots neither resize nor replace content, see LV()
   
@@ -248,7 +248,7 @@
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (_props.get("clustered").get_bool() &&
       !LVM::clustered_enabled())
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   content->remove();
   LVM::lvremove(path());
--- conga/ricci/modules/storage/LVM.cpp	2007/01/17 14:41:13	1.7.2.4
+++ conga/ricci/modules/storage/LVM.cpp	2007/03/05 20:13:59	1.7.2.5
@@ -29,6 +29,8 @@
 #include "defines.h"
 #include "ClvmdError.h"
 #include "ClusterNotQuorateError.h"
+#include "ClusterNotRunningError.h"
+#include "LVMClusterLockingError.h"
 
 #include <vector>
 
@@ -162,8 +164,11 @@
   int status;
   if (utils::execute(LVM_BIN_PATH, args, out, err, status))
     throw command_not_found_error_msg(LVM_BIN_PATH);
-  if (status != 0)
+  if (status != 0) {
+    if (err.find("Skipping clustered") != err.npos)
+      throw LVMClusterLockingError();
     throw String("lvdisplay failed");
+  }
   
   vector<String> lines = utils::split(out, "\n");
   for (vector<String>::iterator iter = lines.begin();
@@ -213,8 +218,11 @@
   int status;
   if (utils::execute(LVM_BIN_PATH, args, out, err, status))
     throw command_not_found_error_msg(LVM_BIN_PATH);
-  if (status != 0)
+  if (status != 0) {
+    if (err.find("Skipping clustered") != err.npos)
+      throw LVMClusterLockingError();
     throw String("lvs failed");
+  }
   
   String line = utils::strip(out);
   vector<String> words = utils::split(line, ";");
@@ -268,8 +276,11 @@
   args.push_back("lv_name,vg_name,origin");
   if (utils::execute(LVM_BIN_PATH, args, out, err, status))
     throw command_not_found_error_msg(LVM_BIN_PATH);
-  if (status != 0)
+  if (status != 0) {
+    if (err.find("Skipping clustered") != err.npos)
+      throw LVMClusterLockingError();
     throw String("lvs failed");
+  }
   vector<String> lines = utils::split(out, "\n");
   for (vector<String>::iterator iter = lines.begin();
        iter != lines.end();
@@ -381,8 +392,11 @@
   args.push_back("-c");
   if (utils::execute(LVM_BIN_PATH, args, out, err, status))
     throw command_not_found_error_msg(LVM_BIN_PATH);
-  if (status != 0)
+  if (status != 0) {
+    if (err.find("Skipping clustered") != err.npos)
+      throw LVMClusterLockingError();
     throw String("lvdisplay failed");
+  }
   vector<String> lines = utils::split(out, "\n");
   for (vector<String>::iterator iter = lines.begin();
        iter != lines.end();
@@ -441,7 +455,7 @@
 {
   if (clustered &&
       !clustered_enabled())
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   vector<String> args;
   args.push_back("vgcreate");
@@ -524,7 +538,7 @@
 {
   if (clustered &&
       !clustered_enabled())
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   vector<String> args;
   args.push_back("vgchange");
@@ -701,6 +715,8 @@
 bool
 cluster_quorate()
 {
+  // called only if cluster locking is enabled
+  
   bool use_magma = true;
   if (access("/sbin/magma_tool", X_OK)) 
     use_magma = false;
@@ -714,11 +730,8 @@
     if (utils::execute("/sbin/magma_tool", args, out, err, status))
       throw command_not_found_error_msg("magma_tool");
     if (status)
-      throw String("cluster tools: magma_tool errored");
-    if (out.find("Quorate") != out.npos)
-      return true;
-    else
-      return false;
+      throw ClusterNotRunningError();
+    return out.find("Quorate") != out.npos;
   } else {
     // use cman_tool
     String cman_tool_path = "/sbin/cman_tool";
@@ -732,7 +745,7 @@
     if (utils::execute(cman_tool_path, args, out, err, status))
       throw command_not_found_error_msg("cman_tool");
     if (status)
-      throw String("cluster tools: cman_tool errored");
+      throw ClusterNotRunningError();
     
     long long quorum = -1;
     long long votes = -1;
@@ -756,7 +769,7 @@
     
     if (quorum <= 0 ||
 	votes < 0)
-      throw String("Unable to retrieve cluster quorum info");
+      throw String("Unable to determine cluster quorum status");
     return votes >= quorum;
   }
 }
@@ -824,8 +837,11 @@
   //    args.push_back(vgname);
   if (utils::execute(LVM_BIN_PATH, args, out, err, status))
     throw command_not_found_error_msg(LVM_BIN_PATH);
-  if (status)
+  if (status) {
+    if (err.find("Skipping clustered") != err.npos)
+      throw LVMClusterLockingError();
     throw String("vgs failed");
+  }
   
   vector<String> lines = utils::split(out, "\n");
   for (vector<String>::iterator iter = lines.begin();
@@ -873,11 +889,14 @@
     throw command_not_found_error_msg(LVM_BIN_PATH);
   
   bool use_pvdisplay = false;
-  if (status)
+  if (status) {
+    if (err.find("Skipping clustered") != err.npos)
+      throw LVMClusterLockingError();
     // wouldn't `pvdisplay -c` fail if `pvs` has already failed?
     // `pvs` fails if it cannot read one hard drive (common in SANs), 
     // while pvdisplay reports without failure
     use_pvdisplay = true;
+  }
   
   if (use_pvdisplay) {
     args.clear();
@@ -885,8 +904,11 @@
     args.push_back("-c");
     if (utils::execute(LVM_BIN_PATH, args, out, err, status))
       throw command_not_found_error_msg(LVM_BIN_PATH);
-    if (status)
+    if (status) {
+      if (err.find("Skipping clustered") != err.npos)
+	throw LVMClusterLockingError();
       throw String("pvs and pvdisplay failed");
+    }
     
     vector<String> lines = utils::split(utils::strip(out), "\n");
     for (vector<String>::iterator iter = lines.begin();
--- conga/ricci/modules/storage/PV.cpp	2006/12/12 13:26:24	1.4.2.1
+++ conga/ricci/modules/storage/PV.cpp	2007/03/05 20:14:00	1.4.2.2
@@ -25,7 +25,7 @@
 #include "LVM.h"
 #include "MapperFactory.h"
 #include "utils.h"
-#include "ClvmdError.h"
+#include "LVMClusterLockingError.h"
 
 
 using namespace std;
@@ -96,7 +96,7 @@
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (!LVM::clustered_enabled() &&
       LVM::vg_clustered(vgname))
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   
   if (vg->sources.size() == 1) {
@@ -124,7 +124,7 @@
   if (!LVM::clustered_enabled() &&
       (LVM::vg_clustered(vgname_old) || 
        LVM::vg_clustered(vgname_new)))
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   
   counting_auto_ptr<Mapper> vg_old = 
@@ -155,7 +155,7 @@
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (!LVM::clustered_enabled() &&
       LVM::vg_clustered(vgname))
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   
   LVM::pvcreate(path);
--- conga/ricci/modules/storage/VG.cpp	2006/12/12 13:26:24	1.8.2.1
+++ conga/ricci/modules/storage/VG.cpp	2007/03/05 20:14:00	1.8.2.2
@@ -28,7 +28,7 @@
 #include "defines.h"
 #include "utils.h"
 #include "MidAir.h"
-#include "ClvmdError.h"
+#include "LVMClusterLockingError.h";
 
 #include "Time.h"
 
@@ -55,8 +55,11 @@
   int status;
   if (utils::execute(LVM_BIN_PATH, args, out, err, status))
     throw command_not_found_error_msg(LVM_BIN_PATH);
-  if (status)
+  if (status) {
+    if (err.find("Skipping clustered") != err.npos)
+      throw LVMClusterLockingError();
     throw String("vgs failed");
+  }
   vector<String> lines = utils::split(out, "\n");
   for (vector<String>::iterator iter = lines.begin();
        iter != lines.end();
@@ -208,7 +211,7 @@
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (_props.get("clustered").get_bool() &&
       !LVM::clustered_enabled())
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   String vgname;
   try {
@@ -253,7 +256,7 @@
   // if VG is marked as clustered, but cluster locking is not available, throw
   if (_props.get("clustered").get_bool() &&
       !LVM::clustered_enabled())
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   String vgname = _props.get("vgname").get_string();
   LVM::vgremove(vgname);
@@ -279,7 +282,7 @@
   
   if (clustered &&
       !LVM::clustered_enabled())
-    throw ClvmdError();
+    throw LVMClusterLockingError();
   
   try {
     utils::clear_cache();




More information about the Cluster-devel mailing list