All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vgsplit: Make vgsplit work on mirrors with leg and log on same PV
@ 2014-04-23 19:20 Jonathan Brassow
  0 siblings, 0 replies; only message in thread
From: Jonathan Brassow @ 2014-04-23 19:20 UTC (permalink / raw)
  To: lvm-devel

Given a named mirror LV, vgsplit will look for the PVs that compose it
and move them to a new VG.  It does this by first looking at the log
and then the legs.  If the log is on the same device as one of the mirror
images, a problem occurs.  This is because the PV is moved to the new VG
as the log is processed and thus cannot be found in the current VG when
the image is processed.  The solution is to check and see if the PV we are
looking for has already been moved to the new VG.  If so, it is not an
error.


Index: lvm2/lib/metadata/metadata.c
===================================================================
--- lvm2.orig/lib/metadata/metadata.c
+++ lvm2/lib/metadata/metadata.c
@@ -368,6 +368,14 @@ int move_pv(struct volume_group *vg_from
 
 	/* FIXME: handle tags */
 	if (!(pvl = find_pv_in_vg(vg_from, pv_name))) {
+		if (pvl = find_pv_in_vg(vg_to, pv_name))
+			/*
+			 * PV has already been moved.  This can happen if an
+			 * LV is being moved that has multiple sub-LVs on the
+			 * same PV.
+			 */
+			return 1;
+
 		log_error("Physical volume %s not in volume group %s",
 			  pv_name, vg_from->name);
 		return 0;
Index: lvm2/tools/vgsplit.c
===================================================================
--- lvm2.orig/tools/vgsplit.c
+++ lvm2/tools/vgsplit.c
@@ -67,6 +67,7 @@ static int _move_lvs(struct volume_group
 			continue;
 
 		if ((lv->status & MIRRORED))
+			/* further checks by _move_mirrors() */
 			continue;
 
 		if (lv_is_thin_pool(lv) ||




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-23 19:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-23 19:20 [PATCH] vgsplit: Make vgsplit work on mirrors with leg and log on same PV Jonathan Brassow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.