stable-2.02 - tests: lvconvert thin profile conversion
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9344a04b3794b154b06...
Commit: 9344a04b3794b154b06fa44da62d088f0b057486
Parent: 7b51f39c844068e022c06b4523f220042f3bad14
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 17 00:07:50 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 17 11:56:12 2021 +0100
tests: lvconvert thin profile conversion
---
test/shell/profiles-thin.sh | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/test/shell/profiles-thin.sh b/test/shell/profiles-thin.sh
index 40059becc..c62a5f56f 100644
--- a/test/shell/profiles-thin.sh
+++ b/test/shell/profiles-thin.sh
@@ -59,6 +59,24 @@ check lv_field $vg/pool_performance profile "thin-performance"
$SHOULD check lv_field $vg/pool_performance chunk_size 1.00m
check lv_field $vg/pool_performance zero ""
+lvremove -f $vg
+
+#
+# Repeat same two creations via lvconvert
+#
+lvcreate -L8m --name pool_generic $vg
+lvconvert --yes --type thin-pool $vg/pool_generic
+check lv_field $vg/pool_generic chunk_size 64.00k
+check lv_field $vg/pool_generic zero "zero"
+
+
+lvcreate -L8m --name pool_performance $vg
+lvconvert --yes --type thin-pool --errorwhenfull y --profile thin-performance $vg/pool_performance
+check lv_field $vg/pool_performance profile "thin-performance"
+$SHOULD check lv_field $vg/pool_performance chunk_size 1.00m
+check lv_field $vg/pool_performance zero ""
+check lv_field $vg/pool_performance lv_when_full "error"
+
vgremove -ff $vg
if test -d "$DM_DEV_DIR/$vg" ; then
2 years, 1 month
stable-2.02 - lvconvert: thin errorwhenfull and recalculation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7b51f39c844068e022c...
Commit: 7b51f39c844068e022c06b4523f220042f3bad14
Parent: 6a1e8104f84849dc198af1be2f8d51942621a1e2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 17 00:10:32 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 17 11:56:12 2021 +0100
lvconvert: thin errorwhenfull and recalculation
When converting an existing LV to thin-pool,
user may now pass also '--errorwhenfull' option
like with 'lvcreate'.
Also recalculate chunksize when performace profile is
used with conversion (again matching lvcreate).
Adds missing flagging for uncropped metadata sizes.
---
tools/command-lines.in | 6 ++++--
tools/lvconvert.c | 13 +++++++++++++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 342b43cc4..c7fe577ab 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -309,6 +309,8 @@ OO_LVCONVERT_POOL: --poolmetadata LV, --poolmetadatasize SizeMB,
--poolmetadataspare Bool, --readahead Readahead, --chunksize SizeKB,
--zero Bool, --metadataprofile String
+OO_LVCONVERT_THIN: --discards Discards --errorwhenfull Bool
+
OO_LVCONVERT_CACHE: --cachemetadataformat CacheMetadataFormat,
--cachemode CacheMode, --cachepolicy String,
--cachesettings String, --zero Bool
@@ -461,7 +463,7 @@ FLAGS: SECONDARY_SYNTAX
lvconvert --type thin-pool LV_linear_striped_raid_cache
OO: --stripes_long Number, --stripesize SizeKB,
---discards Discards, OO_LVCONVERT_POOL, OO_LVCONVERT
+OO_LVCONVERT_THIN, OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
ID: lvconvert_to_thinpool
DESC: Convert LV to type thin-pool.
@@ -493,7 +495,7 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
lvconvert --thinpool LV_linear_striped_raid_cache_thinpool
OO: --type thin-pool, --stripes_long Number, --stripesize SizeKB,
---discards Discards, OO_LVCONVERT_POOL, OO_LVCONVERT
+OO_LVCONVERT_THIN, OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
ID: lvconvert_to_thinpool_or_swap_metadata
DESC: Convert LV to type thin-pool (variant, use --type thin-pool).
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index b885f9241..4d2b0365d 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2940,6 +2940,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
thin_crop_metadata_t crop_metadata;
thin_discards_t discards;
thin_zero_t zero_new_blocks;
+ int error_when_full;
int r = 0;
/* for handling lvmlockd cases */
@@ -3313,6 +3314,18 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
seg->chunk_size = chunk_size;
seg->discards = discards;
seg->zero_new_blocks = zero_new_blocks;
+ if (crop_metadata == THIN_CROP_METADATA_NO)
+ pool_lv->status |= LV_CROP_METADATA;
+ if (!recalculate_pool_chunk_size_with_dev_hints(pool_lv, chunk_calc))
+ goto_bad;
+
+ /* Error when full */
+ if (arg_is_set(cmd, errorwhenfull_ARG))
+ error_when_full = arg_uint_value(cmd, errorwhenfull_ARG, 0);
+ else
+ error_when_full = find_config_tree_bool(cmd, activation_error_when_full_CFG, vg->profile);
+ if (error_when_full)
+ pool_lv->status |= LV_ERROR_WHEN_FULL;
}
/*
2 years, 1 month
main - WHATS_NEW: updates
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=26a09c84c9498b187ee...
Commit: 26a09c84c9498b187eec776150cd1eeafeda6ce7
Parent: 2c5e034cd3cb480d79ac4cc23a6d5079bb053f28
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 17 11:27:57 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 17 11:53:19 2021 +0100
WHATS_NEW: updates
---
WHATS_NEW | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/WHATS_NEW b/WHATS_NEW
index 01ee40dc4..21684992d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,12 @@
Version 2.03.12 -
===================================
+ Check for presence of VDO target before starting any conversion.
+ Support metatadata profiles with volume VDO pool conversions.
+ Support -Zn for conversion of already formated VDO pools.
+ Avoid removing LVs on error path of lvconvert during creation volumes.
+ Fix crashing lvdisplay when thin volume was waiting for merge.
+ Support option --errorwhenfull when converting volume to thin-pool.
+ Improve thin-performance profile support conversion to thin-pool.
Add workaround to avoid read of internal 'converted' devices.
Prohibit merging snapshot into the read-only thick snapshot origin.
Restore support for flipping rw/r permissions for thin snapshot origin.
2 years, 1 month
main - make: generate
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2c5e034cd3cb480d79a...
Commit: 2c5e034cd3cb480d79ac4cc23a6d5079bb053f28
Parent: b9846bdc3e420348646d26259ad57c60b6f2ebf9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 16 21:30:06 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 17 11:53:19 2021 +0100
make: generate
---
man/lvconvert.8_pregen | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/man/lvconvert.8_pregen b/man/lvconvert.8_pregen
index 170eec815..01fbc7154 100644
--- a/man/lvconvert.8_pregen
+++ b/man/lvconvert.8_pregen
@@ -86,6 +86,10 @@ lvconvert - Change logical volume layout
\fB--driverloaded\fP \fBy\fP|\fBn\fP
.ad b
.br
+.ad l
+ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP
+.ad b
+.br
.ad l
\fB-f\fP|\fB--force\fP
.ad b
@@ -819,6 +823,10 @@ Convert LV to type thin-pool.
.ad b
.br
.ad l
+[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
+.ad b
+.br
+.ad l
[ \fB--poolmetadata\fP \fILV\fP ]
.ad b
.br
@@ -915,6 +923,18 @@ Convert LV to type vdopool.
.ad b
.br
.ad l
+[ \fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP ]
+.ad b
+.br
+.ad l
+[ \fB-Z\fP|\fB--zero\fP \fBy\fP|\fBn\fP ]
+.ad b
+.br
+.ad l
+[ \fB--metadataprofile\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--compression\fP \fBy\fP|\fBn\fP ]
.ad b
.br
@@ -1326,6 +1346,19 @@ For testing and debugging.
.ad b
.HP
.ad l
+\fB--errorwhenfull\fP \fBy\fP|\fBn\fP
+.br
+Specifies thin pool behavior when data space is exhausted.
+When yes, device-mapper will immediately return an error
+when a thin pool is full and an I/O request requires space.
+When no, device-mapper will queue these I/O requests for a
+period of time to allow the thin pool to be extended.
+Errors are returned if no space is available after the timeout.
+(Also see dm-thin-pool kernel module option no_space_timeout.)
+See \fBlvmthin\fP(7) for more information.
+.ad b
+.HP
+.ad l
\fB-f\fP|\fB--force\fP ...
.br
Override various checks, confirmations and protections.
@@ -1981,6 +2014,14 @@ Convert LV to type vdopool.
.br
.RS 4
.ad l
+[ \fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP ]
+.ad b
+.br
+.ad l
+[ \fB-Z\fP|\fB--zero\fP \fBy\fP|\fBn\fP ]
+.ad b
+.br
+.ad l
[ \fB-n\fP|\fB--name\fP \fILV\fP\fI_new\fP ]
.ad b
.br
@@ -1993,6 +2034,10 @@ Convert LV to type vdopool.
.ad b
.br
.ad l
+[ \fB--metadataprofile\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--compression\fP \fBy\fP|\fBn\fP ]
.ad b
.br
2 years, 1 month
main - tests: readonly snapshot thick origin can't be merged
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b9846bdc3e420348646...
Commit: b9846bdc3e420348646d26259ad57c60b6f2ebf9
Parent: 868b733588ff5629e1318bf3efcfbceb2ac8db8c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 17 11:38:28 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 17 11:53:19 2021 +0100
tests: readonly snapshot thick origin can't be merged
When user sets snapshot thick origin as read-only - lvconvert --merge refuses
to merge until user swiches origin to 'read-write'.
---
test/shell/snapshot-merge.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/test/shell/snapshot-merge.sh b/test/shell/snapshot-merge.sh
index a50ffdcd8..ff9de96f8 100644
--- a/test/shell/snapshot-merge.sh
+++ b/test/shell/snapshot-merge.sh
@@ -55,6 +55,12 @@ setup_merge_ $vg $lv1
# make sure lvconvert --merge requires explicit LV listing
not lvconvert --merge
+# check read-only origin is protected from being merge
+lvchange -pr $vg/$lv1
+not lvconvert --merge "$vg/$(snap_lv_name_ "$lv1")" |& tee out
+grep "read-only origin" out
+lvchange -prw $vg/$lv1
+
# check exclusive lock is preserved after merge
check lv_field "$vg/$lv1" lv_active_exclusively "active exclusively"
lvconvert --merge "$vg/$(snap_lv_name_ "$lv1")"
2 years, 1 month
main - lvmlocdk: correct creation of dm path vg sanlock LV
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=868b733588ff5629e13...
Commit: 868b733588ff5629e1318bf3efcfbceb2ac8db8c
Parent: fbaf5a32bb3465d121f60db5a77df2e86b0bf49b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Feb 14 17:47:08 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 17 11:53:19 2021 +0100
lvmlocdk: correct creation of dm path vg sanlock LV
Vgname may contain '-' and needs escaping '--' for /dev/mapper path.
---
lib/locking/lvmlockd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 24b7ff6f7..3b9abd6bf 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -382,6 +382,7 @@ static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg,
{
struct device *dev;
char path[PATH_MAX];
+ char *name;
uint64_t old_size_bytes;
uint64_t new_size_bytes;
uint32_t extend_bytes;
@@ -423,8 +424,10 @@ static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg,
new_size_bytes = lv->size * SECTOR_SIZE;
- if (dm_snprintf(path, sizeof(path), "%s/mapper/%s-%s", lv->vg->cmd->dev_dir,
- lv->vg->name, lv->name) < 0) {
+ if (!(name = dm_build_dm_name(lv->vg->cmd->mem, lv->vg->name, lv->name, NULL)))
+ return_0;
+
+ if (dm_snprintf(path, sizeof(path), "%s/%s", dm_dir(), name) < 0) {
log_error("Extend sanlock LV %s name too long - extended size not zeroed.",
display_lvname(lv));
return 0;
2 years, 1 month
main - tests: lvconvert vdo profile support
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fbaf5a32bb3465d121f...
Commit: fbaf5a32bb3465d121f60db5a77df2e86b0bf49b
Parent: 9c0ce4daa2accbfeec2a09729f73ef7a5876c658
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 16 21:30:40 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 17 11:53:19 2021 +0100
tests: lvconvert vdo profile support
---
test/shell/profiles-vdo.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/test/shell/profiles-vdo.sh b/test/shell/profiles-vdo.sh
index c870315a0..7b3c343f3 100644
--- a/test/shell/profiles-vdo.sh
+++ b/test/shell/profiles-vdo.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2018-2021 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -10,7 +10,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-# Exercise obtaining cache parameter from various sources
+# Exercise obtaining vdo parameters from various sources
# Either commmand line or metadata profile or implicit default...
@@ -47,4 +47,8 @@ lvdisplay -m $vg/vdopool | tee out
grep "Compression.*no" out
lvremove -f $vg
+lvcreate -L4G --name vdopool $vg
+lvconvert --yes --type vdo-pool --metadataprofile "$PFILE" $vg/vdopool
+check lv_field $vg/vdopool vdo_compression ""
+
vgremove -ff $vg
2 years, 1 month
main - man: vdo drop resize restriction comment
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9c0ce4daa2accbfeec2...
Commit: 9c0ce4daa2accbfeec2a09729f73ef7a5876c658
Parent: 19e137358008ce0a73c980d10cfdeaad7f9a5045
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Feb 15 12:18:54 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 17 11:53:19 2021 +0100
man: vdo drop resize restriction comment
lvm2 supports resize of cached vdo pool volumes.
---
man/lvmvdo.7_main | 5 -----
1 file changed, 5 deletions(-)
diff --git a/man/lvmvdo.7_main b/man/lvmvdo.7_main
index 474d6dd73..520a28ecf 100644
--- a/man/lvmvdo.7_main
+++ b/man/lvmvdo.7_main
@@ -206,8 +206,6 @@ with the \fBactivation/vdo_pool_autoextend_percent\fP and
Note: You cannot reduce the size of a VDOPoolLV.
-Note: You cannot change the size of a cached VDOPoolLV.
-
.nf
.B lvextend -L+AddingSize VG/VDOPoolLV
.fi
@@ -265,9 +263,6 @@ VDODataLV (accepts also VDOPoolLV) caching provides a mechanism
to accelerate reads and writes of already compressed and deduplicated
data blocks together with VDO metadata.
-A cached VDO data LV cannot be currently resized. Also, the threshold
-based automatic resize will not work.
-
.I Example
.nf
# lvcreate --type vdo -L 5G -V 10G -n vdo1 vg/vdopool
2 years, 1 month
main - tests: check resize of cached vdopool
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=19e137358008ce0a73c...
Commit: 19e137358008ce0a73c980d10cfdeaad7f9a5045
Parent: 5bf1dba9eb8a8b77410e386e59dadeb27801b14e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 17 11:50:27 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 17 11:53:18 2021 +0100
tests: check resize of cached vdopool
---
test/shell/lvconvert-cache-vdo.sh | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/test/shell/lvconvert-cache-vdo.sh b/test/shell/lvconvert-cache-vdo.sh
index 8e2894877..39caf5e03 100644
--- a/test/shell/lvconvert-cache-vdo.sh
+++ b/test/shell/lvconvert-cache-vdo.sh
@@ -17,6 +17,10 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
+percent_() {
+ get lv_field $vg/vpool data_percent | cut -d. -f1
+}
+
aux have_vdo 6 2 0 || skip
aux have_cache 1 3 0 || skip
@@ -41,9 +45,15 @@ lvchange -ay $vg
check dev_md5sum $vg $lv1
lvconvert --yes --cache --cachepool cpool $vg/vpool
-lvconvert --splitcache $vg/vpool
+
+VDODATA="$(percent_)"
+# Check resize of cached VDO pool
+lvextend -L+1G $vg/vpool
lvs -a $vg
+# Check after resize usage is reduced
+test "$(percent_)" -lt $VDODATA
+lvconvert --splitcache $vg/vpool
lvconvert --yes --cache --cachepool cpool $vg/$lv1
check dev_md5sum $vg $lv1
2 years, 1 month
main - vdo: just one probe is enough
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5bf1dba9eb8a8b77410...
Commit: 5bf1dba9eb8a8b77410e386e59dadeb27801b14e
Parent: a7cb25c877ad70c48fa66258f8e3f2157e2e2be5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 17 11:12:11 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 17 11:21:35 2021 +0100
vdo: just one probe is enough
target_present_version() can handle modprobing no need to try it
twice.
---
lib/vdo/vdo.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/lib/vdo/vdo.c b/lib/vdo/vdo.c
index f26874ce5..52e9443ea 100644
--- a/lib/vdo/vdo.c
+++ b/lib/vdo/vdo.c
@@ -414,13 +414,9 @@ static int _vdo_target_present(struct cmd_context *cmd,
if (!_vdo_checked) {
_vdo_checked = 1;
- if (!target_present_version(cmd, TARGET_NAME_VDO, 0,
- &maj, &min, &patchlevel)) {
- /* Try to load kmod VDO module */
- if (!module_present(cmd, MODULE_NAME_VDO) ||
- !target_version(TARGET_NAME_VDO, &maj, &min, &patchlevel))
- return 0;
- }
+ if (!target_present_version(cmd, TARGET_NAME_VDO, 1,
+ &maj, &min, &patchlevel))
+ return 0;
if (maj < 6 || (maj == 6 && min < 2)) {
log_warn("WARNING: Target %s version %u.%u.%u is too old.",
2 years, 1 month