public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW tools/vgsplit.c
@ 2006-10-13 13:22 agk
  0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2006-10-13 13:22 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

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

Modified files:
	.              : WHATS_NEW 
	tools          : vgsplit.c 

Log message:
	Propogate clustered flag in vgsplit and require resizeable flag.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.467&r2=1.468
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.19&r2=1.20

--- LVM2/WHATS_NEW	2006/10/12 18:20:45	1.467
+++ LVM2/WHATS_NEW	2006/10/13 13:22:44	1.468
@@ -1,5 +1,6 @@
 Version 2.02.12 -
 ===================================
+  Propogate clustered flag in vgsplit and require resizeable flag.
 
 Version 2.02.11 - 12th October 2006
 ===================================
--- LVM2/tools/vgsplit.c	2006/09/02 01:18:17	1.19
+++ LVM2/tools/vgsplit.c	2006/10/13 13:22:44	1.20
@@ -209,6 +209,12 @@
 		return ECMD_FAILED;
 	}
 
+	if (!(vg_from->status & RESIZEABLE_VG)) {
+		log_error("Volume group \"%s\" is not resizeable", vg_from->name);
+		unlock_vg(cmd, vg_name_from);
+		return ECMD_FAILED;
+	}
+
 	if (!(vg_from->status & LVM_WRITE)) {
 		log_error("Volume group \"%s\" is read-only", vg_from->name);
 		unlock_vg(cmd, vg_name_from);
@@ -248,6 +254,9 @@
 				vg_from->alloc, 0, NULL)))
 		goto error;
 
+	if (vg_from->status & CLUSTERED)
+		vg_to->status |= CLUSTERED;
+
 	/* Archive vg_from before changing it */
 	if (!archive(vg_from))
 		goto error;


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

* LVM2 ./WHATS_NEW tools/vgsplit.c
@ 2008-04-08 21:47 wysochanski
  0 siblings, 0 replies; 7+ messages in thread
From: wysochanski @ 2008-04-08 21:47 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-04-08 21:47:54

Modified files:
	.              : WHATS_NEW 
	tools          : vgsplit.c 

Log message:
	Fix vgsplit error display - fully remove log_suppress.
	
	Author: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.833&r2=1.834
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56

--- LVM2/WHATS_NEW	2008/04/08 21:38:08	1.833
+++ LVM2/WHATS_NEW	2008/04/08 21:47:54	1.834
@@ -1,5 +1,6 @@
 Version 2.02.34 -
 ===================================
+  Fix vgsplit error display - fully remove log_suppress.
   Fix vgsplit error paths to release vg_to lock.
   Indicate whether or not VG is clustered in vgcreate log message.
   Mention default --clustered setting in vgcreate man page.
--- LVM2/tools/vgsplit.c	2008/04/08 21:38:09	1.55
+++ LVM2/tools/vgsplit.c	2008/04/08 21:47:54	1.56
@@ -220,7 +220,6 @@
 	int opt;
 	int active;
 	int existing_vg;
-	int old_suppress;
 	struct pv_list *pvl;
 	int consistent;
 
@@ -272,7 +271,6 @@
 		if (!vgs_are_compatible(cmd, vg_from,vg_to))
 			goto error;
 	} else {
-		log_suppress(old_suppress);
 		existing_vg = 0;
 
 		/* Set metadata format of original VG */


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

* LVM2 ./WHATS_NEW tools/vgsplit.c
@ 2008-04-08 21:38 wysochanski
  0 siblings, 0 replies; 7+ messages in thread
From: wysochanski @ 2008-04-08 21:38 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-04-08 21:38:09

Modified files:
	.              : WHATS_NEW 
	tools          : vgsplit.c 

Log message:
	Fix vgsplit error paths to release vg_to lock.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.832&r2=1.833
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55

--- LVM2/WHATS_NEW	2008/04/08 14:22:12	1.832
+++ LVM2/WHATS_NEW	2008/04/08 21:38:08	1.833
@@ -1,5 +1,6 @@
 Version 2.02.34 -
 ===================================
+  Fix vgsplit error paths to release vg_to lock.
   Indicate whether or not VG is clustered in vgcreate log message.
   Mention default --clustered setting in vgcreate man page.
   Add config file overrides to clvmd when it reads the active LVs list.
--- LVM2/tools/vgsplit.c	2008/04/02 19:30:12	1.54
+++ LVM2/tools/vgsplit.c	2008/04/08 21:38:09	1.55
@@ -288,11 +288,13 @@
 
 		if (fill_vg_create_params(cmd, vg_name_to, &vp_new, &vp_def)) {
 			unlock_vg(cmd, vg_name_from);
+			unlock_vg(cmd, vg_name_to);
 			return EINVALID_CMD_LINE;
 		}
 
 		if (validate_vg_create_params(cmd, &vp_new)) {
 			unlock_vg(cmd, vg_name_from);
+			unlock_vg(cmd, vg_name_to);
 			return EINVALID_CMD_LINE;
 		}
 


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

* LVM2 ./WHATS_NEW tools/vgsplit.c
@ 2008-04-02 19:30 wysochanski
  0 siblings, 0 replies; 7+ messages in thread
From: wysochanski @ 2008-04-02 19:30 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-04-02 19:30:13

Modified files:
	.              : WHATS_NEW 
	tools          : vgsplit.c 

Log message:
	Fix vgsplit locking and remove unneeded error messages when split into new VG.
	
	When vg_lock_and_read() calls were added, they were done so incorrectly for
	the destination VG (vg_to).  This resulted in the VG lock not obtained when
	a new VG was the destination (vg_lock_and_read() would fail in the vg_read()
	clause, which would then release the lock before returning NULL), and could
	result in corrupted destination VG.
	
	The fix was to put back the original lock_vol() and vg_read() calls for 'vg_to'.
	The failure of vg_read() indicates "vg does not exist", and we key off that
	to determine whether we are dealing with a new or existing VG as the
	destination.
	
	The first two error messages were also the result of the incorrect
	vg_lock_and_read() calls:
	Volume group "new" not found
	cluster request failed: Invalid argument
	New volume group "new" successfully split from "vg"
	
	Fixes https://bugzilla.redhat.com/show_bug.cgi?id=438249

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.816&r2=1.817
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.53&r2=1.54

--- LVM2/WHATS_NEW	2008/04/02 13:08:49	1.816
+++ LVM2/WHATS_NEW	2008/04/02 19:30:12	1.817
@@ -1,6 +1,6 @@
 Version 2.02.34 -
 ===================================
-  Suppress excess messages when vgsplit into a new vg.
+  Fix vgsplit locking, remove unneeded error messages when split into new VG.
   Suppress duplicate message when lvresize fails because of invalid vgname.
   Cache VG metadata internally while VG lock is held.
   Fix redundant lvresize message if vg doesn't exist.
--- LVM2/tools/vgsplit.c	2008/04/02 13:08:49	1.53
+++ LVM2/tools/vgsplit.c	2008/04/02 19:30:12	1.54
@@ -222,6 +222,7 @@
 	int existing_vg;
 	int old_suppress;
 	struct pv_list *pvl;
+	int consistent;
 
 	if (argc < 3) {
 		log_error("Existing VG, new VG and physical volumes required.");
@@ -254,11 +255,14 @@
 	}
 
 	log_verbose("Checking for new volume group \"%s\"", vg_name_to);
-	old_suppress = log_suppress(2);
-	if ((vg_to = vg_lock_and_read(cmd, vg_name_to, NULL,
-				      LCK_VG_WRITE | LCK_NONBLOCK,
-				      0, 0))) {
-		log_suppress(old_suppress);
+	if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE | LCK_NONBLOCK)) {
+		log_error("Can't get lock for %s", vg_name_to);
+		unlock_vg(cmd, vg_name_from);
+		return ECMD_FAILED;
+	}
+
+	consistent = 0;
+	if ((vg_to = vg_read(cmd, vg_name_to, NULL, &consistent))) {
 		existing_vg = 1;
 		if (new_vg_option_specified(cmd)) {
 			log_error("Volume group \"%s\" exists, but new VG "
@@ -341,7 +345,13 @@
 	/* store it on disks */
 	log_verbose("Writing out updated volume groups");
 
-	/* Write out new VG as EXPORTED */
+	/*
+	 * First, write out the new VG as EXPORTED.  We do this first in case
+	 * there is a crash - we will still have the new VG information, in an
+	 * exported state.  Recovery after this point would be removal of the
+	 * new VG and redoing the vgsplit.
+	 * FIXME: recover automatically or instruct the user?
+	 */
 	vg_to->status |= EXPORTED_VG;
 
 	if (!archive(vg_to))
@@ -352,7 +362,11 @@
 
 	backup(vg_to);
 
-	/* Write out updated old VG */
+	/*
+	 * Next, write out the updated old VG.  If we crash after this point,
+	 * recovery is a vgimport on the new VG.
+	 * FIXME: recover automatically or instruct the user the user?
+	 */
 	if (vg_from->pv_count) {
 		if (!vg_write(vg_from) || !vg_commit(vg_from))
 			goto error;
@@ -360,10 +374,13 @@
 		backup(vg_from);
 	}
 
-	/* Remove EXPORTED flag from new VG */
+	/*
+	 * Finally, remove the EXPORTED flag from the new VG and write it out.
+	 */
+	consistent = 1;
 	if (!test_mode() &&
-	    !(vg_to = vg_lock_and_read(cmd, vg_name_to, NULL, LCK_NONE, 0,
-				       CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) {
+	    (!(vg_to = vg_read(cmd, vg_name_to, NULL, &consistent))
+	     || !consistent)) {
 		log_error("Volume group \"%s\" became inconsistent: please "
 			  "fix manually", vg_name_to);
 		goto error;


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

* LVM2 ./WHATS_NEW tools/vgsplit.c
@ 2008-04-02 13:08 wysochanski
  0 siblings, 0 replies; 7+ messages in thread
From: wysochanski @ 2008-04-02 13:08 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-04-02 13:08:49

Modified files:
	.              : WHATS_NEW 
	tools          : vgsplit.c 

Log message:
	Suppress "Volume group not found" message when vgsplit of new VG.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.815&r2=1.816
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53

--- LVM2/WHATS_NEW	2008/04/01 22:40:12	1.815
+++ LVM2/WHATS_NEW	2008/04/02 13:08:49	1.816
@@ -1,5 +1,7 @@
 Version 2.02.34 -
 ===================================
+  Suppress excess messages when vgsplit into a new vg.
+  Suppress duplicate message when lvresize fails because of invalid vgname.
   Cache VG metadata internally while VG lock is held.
   Fix redundant lvresize message if vg doesn't exist.
   Fix another allocation bug with clvmd and large node IDs.
--- LVM2/tools/vgsplit.c	2008/03/26 17:26:32	1.52
+++ LVM2/tools/vgsplit.c	2008/04/02 13:08:49	1.53
@@ -220,6 +220,7 @@
 	int opt;
 	int active;
 	int existing_vg;
+	int old_suppress;
 	struct pv_list *pvl;
 
 	if (argc < 3) {
@@ -253,9 +254,11 @@
 	}
 
 	log_verbose("Checking for new volume group \"%s\"", vg_name_to);
+	old_suppress = log_suppress(2);
 	if ((vg_to = vg_lock_and_read(cmd, vg_name_to, NULL,
 				      LCK_VG_WRITE | LCK_NONBLOCK,
 				      0, 0))) {
+		log_suppress(old_suppress);
 		existing_vg = 1;
 		if (new_vg_option_specified(cmd)) {
 			log_error("Volume group \"%s\" exists, but new VG "
@@ -265,6 +268,7 @@
 		if (!vgs_are_compatible(cmd, vg_from,vg_to))
 			goto error;
 	} else {
+		log_suppress(old_suppress);
 		existing_vg = 0;
 
 		/* Set metadata format of original VG */


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

* LVM2 ./WHATS_NEW tools/vgsplit.c
@ 2007-06-28 17:59 mbroz
  0 siblings, 0 replies; 7+ messages in thread
From: mbroz @ 2007-06-28 17:59 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2007-06-28 17:59:34

Modified files:
	.              : WHATS_NEW 
	tools          : vgsplit.c 

Log message:
	Fix vgsplit if splitting all PVs from VG.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.642&r2=1.643
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31

--- LVM2/WHATS_NEW	2007/06/28 17:33:43	1.642
+++ LVM2/WHATS_NEW	2007/06/28 17:59:34	1.643
@@ -1,5 +1,6 @@
 Version 2.02.27 - 
 ================================
+  Fix vgsplit if splitting all PVs from VG.
   Fix lvmdiskscan volume reporting when run in the lvm shell
   Fix missing lvm_shell symbol in lvm2cmd library. (2.02.23)
   Add vg_status function and clean up vg->status in tools directory.
--- LVM2/tools/vgsplit.c	2007/06/15 22:16:55	1.30
+++ LVM2/tools/vgsplit.c	2007/06/28 17:59:34	1.31
@@ -320,7 +320,7 @@
 		goto error;
 
 	/* Split metadata areas and check if both vgs have at least one area */
-	if (!(vg_split_mdas(cmd, vg_from, vg_to))) {
+	if (!(vg_split_mdas(cmd, vg_from, vg_to)) && vg_from->pv_count) {
 		log_error("Cannot split: Nowhere to store metadata for new Volume Group");
 		goto error;
 	}
@@ -344,10 +344,12 @@
 	backup(vg_to);
 
 	/* Write out updated old VG */
-	if (!vg_write(vg_from) || !vg_commit(vg_from))
-		goto error;
+	if (vg_from->pv_count) {
+		if (!vg_write(vg_from) || !vg_commit(vg_from))
+			goto error;
 
-	backup(vg_from);
+		backup(vg_from);
+	}
 
 	/* Remove EXPORTED flag from new VG */
 	consistent = 1;


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

* LVM2 ./WHATS_NEW tools/vgsplit.c
@ 2007-05-15 13:01 mbroz
  0 siblings, 0 replies; 7+ messages in thread
From: mbroz @ 2007-05-15 13:01 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2007-05-15 13:01:41

Modified files:
	.              : WHATS_NEW 
	tools          : vgsplit.c 

Log message:
	Fix and clarify vgsplit error messages.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.616&r2=1.617
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25

--- LVM2/WHATS_NEW	2007/05/14 11:27:33	1.616
+++ LVM2/WHATS_NEW	2007/05/15 13:01:40	1.617
@@ -1,5 +1,6 @@
 Version 2.02.26 -
 =================================
+  Fix and clarify vgsplit error messages.
   Fix a segfault if a device has no target (no table)
   Add some more debuglogs to clvmd startup.
   Misc clvmd cleanups
--- LVM2/tools/vgsplit.c	2007/03/23 12:43:17	1.24
+++ LVM2/tools/vgsplit.c	2007/05/15 13:01:41	1.25
@@ -145,13 +145,16 @@
 		list_iterate_items(seg, &lv->segments) {
 			cow_from = _lv_is_in_vg(vg_from, seg->cow);
 			origin_from = _lv_is_in_vg(vg_from, seg->origin);
+
+			if (cow_from && origin_from)
+				continue;
+			if ((!cow_from && origin_from) ||
+			     (cow_from && !origin_from)) {
+				log_error("Can't split snapshot %s between"
+					  " two Volume Groups", seg->cow->name);
+				return 0;
+			}
 		}
-		if (cow_from && origin_from)
-			continue;
-		if ((!cow_from && origin_from) || (cow_from && !origin_from)) {
-			log_error("Snapshot %s split", seg->cow->name);
-			return 0;
-		}	
 
 		/* Move this snapshot */
 		list_del(lvh);
@@ -190,7 +193,8 @@
 		if ((seg_in && seg_in < seg->area_count) || 
 		    (seg_in && seg->log_lv && !log_in) || 
 		    (!seg_in && seg->log_lv && log_in)) {
-			log_error("Mirror %s split", lv->name);
+			log_error("Can't split mirror %s between "
+				  "two Volume Groups", lv->name);
 			return 0;
 		}
 


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

end of thread, other threads:[~2008-04-08 21:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-13 13:22 LVM2 ./WHATS_NEW tools/vgsplit.c agk
2007-05-15 13:01 mbroz
2007-06-28 17:59 mbroz
2008-04-02 13:08 wysochanski
2008-04-02 19:30 wysochanski
2008-04-08 21:38 wysochanski
2008-04-08 21:47 wysochanski

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).