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

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


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic at sourceware.org	2007-03-05 20:45:18

Modified files:
	luci/site/luci/Extensions: StorageReport.py 
	ricci/docs     : storage_api.html 
	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&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/storage_api.html.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/README.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ClusterNotRunningError.h.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVMClusterLockingError.h.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ClusterNotQuorateError.h.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ClvmdError.h.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LV.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.cpp.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PV.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.9&r2=1.10

--- conga/luci/site/luci/Extensions/StorageReport.py	2006/12/06 22:34:09	1.22
+++ conga/luci/site/luci/Extensions/StorageReport.py	2007/03/05 20:45:17	1.23
@@ -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/docs/storage_api.html	2006/12/12 13:11:50	1.6
+++ conga/ricci/docs/storage_api.html	2007/03/05 20:45:17	1.7
@@ -78,6 +78,13 @@
 	operations to hang until quorum is regained. User should make
 	cluster quorate before continuing. 
 	</P>
+	<LI><P>6 – cluster locking not enabled<BR>LVM is not configured to use cluster
+	locking mechanism, but some volumes are marked clustered. 
+	User should enable cluster locking. 
+	</P>
+	<LI><P>7 – cluster not running on node<BR>LVM is configured to use cluster
+	locking mechanism, but cluster is not running on local node. 
+	</P>
 </UL>
 <P><BR><BR>
 </P>
--- conga/ricci/test_suite/README	2006/10/27 19:30:30	1.1
+++ conga/ricci/test_suite/README	2007/03/05 20:45:17	1.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/ClusterNotRunningError.h	2007/03/05 20:13:59	1.1
+++ conga/ricci/modules/storage/ClusterNotRunningError.h	2007/03/05 20:45:17	1.2
@@ -0,0 +1,41 @@
+/*
+  Copyright Red Hat, Inc. 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
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  This program is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; see the file COPYING.  If not, write to the
+  Free Software Foundation, Inc.,  675 Mass Ave, Cambridge, 
+  MA 02139, USA.
+*/
+/*
+ * Author: Stanko Kupcevic <kupcevic at redhat.com>
+ */
+
+
+#ifndef ClusterNotRunningError_h
+#define ClusterNotRunningError_h
+
+#include "Except.h"
+
+
+class ClusterNotRunningError : public Except
+{
+ public:
+  ClusterNotRunningError()
+    : Except(7, String("Cluster infrastructure is not active")) {}
+  virtual ~ClusterNotRunningError()
+    {}
+  
+};
+
+
+#endif  // ClusterNotRunningError_h
--- conga/ricci/modules/storage/LVMClusterLockingError.h	2007/03/05 20:14:00	1.1
+++ conga/ricci/modules/storage/LVMClusterLockingError.h	2007/03/05 20:45:17	1.2
@@ -0,0 +1,41 @@
+/*
+  Copyright Red Hat, Inc. 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
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  This program is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; see the file COPYING.  If not, write to the
+  Free Software Foundation, Inc.,  675 Mass Ave, Cambridge, 
+  MA 02139, USA.
+*/
+/*
+ * Author: Stanko Kupcevic <kupcevic at redhat.com>
+ */
+
+
+#ifndef LVMClusterLockingError_h
+#define LVMClusterLockingError_h
+
+#include "Except.h"
+
+
+class LVMClusterLockingError : public Except
+{
+ public:
+  LVMClusterLockingError()
+    : Except(6, String("LVM cluster locking is not enabled")) {}
+  virtual ~LVMClusterLockingError()
+    {}
+  
+};
+
+
+#endif  // LVMClusterLockingError_h
--- conga/ricci/modules/storage/ClusterNotQuorateError.h	2006/08/10 22:53:09	1.2
+++ conga/ricci/modules/storage/ClusterNotQuorateError.h	2007/03/05 20:45:17	1.3
@@ -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:45:17	1.3
@@ -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:11:51	1.7
+++ conga/ricci/modules/storage/LV.cpp	2007/03/05 20:45:17	1.8
@@ -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/16 17:05:27	1.11
+++ conga/ricci/modules/storage/LVM.cpp	2007/03/05 20:45:17	1.12
@@ -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:11:51	1.5
+++ conga/ricci/modules/storage/PV.cpp	2007/03/05 20:45:17	1.6
@@ -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:11:51	1.9
+++ conga/ricci/modules/storage/VG.cpp	2007/03/05 20:45:17	1.10
@@ -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