public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW tools/pvmove.c
@ 2009-12-03 19:22 mbroz
  0 siblings, 0 replies; 7+ messages in thread
From: mbroz @ 2009-12-03 19:22 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-12-03 19:22:24

Modified files:
	.              : WHATS_NEW 
	tools          : pvmove.c 

Log message:
	Fix pvmove test mode to not fail and do not poll.
	
	Test mode should not fail nor try to poll non-existent devices.

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

--- LVM2/WHATS_NEW	2009/12/03 19:20:48	1.1339
+++ LVM2/WHATS_NEW	2009/12/03 19:22:24	1.1340
@@ -1,5 +1,6 @@
 Version 2.02.57 -
 ====================================
+  Fix pvmove test mode to not fail and do not poll.
   Fix error message if VG already exist in vgcreate.
   Fix tools to use log_error when stopped by user.
   Fix lvcreate --readahead.
--- LVM2/tools/pvmove.c	2009/11/03 15:50:44	1.68
+++ LVM2/tools/pvmove.c	2009/12/03 19:22:24	1.69
@@ -312,8 +312,10 @@
 	/* FIXME: Add option to use a log */
 	if (first_time) {
 		if (!_activate_lv(cmd, lv_mirr, exclusive)) {
-			if (test_mode())
+			if (test_mode()) {
+				r = 1;
 				goto out;
+			}
 
 			/*
 			 * Nothing changed yet, try to revert pvmove.
@@ -570,6 +572,9 @@
 int pvmove_poll(struct cmd_context *cmd, const char *pv_name,
 		unsigned background)
 {
+	if (test_mode())
+		return ECMD_PROCESSED;
+
 	return poll_daemon(cmd, pv_name, NULL, background, PVMOVE, &_pvmove_fns,
 			   "Moved");
 }


^ permalink raw reply	[flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW tools/pvmove.c
@ 2012-03-26 20:32 mbroz
  0 siblings, 0 replies; 7+ messages in thread
From: mbroz @ 2012-03-26 20:32 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

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

Modified files:
	.              : WHATS_NEW 
	tools          : pvmove.c 

Log message:
	Do not allow pvmove if some affected LVs are activated
	locally or on more nodes while others are activated exclusively.
	
	Current pvmove code can either use local mirror (for exclusive
	activation) or cmirror (for clustered LVs).
	
	Because the whole intenal pvmove LV is just segmented LV containing
	segments of several top-level LVs, code cannot properly handle
	situation if some segment need to be activated exclusively.
	
	Previously, it wrongly activated exclusive LV on all nodes
	(locing code allowed it) but now this is no lnger possible.
	
	If there is exclusively activated LV, pvmove is only
	possible if all affected LVs are aslo activated exclusively.
	
	(Note that in non-exclusive mode pvmove still activates LVs
	on other nodes during move.)
	
	# lvchange -aly vg_test/lv1
	# lvchange -aey vg_test/lv2
	# pvmove -i 1 /dev/sdc
	Error locking on node bar-01: Device or resource busy
	Error locking on node bar-03: Volume is busy on another node
	...
	Failed to activate lv2

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

--- LVM2/WHATS_NEW	2012/03/26 20:29:45	1.2368
+++ LVM2/WHATS_NEW	2012/03/26 20:32:58	1.2369
@@ -1,5 +1,6 @@
 Version 2.02.96 - 
 ================================
+  Disallow pvmove for exclusive LV if some affected LVs are not exclusively activated.
   Remove unused and wrongly set cluster VG flag from clvmd lock query command.
   Fix pvmove for exclusively activated LV pvmove in clustered VG. (2.02.86)
   Always free hash table on update_pvid_to_vgid() in lvmetad.
--- LVM2/tools/pvmove.c	2012/03/26 20:31:01	1.95
+++ LVM2/tools/pvmove.c	2012/03/26 20:32:58	1.96
@@ -175,13 +175,16 @@
 						const char *lv_name,
 						struct dm_list *allocatable_pvs,
 						alloc_policy_t alloc,
-						struct dm_list **lvs_changed)
+						struct dm_list **lvs_changed,
+						unsigned *exclusive)
 {
 	struct logical_volume *lv_mirr, *lv;
 	struct lv_list *lvl;
 	uint32_t log_count = 0;
 	int lv_found = 0;
 	int lv_skipped = 0;
+	int lv_active_count = 0;
+	int lv_exclusive_count = 0;
 
 	/* FIXME Cope with non-contiguous => splitting existing segments */
 	if (!(lv_mirr = lv_create_empty("pvmove%d", NULL,
@@ -235,6 +238,14 @@
 			log_print("Skipping locked LV %s", lv->name);
 			continue;
 		}
+
+		if (vg_is_clustered(vg)) {
+			if (lv_is_active_exclusive_locally(lv))
+				lv_exclusive_count++;
+			else if (lv_is_active(lv))
+				lv_active_count++;
+		}
+
 		if (!_insert_pvmove_mirrors(cmd, lv_mirr, source_pvl, lv,
 					    *lvs_changed))
 			return_NULL;
@@ -255,6 +266,17 @@
 		return NULL;
 	}
 
+	if (lv_exclusive_count) {
+		if (lv_active_count) {
+			log_error("Cannot move in clustered VG %s "
+				  "if some LVs are activated "
+				  "exclusively while others don't.",
+				  vg->name);
+			return NULL;
+		}
+		*exclusive = 1;
+	}
+
 	if (!lv_add_mirrors(cmd, lv_mirr, 1, 1, 0, 0, log_count,
 			    allocatable_pvs, alloc, MIRROR_BY_SEG)) {
 		log_error("Failed to convert pvmove LV to mirrored");
@@ -510,7 +532,7 @@
 
 		if (!(lv_mirr = _set_up_pvmove_lv(cmd, vg, source_pvl, lv_name,
 						  allocatable_pvs, alloc,
-						  &lvs_changed)))
+						  &lvs_changed, &exclusive)))
 			goto_out;
 	}
 


^ permalink raw reply	[flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW tools/pvmove.c
@ 2012-03-13 20:21 agk
  0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2012-03-13 20:21 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2012-03-13 20:21:28

Modified files:
	.              : WHATS_NEW 
	tools          : pvmove.c 

Log message:
	Fix error message when pvmove LV activation fails with name already in use.

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

--- LVM2/WHATS_NEW	2012/03/12 14:40:41	1.2352
+++ LVM2/WHATS_NEW	2012/03/13 20:21:26	1.2353
@@ -1,5 +1,6 @@
 Version 2.02.96 - 
 ================================
+  Fix error message when pvmove LV activation fails with name already in use.
   Better structure layout for device_info in dev_subsystem_name().
   Change message severity for creation of VG over uninitialised devices.
   Fix error path for failing toolcontext creation.
--- LVM2/tools/pvmove.c	2012/02/28 14:24:58	1.93
+++ LVM2/tools/pvmove.c	2012/03/13 20:21:27	1.94
@@ -369,7 +369,7 @@
 	}
 
 	if (!_suspend_lvs(cmd, first_time, lv_mirr, lvs_changed, vg)) {
-		log_error("ABORTING: Volume group metadata update failed. (first_time: %d)", first_time);
+		log_error("ABORTING: Temporary pvmove mirror %s failed.", first_time ? "activation" : "reload");
 		/* FIXME Add a recovery path for first time too. */
 		if (!first_time && !revert_lv(cmd, lv_mirr))
 			stack;


^ permalink raw reply	[flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW tools/pvmove.c
@ 2011-09-27 17:29 agk
  0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2011-09-27 17:29 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-09-27 17:29:34

Modified files:
	.              : WHATS_NEW 
	tools          : pvmove.c 

Log message:
	Replace incomplete pvmove activation failure recovery code with a message.
	
	As it stands, the recovery code can make things worse sometimes so it's
	better to insist on a proper 'pvmove --abort' cleanup.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2141&r2=1.2142
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.88&r2=1.89

--- LVM2/WHATS_NEW	2011/09/27 17:09:42	1.2141
+++ LVM2/WHATS_NEW	2011/09/27 17:29:33	1.2142
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Replace incomplete pvmove activation failure recovery code with a message.
   Abort if _finish_pvmove suspend_lvs fails instead of cleaning up incompletely.
   Change suspend_lvs to call vg_revert internally.
   Change vg_revert to void and remove superfluous calls after failed vg_commit.
--- LVM2/tools/pvmove.c	2011/09/27 17:09:43	1.88
+++ LVM2/tools/pvmove.c	2011/09/27 17:29:33	1.89
@@ -390,22 +390,9 @@
 			}
 
 			/*
-			 * Nothing changed yet, try to revert pvmove.
-			 * FIXME This error path is incomplete and unsafe.
+			 * FIXME Run --abort internally here.
 			 */
-			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))
-				log_error("ABORTING: Restoring original configuration "
-					  "before pvmove failed. Run pvmove --abort.");
+			log_error("ABORTING: Temporary pvmove mirror activation failed. Run pvmove --abort.");
 			goto_out;
 		}
 	}


^ permalink raw reply	[flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW tools/pvmove.c
@ 2010-01-27 13:29 mbroz
  0 siblings, 0 replies; 7+ messages in thread
From: mbroz @ 2010-01-27 13:29 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-01-27 13:29:11

Modified files:
	.              : WHATS_NEW 
	tools          : pvmove.c 

Log message:
	Fix pvmove abort when temporary mirror fails to be cluster-aware.
	
	When activation of pvmove mirror fails on cluster, some nodes
	still possibly succeeded in activation.
	
	- Explicitly deactivate that mirror to be sure
	- properly pair suspend/resume calls to not cause memory lock problems in clvmd
	
	Code cannot simply call _finish_pvmove on cluster in this situation, because
	changed LVs are suspended twice (causing memory inbalance) and also temporary
	mirror is activated when it is not expected (and we know that it failed already).
	
	Patch prepares special function which remove temporary mirror references from
	metadata and then resumes changed LVs.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1411&r2=1.1412
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.73&r2=1.74

--- LVM2/WHATS_NEW	2010/01/27 13:23:57	1.1411
+++ LVM2/WHATS_NEW	2010/01/27 13:29:11	1.1412
@@ -1,5 +1,6 @@
 Version 2.02.60 - 23rd January 2010
 ===================================
+  Fix pvmove abort workaround to be cluster-aware when temporary mirror activation fails.
   Always query device by using uuid only and not name in clvmd.
   Add missing metadata reverts in pvmove error path.
   Unlock shared lock in clvmd if activation calls failed.
--- LVM2/tools/pvmove.c	2010/01/26 08:01:18	1.73
+++ LVM2/tools/pvmove.c	2010/01/27 13:29:11	1.74
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -284,9 +284,26 @@
 	return r;
 }
 
-static int _finish_pvmove(struct cmd_context *cmd, struct volume_group *vg,
-			  struct logical_volume *lv_mirr,
-			  struct dm_list *lvs_changed);
+static int _detach_pvmove_mirror(struct cmd_context *cmd,
+				 struct logical_volume *lv_mirr)
+{
+	struct dm_list lvs_completed;
+	struct lv_list *lvl;
+
+	/* Update metadata to remove mirror segments and break dependencies */
+	dm_list_init(&lvs_completed);
+	if (!lv_remove_mirrors(cmd, lv_mirr, 1, 0, NULL, PVMOVE) ||
+	    !remove_layers_for_segments_all(cmd, lv_mirr, PVMOVE,
+					    &lvs_completed)) {
+		return 0;
+	}
+
+	dm_list_iterate_items(lvl, &lvs_completed)
+		/* FIXME Assumes only one pvmove at a time! */
+		lvl->lv->status &= ~LOCKED;
+
+	return 1;
+}
 
 static int _update_metadata(struct cmd_context *cmd, struct volume_group *vg,
 			    struct logical_volume *lv_mirr,
@@ -341,12 +358,27 @@
 			}
 
 			/*
+			 * FIXME: review ordering of operations above,
+			 * temporary mirror should be preloaded in suspend.
+			 * Also banned operation here when suspended.
 			 * Nothing changed yet, try to revert pvmove.
 			 */
 			log_error("Temporary pvmove mirror activation failed.");
-			if (!_finish_pvmove(cmd, vg, lv_mirr, lvs_changed))
+
+			/* Ensure that temporary mrror is deactivate even on other nodes. */
+			(void)deactivate_lv(cmd, lv_mirr);
+
+			/* Revert metadata */
+			if (!_detach_pvmove_mirror(cmd, lv_mirr) ||
+			    !lv_remove(lv_mirr) ||
+			    !vg_write(vg) || !vg_commit(vg))
 				log_error("ABORTING: Restoring original configuration "
 					  "before pvmove failed. Run pvmove --abort.");
+
+			/* Unsuspend LVs */
+			if(!resume_lvs(cmd, lvs_changed))
+				stack;
+
 			goto out;
 		}
 	} else if (!resume_lv(cmd, lv_mirr)) {
@@ -487,22 +519,12 @@
 			  struct dm_list *lvs_changed)
 {
 	int r = 1;
-	struct dm_list lvs_completed;
-	struct lv_list *lvl;
 
-	/* Update metadata to remove mirror segments and break dependencies */
-	dm_list_init(&lvs_completed);
-	if (!lv_remove_mirrors(cmd, lv_mirr, 1, 0, NULL, PVMOVE) ||
-	    !remove_layers_for_segments_all(cmd, lv_mirr, PVMOVE,
-					    &lvs_completed)) {
+	if (!_detach_pvmove_mirror(cmd, lv_mirr)) {
 		log_error("ABORTING: Removal of temporary mirror failed");
 		return 0;
 	}
 
-	dm_list_iterate_items(lvl, &lvs_completed)
-		/* FIXME Assumes only one pvmove at a time! */
-		lvl->lv->status &= ~LOCKED;
-
 	/* Store metadata without dependencies on mirror segments */
 	if (!vg_write(vg)) {
 		log_error("ABORTING: Failed to write new data locations "


^ permalink raw reply	[flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW tools/pvmove.c
@ 2010-01-26  8:01 mbroz
  0 siblings, 0 replies; 7+ messages in thread
From: mbroz @ 2010-01-26  8:01 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-01-26 08:01:18

Modified files:
	.              : WHATS_NEW 
	tools          : pvmove.c 

Log message:
	Add some missing vg_revrts calls when pvmove aborts.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1409&r2=1.1410
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73

--- LVM2/WHATS_NEW	2010/01/26 08:00:02	1.1409
+++ LVM2/WHATS_NEW	2010/01/26 08:01:18	1.1410
@@ -1,5 +1,6 @@
 Version 2.02.60 - 23rd January 2010
 ===================================
+  Add missing metadata reverts in pvmove error path.
   Unlock shared lock in clvmd if activation calls failed.
   Fix return code of info call for query by uuid.
   Extend cmirrord man page.
--- LVM2/tools/pvmove.c	2010/01/05 21:08:34	1.72
+++ LVM2/tools/pvmove.c	2010/01/26 08:01:18	1.73
@@ -303,8 +303,10 @@
 	}
 
 	/* Suspend lvs_changed */
-	if (!suspend_lvs(cmd, lvs_changed))
+	if (!suspend_lvs(cmd, lvs_changed)) {
+		vg_revert(vg);
 		goto_out;
+	}
 
 	/* Suspend mirrors on subsequent calls */
 	if (!first_time) {
@@ -324,6 +326,7 @@
 				stack;
 		if (!resume_lvs(cmd, lvs_changed))
 			stack;
+		vg_revert(vg);
 		goto out;
 	}
 


^ permalink raw reply	[flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW tools/pvmove.c
@ 2004-09-14 15:23 agk
  0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2004-09-14 15:23 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2004-09-14 15:23:42

Modified files:
	.              : WHATS_NEW 
	tools          : pvmove.c 

Log message:
	Suppress pvmove abort message in test mode.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.81&r2=1.82
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.19&r2=1.20


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

end of thread, other threads:[~2012-03-26 20:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-03 19:22 LVM2 ./WHATS_NEW tools/pvmove.c mbroz
  -- strict thread matches above, loose matches on Subject: below --
2012-03-26 20:32 mbroz
2012-03-13 20:21 agk
2011-09-27 17:29 agk
2010-01-27 13:29 mbroz
2010-01-26  8:01 mbroz
2004-09-14 15:23 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).