public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2012-03-01 21:21 zkabelac
  0 siblings, 0 replies; 18+ messages in thread
From: zkabelac @ 2012-03-01 21:21 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-03-01 21:21:55

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Check for alloc error
	
	Simplify segtype_str usage and check for NULL segtype.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2330&r2=1.2331
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.257&r2=1.258

--- LVM2/WHATS_NEW	2012/03/01 10:39:21	1.2330
+++ LVM2/WHATS_NEW	2012/03/01 21:21:54	1.2331
@@ -1,5 +1,6 @@
 Version 2.02.94 - 
 ====================================
+  Check for alloc fail from get_segtype_from_string() in _lvcreate_params().
   Add _rimage as reserved suffix to lvm.8 man page.
   Improve error logging from mpath filter.
   Check for allocation failure in hold_lock() in clvmd.
--- LVM2/tools/lvcreate.c	2012/02/28 14:24:58	1.257
+++ LVM2/tools/lvcreate.c	2012/03/01 21:21:55	1.258
@@ -652,10 +652,13 @@
 	else
 		segtype_str = "striped";
 
-	lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, segtype_str));
+	segtype_str = arg_str_value(cmd, type_ARG, segtype_str);
+
+	if (!(lp->segtype = get_segtype_from_string(cmd, segtype_str)))
+		return_0;
 
 	if (seg_unknown(lp)) {
-		log_error("Unable to create LV with unknown segment type %s.", arg_str_value(cmd, type_ARG, segtype_str));
+		log_error("Unable to create LV with unknown segment type %s.", segtype_str);
 		return 0;
 	}
 


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2012-04-11 12:33 zkabelac
  0 siblings, 0 replies; 18+ messages in thread
From: zkabelac @ 2012-04-11 12:33 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-04-11 12:33:35

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Support rounding downward for lvcreate and %
	
	If specifying size with % and we are reaching number
	of free extents - round downward with stripes.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2378&r2=1.2379
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.263&r2=1.264

--- LVM2/WHATS_NEW	2012/04/11 09:12:02	1.2378
+++ LVM2/WHATS_NEW	2012/04/11 12:33:34	1.2379
@@ -1,5 +1,6 @@
 Version 2.02.96 - 
 ================================
+  For lvcreate with %FREE support rounding downward strip alignment.
   Change message severity to log_very_verbose for missing dev info in udev db.
   Fix problems when specifying PVs during RAID down-converts.
   Fix ability to handle failures in mirrored log (regression intro 2.02.89).
--- LVM2/tools/lvcreate.c	2012/03/06 09:22:03	1.263
+++ LVM2/tools/lvcreate.c	2012/04/11 12:33:35	1.264
@@ -236,6 +236,8 @@
 	uint32_t pv_extent_count;
 	struct logical_volume *origin = NULL;
 	int changed = 0;
+	uint32_t size_rest;
+	uint32_t stripesize_extents;
 
 	if (lcp->size &&
 	    !(lp->extents = extents_from_size(vg->cmd, lcp->size,
@@ -294,6 +296,18 @@
 			break;
 	}
 
+	if (!(stripesize_extents = lp->stripe_size / vg->extent_size))
+		stripesize_extents = 1;
+
+	if ((lcp->percent != PERCENT_NONE) && lp->stripes &&
+	    (size_rest = lp->extents % (lp->stripes * stripesize_extents)) &&
+	    (vg->free_count < lp->extents - size_rest + (lp->stripes * stripesize_extents))) {
+		log_print("Rounding size (%d extents) down to stripe boundary "
+			  "size (%d extents)", lp->extents,
+			  lp->extents - size_rest);
+		lp->extents = lp->extents - size_rest;
+	}
+
 	if (lp->create_thin_pool) {
 		if (!arg_count(vg->cmd, poolmetadatasize_ARG)) {
 			/* Defaults to nr_pool_blocks * 64b */


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2012-03-02 17:25 zkabelac
  0 siblings, 0 replies; 18+ messages in thread
From: zkabelac @ 2012-03-02 17:25 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-03-02 17:25:21

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Fix estimation of pool metadata device size
	
	If no size was give the later added minimal size check efectively
	disable this code. Also the argument for size now must be kept
	in sector_size, so adding division by SECTOR_SIZE (moved into
	a const expression)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2332&r2=1.2333
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.258&r2=1.259

--- LVM2/WHATS_NEW	2012/03/01 21:49:32	1.2332
+++ LVM2/WHATS_NEW	2012/03/02 17:25:21	1.2333
@@ -1,5 +1,6 @@
 Version 2.02.94 - 
 ====================================
+  Fix automatic estimation of metadata device size for thin pool.
   Test for alloc fail from _alloc_pv_segment() in _extend_pv().
   Check for alloc fail from get_segtype_from_string() in _lvcreate_params().
   Add _rimage as reserved suffix to lvm.8 man page.
--- LVM2/tools/lvcreate.c	2012/03/01 21:21:55	1.258
+++ LVM2/tools/lvcreate.c	2012/03/02 17:25:21	1.259
@@ -293,10 +293,10 @@
 			break;
 	}
 
-	if (lp->create_thin_pool && !lp->poolmetadatasize)
+	if (lp->create_thin_pool && !arg_count(vg->cmd, poolmetadatasize_ARG))
 		/* Defaults to nr_pool_blocks * 64b */
 		lp->poolmetadatasize =  (uint64_t) lp->extents * vg->extent_size /
-			(uint64_t) lp->chunk_size * UINT64_C(64);
+			(uint64_t) (lp->chunk_size * (SECTOR_SIZE / UINT64_C(64)));
 
 	if (lp->poolmetadatasize &&
 	    !(lp->poolmetadataextents = extents_from_size(vg->cmd, lp->poolmetadatasize,


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2012-02-27 10:00 zkabelac
  0 siblings, 0 replies; 18+ messages in thread
From: zkabelac @ 2012-02-27 10:00 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-02-27 10:00:24

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Always check result of _set_vg_name()

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2311&r2=1.2312
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.255&r2=1.256

--- LVM2/WHATS_NEW	2012/02/27 09:58:18	1.2311
+++ LVM2/WHATS_NEW	2012/02/27 10:00:23	1.2312
@@ -1,6 +1,7 @@
 Version 2.02.94 - 
-====================================
-  Drop unused call to uname() during clvmd initia.lization.
+====================================                       
+  Always check result of _set_vg_name() in lvcreate.
+  Drop unused call to uname() during clvmd initialization.
   Test allocation result in sysfs filter creation.
   Limit sscanf parameters with buffer size in clvmd get_initial_state().
   Use const lv pointer for lv_is_active...() functions. 
--- LVM2/tools/lvcreate.c	2012/02/23 17:36:36	1.255
+++ LVM2/tools/lvcreate.c	2012/02/27 10:00:23	1.256
@@ -93,8 +93,9 @@
 				lp->origin = ptr + 1;
 		}
 
-		if (!lp->vg_name)
-			_set_vg_name(lp, extract_vgname(cmd, NULL));
+		if (!lp->vg_name &&
+		    !_set_vg_name(lp, extract_vgname(cmd, NULL)))
+			return_0;
 
 		if (!lp->vg_name) {
 			log_error("The origin name should include the "
@@ -115,8 +116,9 @@
 			if (!_set_vg_name(lp, extract_vgname(cmd, lp->pool)))
 				return_0;
 
-			if (!lp->vg_name)
-				_set_vg_name(lp, extract_vgname(cmd, NULL));
+			if (!lp->vg_name &&
+			    !_set_vg_name(lp, extract_vgname(cmd, NULL)))
+				return_0;
 
 			if (!lp->vg_name) {
 				log_error("The pool name should include the "


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2011-11-07 11:01 zkabelac
  0 siblings, 0 replies; 18+ messages in thread
From: zkabelac @ 2011-11-07 11:01 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-11-07 11:01:54

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Add missing default LVM_VG_NAME
	
	Add support for exported shell variable LVM_VG_NAME also
	for thins and snapshots.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2178&r2=1.2179
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.245&r2=1.246

--- LVM2/WHATS_NEW	2011/11/04 22:49:53	1.2178
+++ LVM2/WHATS_NEW	2011/11/07 11:01:53	1.2179
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Add missing default $LVM_VG_NAME usage for snapshots.
   Fix extent_count overflow with lvextend.
   Add missing lvrename mirrored log recursion in for_each_sub_lv.
   Improve lv_extend stack reporting.
--- LVM2/tools/lvcreate.c	2011/11/04 22:43:11	1.245
+++ LVM2/tools/lvcreate.c	2011/11/07 11:01:54	1.246
@@ -93,6 +93,9 @@
 				lp->origin = ptr + 1;
 		}
 
+		if (!lp->vg_name)
+			_set_vg_name(lp, extract_vgname(cmd, NULL));
+
 		if (!lp->vg_name) {
 			log_error("The origin name should include the "
 				  "volume group.");
@@ -111,7 +114,10 @@
 			lp->pool = vg_name;
 			if (!_set_vg_name(lp, extract_vgname(cmd, lp->pool)))
 				return_0;
-	
+
+			if (!lp->vg_name)
+				_set_vg_name(lp, extract_vgname(cmd, NULL));
+
 			if (!lp->vg_name) {
 				log_error("The pool name should include the "
 					  "volume group.");


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2011-09-22 15:36 jbrassow
  0 siblings, 0 replies; 18+ messages in thread
From: jbrassow @ 2011-09-22 15:36 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	jbrassow@sourceware.org	2011-09-22 15:36:21

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Disallow the creation of mirrors (mirror or raid1 segtype) with only one leg.
	
	If you specify the segment type (e.g. --type mirror) and the mirrors argument
	as zero, it would result in a mirrored LV with only one image.  While the device
	may be valid in theory, it should not be allowed in practice.  It also makes it
	difficult on the conversion tools, since they react badly to single-image
	mirrors.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2129&r2=1.2130
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.241&r2=1.242

--- LVM2/WHATS_NEW	2011/09/22 09:47:34	1.2129
+++ LVM2/WHATS_NEW	2011/09/22 15:36:21	1.2130
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Disallow the creation of mirrors (mirror or raid1 segtype) with only one leg.
   Cleanup restart clvmd code (no memory allocation, debug print passed args).
   Add all exclusive locks to clvmd restart option args.
   Always send the whole clvmd packet header in refresh commands.
--- LVM2/tools/lvcreate.c	2011/09/15 15:26:40	1.241
+++ LVM2/tools/lvcreate.c	2011/09/22 15:36:21	1.242
@@ -618,8 +618,13 @@
 
 	if (arg_count(cmd, mirrors_ARG)) {
 		lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0) + 1;
-		if (lp->mirrors == 1)
+		if (lp->mirrors == 1) {
+			if (segtype_is_mirrored(lp->segtype)) {
+				log_error("Image count for segtype \"%s\" cannot be 0.", lp->segtype->name);
+				return 0;
+			}
 			log_print("Redundant mirrors argument: default is 0");
+		}
 		if (arg_sign_value(cmd, mirrors_ARG, 0) == SIGN_MINUS) {
 			log_error("Mirrors argument may not be negative");
 			return 0;


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2008-09-24 16:32 mbroz
  0 siblings, 0 replies; 18+ messages in thread
From: mbroz @ 2008-09-24 16:32 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2008-09-24 16:32:51

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Fix validation of --minor and --major in lvcreate to require -My always.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.964&r2=1.965
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.176&r2=1.177

--- LVM2/WHATS_NEW	2008/09/19 18:31:20	1.964
+++ LVM2/WHATS_NEW	2008/09/24 16:32:51	1.965
@@ -1,5 +1,6 @@
 Version 2.02.41 -
 =====================================
+  Fix validation of --minor and --major in lvcreate to require -My always.
   Fix release: clvmd build, vgreduce consolidate & tests, /dev/ioerror warning.
 
 Version 2.02.40 - 19th September 2008
--- LVM2/tools/lvcreate.c	2008/07/17 15:19:42	1.176
+++ LVM2/tools/lvcreate.c	2008/09/24 16:32:51	1.177
@@ -500,6 +500,9 @@
 				return 0;
 			}
 		}
+	} else if (arg_count(cmd, minor_ARG) || arg_count(cmd, major_ARG)) {
+		log_error("--major and --minor require -My");
+		return 0;
 	}
 
 	lp->pv_count = argc;


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2008-06-05 13:38 agk
  0 siblings, 0 replies; 18+ messages in thread
From: agk @ 2008-06-05 13:38 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-06-05 13:38:31

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Add missing deactivation after activation failure in lvcreate -Zy.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.882&r2=1.883
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.174&r2=1.175

--- LVM2/WHATS_NEW	2008/06/05 13:06:39	1.882
+++ LVM2/WHATS_NEW	2008/06/05 13:38:30	1.883
@@ -9,6 +9,7 @@
 
 Version 2.02.37 - 
 =================================
+  Add missing deactivation after activation failure in lvcreate -Zy.
   When activating, if precommitted metadata is still cached, assume it's live.
   When removing LV symlinks, skip any where the VG name is not determined.
   Drop metadata cache if update fails in vg_revert or vg_commit.
--- LVM2/tools/lvcreate.c	2008/04/10 17:09:32	1.174
+++ LVM2/tools/lvcreate.c	2008/06/05 13:38:30	1.175
@@ -801,7 +801,7 @@
 		if (lp->zero) {
 			log_error("Aborting. Failed to activate new LV to wipe "
 				  "the start of it.");
-			goto revert_new_lv;
+			goto deactivate_and_revert_new_lv;
 		}
 		log_error("Failed to activate new LV.");
 		return 0;


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2008-01-17 15:53 agk
  0 siblings, 0 replies; 18+ messages in thread
From: agk @ 2008-01-17 15:53 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-01-17 15:53:01

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	fix default stripesize

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.765&r2=1.766
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.167&r2=1.168

--- LVM2/WHATS_NEW	2008/01/17 15:02:59	1.765
+++ LVM2/WHATS_NEW	2008/01/17 15:53:01	1.766
@@ -1,5 +1,6 @@
 Version 2.02.30 - 17th January 2008
 ===================================
+  Reinstate VG extent size and stripe size defaults (halved). (2.02.29)
   Add lists of stacked LV segments using each LV to the internal metadata.
   Change vgsplit -l (for unimplemented --list) into --maxlogicalvolumes.
   Fix process_all_pvs to detect non-orphans with no MDAs correctly.
--- LVM2/tools/lvcreate.c	2008/01/16 15:26:40	1.167
+++ LVM2/tools/lvcreate.c	2008/01/17 15:53:01	1.168
@@ -195,7 +195,7 @@
 	if (lp->stripes > 1 && !lp->stripe_size) {
 		lp->stripe_size = find_config_tree_int(cmd,
 						  "metadata/stripesize",
-						  DEFAULT_STRIPESIZE);
+						  DEFAULT_STRIPESIZE) * 2;
 		log_print("Using default stripesize %s",
 			  display_size(cmd, (uint64_t) lp->stripe_size));
 	}


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2008-01-16 15:25 agk
  0 siblings, 0 replies; 18+ messages in thread
From: agk @ 2008-01-16 15:25 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-01-16 15:25:10

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	reword

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.761&r2=1.762
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.165&r2=1.166

--- LVM2/WHATS_NEW	2008/01/16 15:24:25	1.761
+++ LVM2/WHATS_NEW	2008/01/16 15:25:10	1.762
@@ -1,6 +1,6 @@
 Version 2.02.30 -
 ===================================
-  Don't use block_on_error with mirror targets above version 1.12.
+  Don't use block_on_error with mirror targets version 1.12 and above.
   Update vgsplit to include vgcreate-style options when new VG is destination.
   Update vgsplit to accept existing VG as destination.
   lvconvert waits for completion of initial sync by default.
--- LVM2/tools/lvcreate.c	2007/12/22 02:13:00	1.165
+++ LVM2/tools/lvcreate.c	2008/01/16 15:25:10	1.166
@@ -705,11 +705,11 @@
 		return 0;
 	}
 
-	if (lp->mirrors > 1 && !activation()) {
-		log_error("Can't create mirror without using "
-			  "device-mapper kernel driver.");
-		return 0;
-	}
+//	if (lp->mirrors > 1 && !activation()) {
+		//log_error("Can't create mirror without using "
+			  //"device-mapper kernel driver.");
+		//return 0;
+	//}
 
 	/* The snapshot segment gets created later */
 	if (lp->snapshot &&


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2007-11-12 13:34 agk
  0 siblings, 0 replies; 18+ messages in thread
From: agk @ 2007-11-12 13:34 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2007-11-12 13:34:14

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Attempt to remove incomplete LVs with lvcreate zeroing/activation problems.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.731&r2=1.732
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.154&r2=1.155

--- LVM2/WHATS_NEW	2007/11/09 16:51:53	1.731
+++ LVM2/WHATS_NEW	2007/11/12 13:34:14	1.732
@@ -1,5 +1,6 @@
 Version 2.02.29 -
 ==================================
+  Attempt to remove incomplete LVs with lvcreate zeroing/activation problems.
   Add activation/readahead configuration option and FMT_RESTRICTED_READAHEAD.
   Extend readahead arg to accept "auto" and "none".
   Add lv_read_ahead and lv_kernel_read_ahead fields to reports.
--- LVM2/tools/lvcreate.c	2007/11/09 16:51:54	1.154
+++ LVM2/tools/lvcreate.c	2007/11/12 13:34:14	1.155
@@ -249,7 +249,7 @@
  * Generic mirror parameter checks.
  * FIXME: Should eventually be moved into lvm library.
  */
-static int _validate_mirror_params(const struct cmd_context *cmd,
+static int _validate_mirror_params(const struct cmd_context *cmd __attribute((unused)),
 				   const struct lvcreate_params *lp)
 {
 	int pagesize = lvm_getpagesize();
@@ -638,6 +638,12 @@
 		lp->extents = lp->extents - size_rest + lp->stripes;
 	}
 
+	if (lp->zero && !activation) {
+		log_error("Can't wipe start of new LV without using "
+			  "device-mapper kernel driver");
+		return 0;
+	}
+
 	if (lp->snapshot) {
 		if (!activation()) {
 			log_error("Can't create snapshot without using "
@@ -811,45 +817,41 @@
 		alloc_destroy(ah);
 		ah = NULL;
 	} else if (!lv_extend(lv, lp->segtype, lp->stripes, lp->stripe_size,
-		       lp->mirrors, lp->extents, NULL, 0u, 0u, pvh, lp->alloc)) {
-		stack;
-		return 0;
-	}
+		       lp->mirrors, lp->extents, NULL, 0u, 0u, pvh, lp->alloc))
+		return_0;
 
 	/* store vg on disk(s) */
-	if (!vg_write(vg)) {
-		stack;
-		return 0;
-	}
+	if (!vg_write(vg))
+		return_0;
 
 	backup(vg);
 
-	if (!vg_commit(vg)) {
-		stack;
-		return 0;
-	}
+	if (!vg_commit(vg))
+		return_0;
 
 	if (lp->snapshot) {
 		if (!activate_lv_excl(cmd, lv)) {
 			log_error("Aborting. Failed to activate snapshot "
-				  "exception store. Remove new LV and retry.");
-			return 0;
+				  "exception store.");
+			goto revert_new_lv;
 		}
 	} else if (!activate_lv(cmd, lv)) {
+		if (lp->zero) {
+			log_error("Aborting. Failed to activate new LV to wipe "
+				  "the start of it.");
+			goto revert_new_lv;
+		}
 		log_error("Failed to activate new LV.");
 		return 0;
 	}
 
-	if ((lp->zero || lp->snapshot) && activation()) {
-		if (!set_lv(cmd, lv, UINT64_C(0), 0) && lp->snapshot) {
-			/* FIXME Remove the failed lv we just added */
-			log_error("Aborting. Failed to wipe snapshot "
-				  "exception store. Remove new LV and retry.");
-			return 0;
-		}
-	} else {
+	if (!lp->zero && !lp->snapshot)
 		log_error("WARNING: \"%s\" not zeroed", lv->name);
-		/* FIXME Remove the failed lv we just added */
+	else if (!set_lv(cmd, lv, UINT64_C(0), 0)) {
+		log_error("Aborting. Failed to wipe %s.",
+			  lp->snapshot ? "snapshot exception store" :
+					 "start of new LV");
+		goto deactivate_and_revert_new_lv;
 	}
 
 	if (lp->snapshot) {
@@ -860,7 +862,7 @@
 		/* COW area must be deactivated if origin is not active */
 		if (!origin_active && !deactivate_lv(cmd, lv)) {
 			log_error("Aborting. Couldn't deactivate snapshot "
-				  "COW area.");
+				  "COW area. Manual intervention required.");
 			return 0;
 		}
 
@@ -868,13 +870,13 @@
 
 		if (!vg_add_snapshot(NULL, org, lv, NULL,
 				     org->le_count, lp->chunk_size)) {
-			log_err("Couldn't create snapshot.");
+			log_error("Couldn't create snapshot.");
 			return 0;
 		}
 
 		/* store vg on disk(s) */
 		if (!vg_write(vg))
-			return 0;
+			return_0;
 
 		if (!suspend_lv(cmd, org)) {
 			log_error("Failed to suspend origin %s", org->name);
@@ -883,7 +885,7 @@
 		}
 
 		if (!vg_commit(vg))
-			return 0;
+			return_0;
 
 		if (!resume_lv(cmd, org)) {
 			log_error("Problem reactivating origin %s", org->name);
@@ -906,6 +908,20 @@
 	if (ah)
 		alloc_destroy(ah);
 	return 0;
+
+deactivate_and_revert_new_lv:
+	if (!deactivate_lv(cmd, lv)) {
+		log_error("Unable to deactivate failed new LV. "
+			  "Manual intervention required.");
+		return 0;
+	}
+
+revert_new_lv:
+	/* FIXME Better to revert to backup of metadata? */
+	if (!lv_remove(lv) || !vg_write(vg) || backup(vg), !vg_commit(vg))
+		log_error("Manual intervention may be required to remove "
+			  "abandoned LV(s) before retrying.");
+	return 0;
 }
 
 int lvcreate(struct cmd_context *cmd, int argc, char **argv)


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2007-09-24 13:25 wysochanski
  0 siblings, 0 replies; 18+ messages in thread
From: wysochanski @ 2007-09-24 13:25 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2007-09-24 13:25:31

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Refactor lvcreate stripe parameter validation.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.713&r2=1.714
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.146&r2=1.147

--- LVM2/WHATS_NEW	2007/09/21 18:06:56	1.713
+++ LVM2/WHATS_NEW	2007/09/24 13:25:31	1.714
@@ -1,5 +1,6 @@
 Version 2.02.29 -
 ==================================
+  Refactor lvcreate stripe and mirror parameter validation.
   All tools: print --help output to stdout, not stderr.
   After a diagnostic, suggest --help, rather than printing all --help output.
   Add %PVS extents option to lvresize, lvextend, and lvcreate.
--- LVM2/tools/lvcreate.c	2007/09/20 21:39:08	1.146
+++ LVM2/tools/lvcreate.c	2007/09/24 13:25:31	1.147
@@ -174,28 +174,13 @@
 	return 1;
 }
 
-/* The stripe size is limited by the size of a uint32_t, but since the
- * value given by the user is doubled, and the final result must be a
- * power of 2, we must divide UINT_MAX by four and add 1 (to round it
- * up to the power of 2) */
-static int _read_stripe_params(struct lvcreate_params *lp,
-			       struct cmd_context *cmd,
-			       int *pargc __attribute((unused)))
+/*
+ * Generic stripe parameter checks.
+ * FIXME: Should eventually be moved into lvm library.
+ */
+static int _validate_stripe_params(struct cmd_context *cmd,
+				   struct lvcreate_params *lp)
 {
-	if (arg_count(cmd, stripesize_ARG)) {
-		if (arg_sign_value(cmd, stripesize_ARG, 0) == SIGN_MINUS) {
-			log_error("Negative stripesize is invalid");
-			return 0;
-		}
-		/* Check to make sure we won't overflow lp->stripe_size */
-		if(arg_uint_value(cmd, stripesize_ARG, 0) > STRIPE_SIZE_LIMIT) {
-			log_error("Stripe size cannot be larger than %s",
-				  display_size(cmd, (uint64_t) STRIPE_SIZE_LIMIT));
-			return 0;
-		}
-		lp->stripe_size = 2 * arg_uint_value(cmd, stripesize_ARG, 0);
-	}
-
 	if (lp->stripes == 1 && lp->stripe_size) {
 		log_print("Ignoring stripesize argument with single stripe");
 		lp->stripe_size = 0;
@@ -226,6 +211,35 @@
 	return 1;
 }
 
+/* The stripe size is limited by the size of a uint32_t, but since the
+ * value given by the user is doubled, and the final result must be a
+ * power of 2, we must divide UINT_MAX by four and add 1 (to round it
+ * up to the power of 2) */
+static int _read_stripe_params(struct lvcreate_params *lp,
+			       struct cmd_context *cmd,
+			       int *pargc __attribute((unused)))
+{
+	if (arg_count(cmd, stripesize_ARG)) {
+		if (arg_sign_value(cmd, stripesize_ARG, 0) == SIGN_MINUS) {
+			log_error("Negative stripesize is invalid");
+			return 0;
+		}
+		/* Check to make sure we won't overflow lp->stripe_size */
+		if(arg_uint_value(cmd, stripesize_ARG, 0) > STRIPE_SIZE_LIMIT) {
+			log_error("Stripe size cannot be larger than %s",
+				  display_size(cmd, (uint64_t) STRIPE_SIZE_LIMIT));
+			return 0;
+		}
+		lp->stripe_size = 2 * arg_uint_value(cmd, stripesize_ARG, 0);
+	}
+
+
+	if (!_validate_stripe_params(cmd, lp))
+		return 0;
+
+	return 1;
+}
+
 static int _read_mirror_params(struct lvcreate_params *lp,
 			       struct cmd_context *cmd,
 			       int *pargc __attribute((unused)))


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2007-09-17 17:18 agk
  0 siblings, 0 replies; 18+ messages in thread
From: agk @ 2007-09-17 17:18 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2007-09-17 17:18:37

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Remove no-longer-correct restrictions on PV arg count with stripes/mirrors.
	[E.g. They fail if tags or --alloc anywhere used.]

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.708&r2=1.709
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.144&r2=1.145

--- LVM2/WHATS_NEW	2007/09/17 17:06:31	1.708
+++ LVM2/WHATS_NEW	2007/09/17 17:18:37	1.709
@@ -1,5 +1,6 @@
 Version 2.02.29 -
 ==================================
+  Remove no-longer-correct restrictions on PV arg count with stripes/mirrors.
   Fix strdup memory leak in str_list_dup().
   Link with -lpthread when static SELinux libraries require that.
   Detect command line PE values that exceed their 32-bit range.
--- LVM2/tools/lvcreate.c	2007/08/30 19:34:19	1.144
+++ LVM2/tools/lvcreate.c	2007/09/17 17:18:37	1.145
@@ -180,10 +180,8 @@
  * up to the power of 2) */
 static int _read_stripe_params(struct lvcreate_params *lp,
 			       struct cmd_context *cmd,
-			       int *pargc)
+			       int *pargc __attribute((unused)))
 {
-	int argc = *pargc;
-
 	if (arg_count(cmd, stripesize_ARG)) {
 		if (arg_sign_value(cmd, stripesize_ARG, 0) == SIGN_MINUS) {
 			log_error("Negative stripesize is invalid");
@@ -211,12 +209,6 @@
 			  display_size(cmd, (uint64_t) lp->stripe_size));
 	}
 
-	if (argc && (unsigned) argc < lp->stripes) {
-		log_error("Too few physical volumes on "
-			  "command line for %d-way striping", lp->stripes);
-		return 0;
-	}
-
 	if (lp->stripes < 1 || lp->stripes > MAX_STRIPES) {
 		log_error("Number of stripes (%d) must be between %d and %d",
 			  lp->stripes, 1, MAX_STRIPES);
@@ -236,19 +228,12 @@
 
 static int _read_mirror_params(struct lvcreate_params *lp,
 			       struct cmd_context *cmd,
-			       int *pargc)
+			       int *pargc __attribute((unused)))
 {
-	int argc = *pargc;
 	int region_size;
 	int pagesize = lvm_getpagesize();
 	const char *mirrorlog;
 
-	if (argc && (unsigned) argc < lp->mirrors) {
-		log_error("Too few physical volumes on "
-			  "command line for %d-way mirroring", lp->mirrors);
-		return 0;
-	}
-
 	if (arg_count(cmd, regionsize_ARG)) {
 		if (arg_sign_value(cmd, regionsize_ARG, 0) == SIGN_MINUS) {
 			log_error("Negative regionsize is invalid");


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2007-07-17 16:13 mbroz
  0 siblings, 0 replies; 18+ messages in thread
From: mbroz @ 2007-07-17 16:13 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2007-07-17 16:13:12

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Fix snapshot cow area deactivation if origin is not active. (2.02.13)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.656&r2=1.657
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.137&r2=1.138

--- LVM2/WHATS_NEW	2007/07/13 17:08:00	1.656
+++ LVM2/WHATS_NEW	2007/07/17 16:13:12	1.657
@@ -1,5 +1,6 @@
 Version 2.02.27 - 
 ================================
+  Fix snapshot cow area deactivation if origin is not active. (2.02.13)
   Fix configure libdevmapper.h check when --with-dmdir is used.
   Turn _add_pv_to_vg() into external library function add_pv_to_vg().
   Add pv_by_path() external library function.
--- LVM2/tools/lvcreate.c	2007/06/28 17:33:44	1.137
+++ LVM2/tools/lvcreate.c	2007/07/17 16:13:12	1.138
@@ -478,10 +478,11 @@
 	struct logical_volume *lv, *org = NULL, *log_lv = NULL;
 	struct list *pvh, tags;
 	const char *tag = NULL;
-	int consistent = 1;
+	int consistent = 1, origin_active = 0;
 	struct alloc_handle *ah = NULL;
 	char lv_name_buf[128];
 	const char *lv_name;
+	struct lvinfo info;
 
 	status |= lp->permission | VISIBLE_LV;
 
@@ -615,6 +616,13 @@
  
 		/* Must zero cow */
 		status |= LVM_WRITE;
+
+		if (!lv_info(cmd, org, &info, 0)) {
+			log_error("Check for existence of snapshot origin "
+				  "'%s' failed.", org->name);
+			return 0;
+		}
+		origin_active = info.exists;
 	}
 
 	if (!lp->extents) {
@@ -792,6 +800,13 @@
 		if (!(lp->permission & LVM_WRITE))
 			lv->status &= ~LVM_WRITE;
 
+		/* COW area must be deactivated if origin is not active */
+		if (!origin_active && !deactivate_lv(cmd, lv)) {
+			log_error("Aborting. Couldn't deactivate snapshot "
+				  "COW area.");
+			return 0;
+		}
+
 		/* cow LV remains active and becomes snapshot LV */
 
 		if (!vg_add_snapshot(vg->fid, NULL, org, lv, NULL,


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2006-10-26 18:22 agk
  0 siblings, 0 replies; 18+ messages in thread
From: agk @ 2006-10-26 18:22 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-10-26 18:22:10

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	When adding snapshot leave cow LV mapped device active after zeroing.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.482&r2=1.483
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.128&r2=1.129

--- LVM2/WHATS_NEW	2006/10/24 19:07:32	1.482
+++ LVM2/WHATS_NEW	2006/10/26 18:22:10	1.483
@@ -1,5 +1,6 @@
 Version 2.02.13 -
 ===================================
+  When adding snapshot leave cow LV mapped device active after zeroing.
   Fix a clvmd debug message.
   Add dev_flush() to set_lv().
   Add lvchange --resync.
--- LVM2/tools/lvcreate.c	2006/10/18 18:01:53	1.128
+++ LVM2/tools/lvcreate.c	2006/10/26 18:22:10	1.129
@@ -761,13 +761,14 @@
 		return 0;
 	}
 
-	if (!activate_lv(cmd, lv)) {
-		if (lp->snapshot)
-			/* FIXME Remove the failed lv we just added */
+	if (lp->snapshot) {
+		if (!activate_lv_excl(cmd, lv)) {
 			log_error("Aborting. Failed to activate snapshot "
 				  "exception store. Remove new LV and retry.");
-		else
-			log_error("Failed to activate new LV.");
+			return 0;
+		}
+	} else if (!activate_lv(cmd, lv)) {
+		log_error("Failed to activate new LV.");
 		return 0;
 	}
 
@@ -787,10 +788,8 @@
 		/* Reset permission after zeroing */
 		if (!(lp->permission & LVM_WRITE))
 			lv->status &= ~LVM_WRITE;
-		if (!deactivate_lv(cmd, lv)) {
-			log_err("Couldn't deactivate new snapshot.");
-			return 0;
-		}
+
+		/* cow LV remains active and becomes snapshot LV */
 
 		if (!vg_add_snapshot(vg->fid, NULL, org, lv, NULL,
 				     org->le_count, lp->chunk_size)) {


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2006-05-24 13:58 agk
  0 siblings, 0 replies; 18+ messages in thread
From: agk @ 2006-05-24 13:58 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-05-24 13:58:14

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Prevent snapshots of mirrors.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.391&r2=1.392
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.120&r2=1.121


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2005-06-22 14:56 agk
  0 siblings, 0 replies; 18+ messages in thread
From: agk @ 2005-06-22 14:56 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2005-06-22 14:56:14

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	fix lvm1 non-mirror lvcreate

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.262&r2=1.263
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.96&r2=1.97


^ permalink raw reply	[flat|nested] 18+ messages in thread

* LVM2 ./WHATS_NEW tools/lvcreate.c
@ 2004-10-15 15:53 agk
  0 siblings, 0 replies; 18+ messages in thread
From: agk @ 2004-10-15 15:53 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2004-10-15 15:53:18

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c 

Log message:
	Fixes to lvcreate vgname processing.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.103&r2=1.104
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.85&r2=1.86


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-04-11 12:33 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-01 21:21 LVM2 ./WHATS_NEW tools/lvcreate.c zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2012-04-11 12:33 zkabelac
2012-03-02 17:25 zkabelac
2012-02-27 10:00 zkabelac
2011-11-07 11:01 zkabelac
2011-09-22 15:36 jbrassow
2008-09-24 16:32 mbroz
2008-06-05 13:38 agk
2008-01-17 15:53 agk
2008-01-16 15:25 agk
2007-11-12 13:34 agk
2007-09-24 13:25 wysochanski
2007-09-17 17:18 agk
2007-07-17 16:13 mbroz
2006-10-26 18:22 agk
2006-05-24 13:58 agk
2005-06-22 14:56 agk
2004-10-15 15:53 agk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).