Blame SOURCES/lvm2-2_03_13-vgmerge-remove-one-of-merge-pmspare-LVs.patch

16deb6
 tools/vgmerge.c | 14 ++++++++++++++
16deb6
 1 file changed, 14 insertions(+)
16deb6
16deb6
diff --git a/tools/vgmerge.c b/tools/vgmerge.c
16deb6
index 895018a..884ad4b 100644
16deb6
--- a/tools/vgmerge.c
16deb6
+++ b/tools/vgmerge.c
16deb6
@@ -92,6 +92,20 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
16deb6
 		}
16deb6
 	}
16deb6
 
16deb6
+	if (vg_from->pool_metadata_spare_lv &&
16deb6
+	    vg_to->pool_metadata_spare_lv) {
16deb6
+		if (vg_from->pool_metadata_spare_lv->le_count >
16deb6
+		    vg_to->pool_metadata_spare_lv->le_count)
16deb6
+			/* Preserve bigger pmspare from  VG_FROM */
16deb6
+			lv = vg_to->pool_metadata_spare_lv;
16deb6
+		else
16deb6
+			lv = vg_from->pool_metadata_spare_lv;
16deb6
+
16deb6
+		log_debug_metadata("Removing pool metadata spare %s.", display_lvname(lv));
16deb6
+		if (!lv_remove_single(cmd, lv, DONT_PROMPT, 0))
16deb6
+				return_ECMD_FAILED;
16deb6
+	}
16deb6
+
16deb6
 	if (!vgs_are_compatible(cmd, vg_from, vg_to))
16deb6
 		goto_bad;
16deb6