Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4b856476e96777842ea6c…
Commit: 4b856476e96777842ea6c9b42654c369a6b22db4
Parent: 9cbc9e8296752df35626a9b50de1cb551ff5e99e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 23 16:32:35 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jul 23 16:36:31 2021 +0200
vgmerge: support option --poolmetadataspare
---
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 83d780029..4fcd9f3c5 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 1264bb565..e2292182a 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 a4785b38a..0bc5a4989 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 884ad4b8d..08615cd62 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))
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=06602942a31d82cb69e9d…
Commit: 06602942a31d82cb69e9d1874f3b63825c0f93ac
Parent: d91c018732c07c5d8c6bfc05570dbc82644a957c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jul 21 14:10:38 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jul 21 14:24:27 2021 -0500
writecache: use block size 512 for thin pool data
Recent commit 84bd394cf9aaa581b4bf980f764544dda26a0305
"writecache: use block size 4096 when no fs is found"
failed to account for the case where writecache is attached
to thin pool data. Checking fs block size on the thin pool
data LV is wrong, and checking the fs block on each thin LV
would be impractical, so default to 512 which cannot break
any existing file systems, and require the user to specify
4k when appropriate.
---
tools/lvconvert.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index f699443fd..83dfe5c71 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5966,6 +5966,23 @@ static int _set_writecache_block_size(struct cmd_context *cmd,
goto bad;
}
+ /*
+ * When attaching writecache to thin pool data, the fs block sizes
+ * would need to be checked on each thin LV which isn't practical, so
+ * default to 512, and require the user to specify 4k when appropriate.
+ */
+ if (lv_is_thin_pool(lv) || lv_is_thin_pool_data(lv)) {
+ if (block_size_setting)
+ block_size = block_size_setting;
+ else
+ block_size = 512;
+
+ log_print("Using writecache block size %u for thin pool data, logical block size %u, physical block size %u.",
+ block_size, lbs_4k ? 4096 : 512, pbs_4k ? 4096 : 512);
+
+ goto out;
+ }
+
if (dm_snprintf(pathname, sizeof(pathname), "%s/%s/%s", cmd->dev_dir,
lv->vg->name, lv->name) < 0) {
log_error("Path name too long to get LV block size %s", display_lvname(lv));
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2132fdc11f7bc28563876…
Commit: 2132fdc11f7bc285638765e001bef6a3e595b286
Parent: 5042463c5083cc71546297344058bd0fa523aa5c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 20 22:33:05 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 21 15:56:33 2021 +0200
vgsplit: add support for option --poolmetadataspare
When splitting VG with thin/cache pool volume, handle pmspare during
such split and allocate new pmspare in new VG or extend existing pmspare
there and eventually drop pmspare in original VG if is no longer needed
there.
---
WHATS_NEW | 1 +
lib/metadata/pool_manip.c | 11 +++++++++++
man/vgsplit.8_pregen | 9 +++++++++
tools/command-lines.in | 2 +-
tools/vgsplit.c | 8 ++++++++
5 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b06071c42..83d780029 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.13 -
===============================
+ Support --poolmetadataspare with vgsplit.
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/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c
index 9ceec3a7e..e451e92ae 100644
--- a/lib/metadata/pool_manip.c
+++ b/lib/metadata/pool_manip.c
@@ -722,6 +722,17 @@ int handle_pool_metadata_spare(struct volume_group *vg, uint32_t extents,
return 1;
}
+ if (!extents) {
+ /* pmspare is not needed */
+ if (lv) {
+ log_debug_metadata("Dropping unused pool metadata spare LV %s.",
+ display_lvname(lv));
+ if (!lv_remove_single(vg->cmd, lv, DONT_PROMPT, 0))
+ return_0;
+ }
+ return 1;
+ }
+
if (extents > MAX_SIZE)
extents = MAX_SIZE;
diff --git a/man/vgsplit.8_pregen b/man/vgsplit.8_pregen
index 331c6e491..8a0ae597e 100644
--- a/man/vgsplit.8_pregen
+++ b/man/vgsplit.8_pregen
@@ -70,6 +70,8 @@ Common options for command:
.hy
]
.br
+[ \fB--poolmetadataspare\fP \fBy\fP|\fBn\fP ]
+.br
[ \fB--\fP[\fBvg\fP]\fBmetadatacopies\fP \fBall\fP|\fBunmanaged\fP|\fINumber\fP ]
.ad b
.RE
@@ -235,6 +237,13 @@ Move only PVs used by the named LV.
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 8607305cb..a4785b38a 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -1912,7 +1912,7 @@ ID: vgscan_general
---
-OO_VGSPLIT: --autobackup Bool
+OO_VGSPLIT: --autobackup Bool, --poolmetadataspare Bool
# used only when the destination VG is new
OO_VGSPLIT_NEW: --alloc Alloc,
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 296248e7c..a085ac2ba 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -525,6 +525,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
int existing_vg = 0;
int r = ECMD_FAILED;
const char *lv_name;
+ int poolmetadataspare = arg_int_value(cmd, poolmetadataspare_ARG, DEFAULT_POOL_METADATA_SPARE);
if ((arg_is_set(cmd, name_ARG) + argc) < 3) {
log_error("Existing VG, new VG and either physical volumes "
@@ -699,6 +700,13 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
*/
vg_to->status |= EXPORTED_VG;
+
+ if (!handle_pool_metadata_spare(vg_to, 0, &vg_to->pvs, poolmetadataspare))
+ goto_bad;
+
+ if (!handle_pool_metadata_spare(vg_from, 0, &vg_from->pvs, poolmetadataspare))
+ goto_bad;
+
if (!archive(vg_to))
goto_bad;