public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/tools pvmove.c
@ 2011-10-11  8:51 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2011-10-11  8:51 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-11 08:51:02

Modified files:
	tools          : pvmove.c 

Log message:
	Remove test for first_time with FIXME
	
	Workaround for the current code with big FIXME,
	since proper solution for pvmove needs to be developed.
	
	Commiting this only for the purpose to get cluster testing covered.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.90&r2=1.91

--- LVM2/tools/pvmove.c	2011/09/27 22:43:42	1.90
+++ LVM2/tools/pvmove.c	2011/10/11 08:51:02	1.91
@@ -369,8 +369,9 @@
 	}
 
 	if (!_suspend_lvs(cmd, first_time, lv_mirr, lvs_changed, vg)) {
-		log_error("ABORTING: Volume group metadata update failed.");
-		if (!first_time && !revert_lv(cmd, lv_mirr))
+		log_error("ABORTING: Volume group metadata update failed. (first_time: %d)", first_time);
+		//FIXME:  - currently this check breaks pvmove testing
+		if (/*!first_time &&*/ !revert_lv(cmd, lv_mirr))
 			stack;
 		return 0;
 	}


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

* LVM2/tools pvmove.c
@ 2012-03-27 12:01 mbroz
  0 siblings, 0 replies; 9+ messages in thread
From: mbroz @ 2012-03-27 12:01 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2012-03-27 12:01:23

Modified files:
	tools          : pvmove.c 

Log message:
	Fail early if cmirror is not detected and pvmove requires it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.98&r2=1.99

--- LVM2/tools/pvmove.c	2012/03/27 11:43:32	1.98
+++ LVM2/tools/pvmove.c	2012/03/27 12:01:22	1.99
@@ -274,7 +274,15 @@
 		return NULL;
 	}
 
-	if (lv_exclusive_count) {
+	if (vg_is_clustered(vg) && lv_active_count && *exclusive) {
+		log_error("Cannot move in clustered VG %s, "
+			  "clustered mirror (cmirror) not detected "
+			  "and LVs are activated non-exclusively.",
+			  vg->name);
+		return NULL;
+	}
+
+	if (vg_is_clustered(vg) && lv_exclusive_count) {
 		if (lv_active_count) {
 			log_error("Cannot move in clustered VG %s "
 				  "if some LVs are activated "


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

* LVM2/tools pvmove.c
@ 2012-03-27 11:43 mbroz
  0 siblings, 0 replies; 9+ messages in thread
From: mbroz @ 2012-03-27 11:43 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2012-03-27 11:43:33

Modified files:
	tools          : pvmove.c 

Log message:
	Also skip pvmove for remotely active LVs.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.97&r2=1.98

--- LVM2/tools/pvmove.c	2012/03/26 20:33:40	1.97
+++ LVM2/tools/pvmove.c	2012/03/27 11:43:32	1.98
@@ -239,6 +239,14 @@
 			continue;
 		}
 
+		if (vg_is_clustered(vg) &&
+		    lv_is_active_exclusive_remotely(lv)) {
+			lv_skipped = 1;
+			log_print("Skipping LV %s which is activated "
+				  "exclusively on remote node.", lv->name);
+			continue;
+		}
+
 		if (vg_is_clustered(vg)) {
 			if (lv_is_active_exclusive_locally(lv))
 				lv_exclusive_count++;


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

* LVM2/tools pvmove.c
@ 2012-03-26 20:31 mbroz
  0 siblings, 0 replies; 9+ messages in thread
From: mbroz @ 2012-03-26 20:31 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2012-03-26 20:31:01

Modified files:
	tools          : pvmove.c 

Log message:
	Use new flag PVMOVE_EXCLUSIVE in update_metatada call.
	
	There is no real functional change in this patch except it
	avoids checking cluster cmirror module twice.
	
	(Flag used in following patch.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.94&r2=1.95

--- LVM2/tools/pvmove.c	2012/03/13 20:21:27	1.94
+++ LVM2/tools/pvmove.c	2012/03/26 20:31:01	1.95
@@ -18,6 +18,7 @@
 #include "display.h"
 
 #define PVMOVE_FIRST_TIME   0x00000001      /* Called for first time */
+#define PVMOVE_EXCLUSIVE    0x00000002      /* Require exclusive LV */
 
 static int _pvmove_target_present(struct cmd_context *cmd, int clustered)
 {
@@ -358,7 +359,7 @@
 			    struct logical_volume *lv_mirr,
 			    struct dm_list *lvs_changed, unsigned flags)
 {
-	unsigned exclusive = _pvmove_is_exclusive(cmd, vg);
+	unsigned exclusive = (flags & PVMOVE_EXCLUSIVE) ? 1 : 0;
 	unsigned first_time = (flags & PVMOVE_FIRST_TIME) ? 1 : 0;
 	int r = 0;
 
@@ -390,6 +391,9 @@
 	/* Only the first mirror segment gets activated as a mirror */
 	/* FIXME: Add option to use a log */
 	if (first_time) {
+		if (!exclusive && _pvmove_is_exclusive(cmd, vg))
+			exclusive = 1;
+
 		if (!_activate_lv(cmd, lv_mirr, exclusive)) {
 			if (test_mode()) {
 				r = 1;
@@ -428,7 +432,7 @@
 	struct dm_list *lvs_changed;
 	struct physical_volume *pv;
 	struct logical_volume *lv_mirr;
-	unsigned first_time = 1;
+	unsigned flags = PVMOVE_FIRST_TIME;
 	unsigned exclusive;
 	int r = ECMD_FAILED;
 
@@ -485,7 +489,7 @@
 			goto out;
 		}
 
-		first_time = 0;
+		flags &= ~PVMOVE_FIRST_TIME;
 	} else {
 		/* Determine PE ranges to be moved */
 		if (!(source_pvl = create_pv_list(cmd->mem, vg, 1,
@@ -518,9 +522,11 @@
 	/* init_pvmove(1); */
 	/* vg->status |= PVMOVE; */
 
-	if (first_time) {
+	if (flags & PVMOVE_FIRST_TIME) {
+		if (exclusive)
+			flags |= PVMOVE_EXCLUSIVE;
 		if (!_update_metadata
-		    (cmd, vg, lv_mirr, lvs_changed, PVMOVE_FIRST_TIME))
+		    (cmd, vg, lv_mirr, lvs_changed, flags))
 			goto_out;
 	}
 


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

* LVM2/tools pvmove.c
@ 2011-12-08 18:06 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2011-12-08 18:06 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-12-08 18:06:34

Modified files:
	tools          : pvmove.c 

Log message:
	reinstate !first_time check
	(recovery from first_time failure would need different code)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.91&r2=1.92

--- LVM2/tools/pvmove.c	2011/10/11 08:51:02	1.91
+++ LVM2/tools/pvmove.c	2011/12/08 18:06:33	1.92
@@ -370,8 +370,8 @@
 
 	if (!_suspend_lvs(cmd, first_time, lv_mirr, lvs_changed, vg)) {
 		log_error("ABORTING: Volume group metadata update failed. (first_time: %d)", first_time);
-		//FIXME:  - currently this check breaks pvmove testing
-		if (/*!first_time &&*/ !revert_lv(cmd, lv_mirr))
+		/* FIXME Add a recovery path for first time too. */
+		if (!first_time && !revert_lv(cmd, lv_mirr))
 			stack;
 		return 0;
 	}


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

* LVM2/tools pvmove.c
@ 2011-09-21 16:36 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2011-09-21 16:36 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-09-21 16:36:39

Modified files:
	tools          : pvmove.c 

Log message:
	FIXMEs to note problems with some error paths.  (Perhaps safer to disable
	them until they can be fixed completely?)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.86&r2=1.87

--- LVM2/tools/pvmove.c	2011/08/30 14:55:19	1.86
+++ LVM2/tools/pvmove.c	2011/09/21 16:36:39	1.87
@@ -365,6 +365,7 @@
 	}
 
 	if (!_suspend_lvs(cmd, first_time, lv_mirr, lvs_changed)) {
+		/* FIXME vg_revert must be moved *before* any LV resumes */
 		vg_revert(vg);
 		goto_out;
 	}
@@ -388,13 +389,16 @@
 
 			/*
 			 * Nothing changed yet, try to revert pvmove.
+			 * FIXME This error path is incomplete and unsafe.
 			 */
 			log_error("Temporary pvmove mirror activation failed.");
 
 			/* Ensure that temporary mrror is deactivate even on other nodes. */
+			/* FIXME Unsafe to proceed if this fails without checking explicitly that no pvmove LVs are still active */
 			(void)deactivate_lv(cmd, lv_mirr);
 
 			/* Revert metadata */
+			/* FIXME Use --abort code instead? */
 			if (!_detach_pvmove_mirror(cmd, lv_mirr) ||
 			    !lv_remove(lv_mirr) ||
 			    !vg_write(vg) || !vg_commit(vg))


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

* LVM2/tools pvmove.c
@ 2009-12-04 14:03 prajnoha
  0 siblings, 0 replies; 9+ messages in thread
From: prajnoha @ 2009-12-04 14:03 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2009-12-04 14:03:18

Modified files:
	tools          : pvmove.c 

Log message:
	Give better message for pvmove when all data on source PV is skipped.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.69&r2=1.70

--- LVM2/tools/pvmove.c	2009/12/03 19:22:24	1.69
+++ LVM2/tools/pvmove.c	2009/12/04 14:03:18	1.70
@@ -180,6 +180,7 @@
 	struct lv_list *lvl;
 	uint32_t log_count = 0;
 	int lv_found = 0;
+	int lv_skipped = 0;
 
 	/* FIXME Cope with non-contiguous => splitting existing segments */
 	if (!(lv_mirr = lv_create_empty("pvmove%d", NULL,
@@ -209,22 +210,27 @@
 			lv_found = 1;
 		}
 		if (lv_is_origin(lv) || lv_is_cow(lv)) {
+			lv_skipped = 1;
 			log_print("Skipping snapshot-related LV %s", lv->name);
 			continue;
 		}
 		if (lv->status & MIRRORED) {
+			lv_skipped = 1;
 			log_print("Skipping mirror LV %s", lv->name);
 			continue;
 		}
 		if (lv->status & MIRROR_LOG) {
+			lv_skipped = 1;
 			log_print("Skipping mirror log LV %s", lv->name);
 			continue;
 		}
 		if (lv->status & MIRROR_IMAGE) {
+			lv_skipped = 1;
 			log_print("Skipping mirror image LV %s", lv->name);
 			continue;
 		}
 		if (lv->status & LOCKED) {
+			lv_skipped = 1;
 			log_print("Skipping locked LV %s", lv->name);
 			continue;
 		}
@@ -240,6 +246,10 @@
 
 	/* Is temporary mirror empty? */
 	if (!lv_mirr->le_count) {
+		if (lv_skipped)
+			log_error("All data on source PV skipped. "
+				  "It contains locked, hidden or "
+				  "non-top level LVs only.");
 		log_error("No data to move for %s", vg->name);
 		return NULL;
 	}


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

* LVM2/tools pvmove.c
@ 2004-05-05 18:33 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2004-05-05 18:33 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2004-05-05 18:33:01

Modified files:
	tools          : pvmove.c 

Log message:
	Skip mirror LV.  Comments.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16


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

* LVM2/tools pvmove.c
@ 2004-03-31 18:41 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2004-03-31 18:41 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2004-03-31 18:41:39

Modified files:
	tools          : pvmove.c 

Log message:
	Missing dev_close_all()s

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12


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

end of thread, other threads:[~2012-03-27 12:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-11  8:51 LVM2/tools pvmove.c zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2012-03-27 12:01 mbroz
2012-03-27 11:43 mbroz
2012-03-26 20:31 mbroz
2011-12-08 18:06 agk
2011-09-21 16:36 agk
2009-12-04 14:03 prajnoha
2004-05-05 18:33 agk
2004-03-31 18:41 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).