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