This is the mail archive of the lvm2-cvs@sourceware.org mailing list for the LVM2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

LVM2 ./WHATS_NEW doc/example.conf lib/config/d ...


CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-09-02 01:18:17

Modified files:
	.              : WHATS_NEW 
	doc            : example.conf 
	lib/config     : defaults.h 
	lib/locking    : locking.c 
	tools          : lvconvert.c lvcreate.c lvrename.c lvresize.c 
	                 pvchange.c pvmove.c pvresize.c reporter.c 
	                 toollib.c vgextend.c vgmerge.c vgreduce.c 
	                 vgrename.c vgsplit.c 

Log message:
	When using local file locking, skip clustered VGs.
	Add fallback_to_clustered_locking and fallback_to_local_locking parameters.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.434&r2=1.435
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.123&r2=1.124
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvrename.c.diff?cvsroot=lvm2&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.74&r2=1.75
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvchange.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvresize.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.86&r2=1.87
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.18&r2=1.19

--- LVM2/WHATS_NEW	2006/08/31 22:21:00	1.434
+++ LVM2/WHATS_NEW	2006/09/02 01:18:16	1.435
@@ -1,5 +1,7 @@
 Version 2.02.10 - 
 ==================================
+  When using local file locking, skip clustered VGs.
+  Add fallback_to_clustered_locking and fallback_to_local_locking parameters.
   lvm.static uses built-in cluster locking instead of external locking.
   Don't attempt to load shared libraries if built statically.
   Change default locking_lib to liblvm2clusterlock.so.
--- LVM2/doc/example.conf	2006/08/31 20:56:33	1.26
+++ LVM2/doc/example.conf	2006/09/02 01:18:17	1.27
@@ -207,11 +207,26 @@
     # Location of proc filesystem
     proc = "/proc"
 
-    # Type of locking to use. Defaults to file-based locking (1).
+    # Type of locking to use. Defaults to local file-based locking (1).
     # Turn locking off by setting to 0 (dangerous: risks metadata corruption
     # if LVM2 commands get run concurrently).
+    # Type 2 uses the external shared library locking_library.
+    # Type 3 uses built-in clustered locking.
     locking_type = 1
 
+    # If using external locking (type 2) and initialisation fails,
+    # with this set to 1 an attempt will be made to use the built-in
+    # clustered locking.
+    # If you are using a customised locking_library you should set this to 0.
+    fallback_to_clustered_locking = 1
+
+    # If an attempt to initialise type 2 or type 3 locking failed, perhaps
+    # because cluster components such as clvmd are not running, with this set
+    # to 1 an attempt will be made to use local file-based locking (type 1).
+    # If this succeeds, only commands against local volume groups will proceed.
+    # Volume Groups marked as clustered will be ignored.
+    fallback_to_local_locking = 1
+
     # Local non-LV directory that holds file-based locks while commands are
     # in progress.  A directory like /tmp that may get wiped on reboot is OK.
     locking_dir = "/var/lock/lvm"
--- LVM2/lib/config/defaults.h	2006/08/31 20:56:33	1.28
+++ LVM2/lib/config/defaults.h	2006/09/02 01:18:17	1.29
@@ -33,6 +33,8 @@
 
 #define DEFAULT_LOCK_DIR "/var/lock/lvm"
 #define DEFAULT_LOCKING_LIB "liblvm2clusterlock.so"
+#define DEFAULT_FALLBACK_TO_LOCAL_LOCKING 1
+#define DEFAULT_FALLBACK_TO_CLUSTERED_LOCKING 1
 
 #define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
 #define DEFAULT_MIRROR_DEV_FAULT_POLICY "remove"
--- LVM2/lib/locking/locking.c	2006/08/31 22:21:00	1.32
+++ LVM2/lib/locking/locking.c	2006/09/02 01:18:17	1.33
@@ -20,6 +20,7 @@
 #include "activate.h"
 #include "toolcontext.h"
 #include "memlock.h"
+#include "defaults.h"
 
 #include <signal.h>
 #include <sys/stat.h>
@@ -147,6 +148,10 @@
 				break;
 			return 1;
 		}
+		if (!find_config_tree_int(cmd, "locking/fallback_to_clustered_locking",
+					  DEFAULT_FALLBACK_TO_CLUSTERED_LOCKING))
+			break;
+		log_very_verbose("Falling back to clustered locking.");
 		/* Fall through */
 #endif
 
@@ -163,6 +168,16 @@
 		return 0;
 	}
 
+	if ((type == 2 || type == 3) &&
+            find_config_tree_int(cmd, "locking/fallback_to_local_locking",
+				 DEFAULT_FALLBACK_TO_LOCAL_LOCKING)) {
+		log_print("WARNING: Falling back to local file-based locking.");
+		log_print("Volume Groups with the clustered attribute will "
+			  "be inaccessible.");
+		if (init_file_locking(&_locking, cmd))
+			return 1;
+	}
+
 	if (!ignorelockingfailure())
 		return 0;
 
--- LVM2/tools/lvconvert.c	2006/08/17 18:23:44	1.19
+++ LVM2/tools/lvconvert.c	2006/09/02 01:18:17	1.20
@@ -565,6 +565,12 @@
 		goto error;
 	}
 
+	if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", lp.vg_name);
+		goto error;
+	}
+
 	if (vg->status & EXPORTED_VG) {
 		log_error("Volume group \"%s\" is exported", lp.vg_name);
 		goto error;
--- LVM2/tools/lvcreate.c	2006/08/25 23:02:33	1.123
+++ LVM2/tools/lvcreate.c	2006/09/02 01:18:17	1.124
@@ -486,6 +486,12 @@
 		return 0;
 	}
 
+	if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", lp->vg_name);
+		return 0;
+	}
+
 	if (vg->status & EXPORTED_VG) {
 		log_error("Volume group \"%s\" is exported", lp->vg_name);
 		return 0;
--- LVM2/tools/lvrename.c	2006/08/25 23:02:33	1.39
+++ LVM2/tools/lvrename.c	2006/09/02 01:18:17	1.40
@@ -109,6 +109,12 @@
 		goto error;
 	}
 
+	if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vg->name);
+		goto error;
+	}
+
 	if (vg->status & EXPORTED_VG) {
 		log_error("Volume group \"%s\" is exported", vg->name);
 		goto error;
--- LVM2/tools/lvresize.c	2006/08/21 12:54:53	1.74
+++ LVM2/tools/lvresize.c	2006/09/02 01:18:17	1.75
@@ -138,6 +138,12 @@
 		return ECMD_FAILED;
 	}
 
+	if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vg->name);
+		return ECMD_FAILED;
+	}
+
 	if (vg->status & EXPORTED_VG) {
 		log_error("Volume group %s is exported", vg->name);
 		return ECMD_FAILED;
--- LVM2/tools/pvchange.c	2006/05/09 21:23:51	1.42
+++ LVM2/tools/pvchange.c	2006/09/02 01:18:17	1.43
@@ -67,6 +67,12 @@
 			return 0;
 		}
 
+		if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+		    !lockingfailed()) {
+			log_error("Skipping clustered volume group %s", vg->name);
+			return 0;
+		}
+
 		if (vg->status & EXPORTED_VG) {
 			unlock_vg(cmd, pv->vg_name);
 			log_error("Volume group \"%s\" is exported", vg->name);
--- LVM2/tools/pvmove.c	2006/08/25 23:02:33	1.31
+++ LVM2/tools/pvmove.c	2006/09/02 01:18:17	1.32
@@ -66,6 +66,12 @@
 		return NULL;
 	}
 
+	if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vgname);
+		return NULL;
+	}
+
 	if (vg->status & EXPORTED_VG) {
 		log_error("Volume group \"%s\" is exported", vgname);
 		unlock_vg(cmd, vgname);
--- LVM2/tools/pvresize.c	2006/04/12 21:23:04	1.2
+++ LVM2/tools/pvresize.c	2006/09/02 01:18:17	1.3
@@ -77,6 +77,13 @@
 			return ECMD_FAILED;
 		}
 
+		if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+		    !lockingfailed()) {
+			unlock_vg(cmd, vg_name);
+			log_error("Skipping clustered volume group %s", vg->name);
+			return ECMD_FAILED;
+		}
+
 		if (vg->status & EXPORTED_VG) {
 			unlock_vg(cmd, vg_name);
 			log_error("Volume group \"%s\" is exported", vg->name);
--- LVM2/tools/reporter.c	2006/05/16 16:48:31	1.15
+++ LVM2/tools/reporter.c	2006/09/02 01:18:17	1.16
@@ -68,13 +68,20 @@
 
 	if (!(vg = vg_read(cmd, pv->vg_name, NULL, &consistent))) {
 		log_error("Can't read %s: skipping", pv->vg_name);
-		unlock_vg(cmd, pv->vg_name);
-		return ECMD_FAILED;
+		goto out;
+	}
+
+	if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vg->name);
+		ret = ECMD_FAILED;
+		goto out;
 	}
 
 	if (!report_object(handle, vg, NULL, pv, NULL, pvseg))
 		ret = ECMD_FAILED;
 
+out:
 	unlock_vg(cmd, pv->vg_name);
 	return ret;
 }
@@ -109,14 +116,22 @@
 
 		if (!(vg = vg_read(cmd, pv->vg_name, (char *)&pv->vgid, &consistent))) {
 			log_error("Can't read %s: skipping", pv->vg_name);
-			unlock_vg(cmd, pv->vg_name);
-			return ECMD_FAILED;
+			goto out;
+		}
+
+		if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+		    !lockingfailed()) {
+			log_error("Skipping clustered volume group %s",
+				  vg->name);
+			ret = ECMD_FAILED;
+			goto out;
 		}
 	}
 
 	if (!report_object(handle, vg, NULL, pv, NULL, NULL))
 		ret = ECMD_FAILED;
 
+out:
 	if (pv->vg_name)
 		unlock_vg(cmd, pv->vg_name);
 
--- LVM2/tools/toollib.c	2006/08/25 23:02:33	1.86
+++ LVM2/tools/toollib.c	2006/09/02 01:18:17	1.87
@@ -329,9 +329,20 @@
 			if (!vg)
 				log_error("Volume group \"%s\" "
 					  "not found", vgname);
-			else
+			else {
+				if ((vg->status & CLUSTERED) &&
+			    	    !locking_is_clustered() &&
+				    !lockingfailed()) {
+					log_error("Skipping clustered volume "
+						  "group %s", vgname);
+					if (ret_max < ECMD_FAILED)
+						ret_max = ECMD_FAILED;
+					continue;
+				}
 				log_error("Volume group \"%s\" "
 					  "inconsistent", vgname);
+			}
+
 			if (!vg || !(vg = recover_vg(cmd, vgname, lock_type))) {
 				if (ret_max < ECMD_FAILED)
 					ret_max = ECMD_FAILED;
@@ -339,6 +350,15 @@
 			}
 		}
 
+		if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+		    !lockingfailed()) {
+			unlock_vg(cmd, vgname);
+			log_error("Skipping clustered volume group %s", vgname);
+			if (ret_max < ECMD_FAILED)
+				ret_max = ECMD_FAILED;
+			continue;
+		}
+
 		tags_arg = &tags;
 		list_init(&lvnames);	/* LVs to be processed in this VG */
 		list_iterate_items(sll, &arg_lvnames) {
@@ -438,6 +458,13 @@
 		return ECMD_FAILED;
 	}
 
+	if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vg_name);
+		unlock_vg(cmd, vg_name);
+		return ECMD_FAILED;
+	}
+
 	if (!list_empty(tags)) {
 		/* Only process if a tag matches or it's on arg_vgnames */
 		if (!str_list_match_item(arg_vgnames, vg_name) &&
@@ -680,6 +707,15 @@
 				}
 				if (!consistent)
 					continue;
+
+				if ((vg->status & CLUSTERED) &&
+				    !locking_is_clustered() &&
+				    !lockingfailed()) {
+					log_error("Skipping clustered volume "
+						  "group %s", sll->str);
+					continue;
+				}
+
 				ret = process_each_pv_in_vg(cmd, vg, &tags,
 							    handle,
 							    process_single);
@@ -1045,6 +1081,10 @@
 {
 	int consistent = 1;
 
+	/* Don't attempt automatic recovery without proper locking */
+	if (lockingfailed())
+		return NULL;
+
 	lock_type &= ~LCK_TYPE_MASK;
 	lock_type |= LCK_WRITE;
 
--- LVM2/tools/vgextend.c	2006/08/25 23:02:33	1.26
+++ LVM2/tools/vgextend.c	2006/09/02 01:18:17	1.27
@@ -53,6 +53,12 @@
 		goto error;
 	}
 
+	if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vg->name);
+		goto error;
+	}
+
 	if (vg->status & EXPORTED_VG) {
 		log_error("Volume group \"%s\" is exported", vg->name);
 		goto error;
--- LVM2/tools/vgmerge.c	2006/08/25 23:02:33	1.33
+++ LVM2/tools/vgmerge.c	2006/09/02 01:18:17	1.34
@@ -41,6 +41,13 @@
 		return ECMD_FAILED;
 	}
 
+	if ((vg_to->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vg_name_to);
+		unlock_vg(cmd, vg_name_to);
+		return ECMD_FAILED;
+	}
+
 	if (vg_to->status & EXPORTED_VG) {
 		log_error("Volume group \"%s\" is exported", vg_to->name);
 		unlock_vg(cmd, vg_name_to);
@@ -66,6 +73,12 @@
 		goto error;
 	}
 
+        if ((vg_from->status & CLUSTERED) && !locking_is_clustered() &&
+            !lockingfailed()) {
+                log_error("Skipping clustered volume group %s", vg_name_from);
+                goto error;
+        }
+
 	if (vg_from->status & EXPORTED_VG) {
 		log_error("Volume group \"%s\" is exported", vg_from->name);
 		goto error;
--- LVM2/tools/vgreduce.c	2006/08/25 23:02:33	1.51
+++ LVM2/tools/vgreduce.c	2006/09/02 01:18:17	1.52
@@ -476,6 +476,13 @@
 		return ECMD_FAILED;
 	}
 
+	if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vg->name);
+		unlock_vg(cmd, vg_name);
+		return ECMD_FAILED;
+	}
+
 	if (arg_count(cmd, removemissing_ARG)) {
 		if (vg && consistent) {
 			log_error("Volume group \"%s\" is already consistent",
@@ -491,6 +498,13 @@
 			unlock_vg(cmd, vg_name);
 			return ECMD_FAILED;
 		}
+		if ((vg->status & CLUSTERED) && !locking_is_clustered() &&
+		    !lockingfailed()) {
+			log_error("Skipping clustered volume group %s",
+				  vg->name);
+			unlock_vg(cmd, vg_name);
+			return ECMD_FAILED;
+		}
 		if (!archive(vg)) {
 			init_partial(0);
 			unlock_vg(cmd, vg_name);
--- LVM2/tools/vgrename.c	2006/08/25 23:02:33	1.40
+++ LVM2/tools/vgrename.c	2006/09/02 01:18:17	1.41
@@ -102,6 +102,13 @@
 		return ECMD_FAILED;
 	}
 
+	if ((vg_old->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vg_old->name);
+		unlock_vg(cmd, vg_name_old);
+		return ECMD_FAILED;
+	}
+
 	if (vg_old->status & EXPORTED_VG)
 		log_info("Volume group \"%s\" is exported", vg_old->name);
 
--- LVM2/tools/vgsplit.c	2006/05/09 21:23:51	1.18
+++ LVM2/tools/vgsplit.c	2006/09/02 01:18:17	1.19
@@ -196,6 +196,13 @@
 		return ECMD_FAILED;
 	}
 
+	if ((vg_from->status & CLUSTERED) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vg_from->name);
+		unlock_vg(cmd, vg_name_from);
+		return ECMD_FAILED;
+	}
+
 	if (vg_from->status & EXPORTED_VG) {
 		log_error("Volume group \"%s\" is exported", vg_from->name);
 		unlock_vg(cmd, vg_name_from);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]