Blame SOURCES/lvm2-2_03_13-vgmerge-support-option-poolmetadataspare.patch

d16add
 WHATS_NEW              | 2 +-
d16add
 man/vgmerge.8_pregen   | 9 +++++++++
d16add
 tools/command-lines.in | 2 +-
d16add
 tools/vgmerge.c        | 6 ++++++
d16add
 4 files changed, 17 insertions(+), 2 deletions(-)
d16add
d16add
diff --git a/WHATS_NEW b/WHATS_NEW
d16add
index 0b8e3f2..5556789 100644
d16add
--- a/WHATS_NEW
d16add
+++ b/WHATS_NEW
d16add
@@ -1,6 +1,6 @@
d16add
 Version 2.03.13 - 
d16add
 ===============================
d16add
-  Support --poolmetadataspare with vgsplit.
d16add
+  Support --poolmetadataspare with vgsplit and vgmerge.
d16add
   Fix detection of active components of external origin volume.
d16add
   Add vdoimport tool to support conversion of VDO volumes.
d16add
   Support configurable allocation/vdo_pool_header_size.
d16add
diff --git a/man/vgmerge.8_pregen b/man/vgmerge.8_pregen
d16add
index 1264bb5..e229218 100644
d16add
--- a/man/vgmerge.8_pregen
d16add
+++ b/man/vgmerge.8_pregen
d16add
@@ -27,6 +27,8 @@ of both VGs fit into the destination VG's limits.
d16add
 .br
d16add
 [ \fB-l\fP|\fB--list\fP ]
d16add
 .br
d16add
+[    \fB--poolmetadataspare\fP \fBy\fP|\fBn\fP ]
d16add
+.br
d16add
 [ COMMON_OPTIONS ]
d16add
 .ad b
d16add
 .RE
d16add
@@ -147,6 +149,13 @@ Display long help text.
d16add
 Disable locking.
d16add
 .
d16add
 .HP
d16add
+\fB--poolmetadataspare\fP \fBy\fP|\fBn\fP
d16add
+.br
d16add
+Enable or disable the automatic creation and management of a
d16add
+spare pool metadata LV in the VG. A spare metadata LV is reserved
d16add
+space that can be used when repairing a pool.
d16add
+.
d16add
+.HP
d16add
 \fB--profile\fP \fIString\fP
d16add
 .br
d16add
 An alias for --commandprofile or --metadataprofile, depending
d16add
diff --git a/tools/command-lines.in b/tools/command-lines.in
d16add
index a4785b3..0bc5a49 100644
d16add
--- a/tools/command-lines.in
d16add
+++ b/tools/command-lines.in
d16add
@@ -1847,7 +1847,7 @@ DESC: Add devices from all accessible VGs to the devices file.
d16add
 ---
d16add
 
d16add
 vgmerge VG VG
d16add
-OO: --autobackup Bool, --list
d16add
+OO: --autobackup Bool, --list, --poolmetadataspare Bool
d16add
 ID: vgmerge_general
d16add
 
d16add
 ---
d16add
diff --git a/tools/vgmerge.c b/tools/vgmerge.c
d16add
index 884ad4b..08615cd 100644
d16add
--- a/tools/vgmerge.c
d16add
+++ b/tools/vgmerge.c
d16add
@@ -64,6 +64,8 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
d16add
 	struct lv_list *lvl1, *lvl2;
d16add
 	int r = ECMD_FAILED;
d16add
 	int lock_vg_from_first = 0;
d16add
+	struct logical_volume *lv;
d16add
+	int poolmetadataspare = arg_int_value(cmd, poolmetadataspare_ARG, DEFAULT_POOL_METADATA_SPARE);
d16add
 
d16add
 	if (!strcmp(vg_name_to, vg_name_from)) {
d16add
 		log_error("Duplicate volume group name \"%s\"", vg_name_from);
d16add
@@ -185,6 +187,10 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
d16add
 	/* Flag up that some PVs have moved from another VG */
d16add
 	vg_to->old_name = vg_from->name;
d16add
 
d16add
+        /* Check whether size of pmspare is big enough now for merged VG */
d16add
+	if (!handle_pool_metadata_spare(vg_to, 0, &vg_to->pvs, poolmetadataspare))
d16add
+		goto_bad;
d16add
+
d16add
 	/* store it on disks */
d16add
 	log_verbose("Writing out updated volume group");
d16add
 	if (!vg_write(vg_to) || !vg_commit(vg_to))