mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

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

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