master - test: Fix previous commit - skip only RAID6 part
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f4f408610c6801a5039...
Commit: f4f408610c6801a50395f95b8116e2037a58761e
Parent: cdb49216c5b00a4d73dab3f56be76bde8d128186
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Tue May 16 10:47:53 2017 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue May 16 10:47:53 2017 +0200
test: Fix previous commit - skip only RAID6 part
---
test/shell/lvconvert-raid-regionsize.sh | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-raid-regionsize.sh b/test/shell/lvconvert-raid-regionsize.sh
index 2cea86e..2884037 100644
--- a/test/shell/lvconvert-raid-regionsize.sh
+++ b/test/shell/lvconvert-raid-regionsize.sh
@@ -15,7 +15,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
which mkfs.ext4 || skip
-aux have_raid 1 11 0 || skip
+aux have_raid 1 9 0 || skip
aux prepare_vg 6
@@ -61,6 +61,7 @@ fsck -fn "$DM_DEV_DIR/$vg/$lv1"
_test_regionsizes raid1
+if aux have_raid 1 11 0; then
# Clean up
lvremove --yes $vg
@@ -78,6 +79,9 @@ _test_regionsizes raid6
# Clean up
lvremove --yes $vg
+else
+ echo "Skipping RAID6 tests"
+fi
# Create 6-way raid01
lvcreate --yes -aey --type raid10 -i 3 -m 1 --stripesize 128K -R 256K -L8M -n $lv1 $vg
6 years, 11 months
master - test: Update condition for changing RAID regionsize
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cdb49216c5b00a4d73d...
Commit: cdb49216c5b00a4d73dab3f56be76bde8d128186
Parent: 5406191cb9112dea6d8a618ae1da815f816291f6
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Tue May 16 10:43:34 2017 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue May 16 10:44:52 2017 +0200
test: Update condition for changing RAID regionsize
The test is failing on F23 and F25 with 1.9.1
---
test/shell/lvconvert-raid-regionsize.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-raid-regionsize.sh b/test/shell/lvconvert-raid-regionsize.sh
index 9884c1b..2cea86e 100644
--- a/test/shell/lvconvert-raid-regionsize.sh
+++ b/test/shell/lvconvert-raid-regionsize.sh
@@ -15,7 +15,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
which mkfs.ext4 || skip
-aux have_raid 1 9 0 || skip
+aux have_raid 1 11 0 || skip
aux prepare_vg 6
6 years, 11 months
master - lvchange: allow changing properties on thin pool data lv
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5406191cb9112dea6d8...
Commit: 5406191cb9112dea6d8a618ae1da815f816291f6
Parent: dfc58c637b4e7fe48c28c73cd53eb62611b9309a
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon May 15 10:57:49 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon May 15 10:59:48 2017 -0500
lvchange: allow changing properties on thin pool data lv
Add an exception to not allowing lvchange to change properties
on hidden LVs. When a thin pool data LV is a cache LV, we
need to allow changing cache properties on the tdata sublv of
the thin pool.
---
WHATS_NEW | 1 +
tools/lvchange.c | 10 ++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index abe4641..5097c1b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Allow lvchange to change properties on a thin pool data sub LV.
Fix lvcreate extent percentage calculation for mirrors.
Don't reinstate still-missing devices when correcting inconsistent metadata.
Properly handle subshell return codes in fsadm.
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 660570a..92161e2 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -1238,6 +1238,16 @@ static int _lvchange_properties_check(struct cmd_context *cmd,
int lv_is_named_arg)
{
if (!lv_is_visible(lv)) {
+ /*
+ * Exceptions where we allow lvchange properties on
+ * a hidden sub lv.
+ *
+ * lv_is_thin_pool_data: e.g. needed when the data sublv
+ * is a cache lv and we need to change cache properties.
+ */
+ if (lv_is_thin_pool_data(lv))
+ return 1;
+
if (lv_is_named_arg)
log_error("Operation not permitted on hidden LV %s.", display_lvname(lv));
return 0;
6 years, 11 months
master - config: keep description lines under 80
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dfc58c637b4e7fe48c2...
Commit: dfc58c637b4e7fe48c28c73cd53eb62611b9309a
Parent: 2583732165b72d616dc1c08cb7e9bc74fb5a6e6d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 12 09:55:16 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri May 12 09:55:16 2017 -0500
config: keep description lines under 80
As far as possible, it's nice to keep the config
description lines from going over 80 columns.
---
lib/config/config_settings.h | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 3b0eebb..40b64ab 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -469,8 +469,9 @@ cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separa
cfg(allocation_raid_stripe_all_devices_CFG, "raid_stripe_all_devices", allocation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_ALLOCATION_STRIPE_ALL_DEVICES, vsn(2, 2, 162), NULL, 0, NULL,
"Stripe across all PVs when RAID stripes are not specified.\n"
- "If enabled, all PVs in the VG or on the command line are used for raid0/4/5/6/10\n"
- "when the command does not specify the number of stripes to use.\n"
+ "If enabled, all PVs in the VG or on the command line are used for\n"
+ "raid0/4/5/6/10 when the command does not specify the number of\n"
+ "stripes to use.\n"
"This was the default behaviour until release 2.02.162.\n")
cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 106), NULL, 0, NULL,
@@ -934,7 +935,7 @@ cfg(global_use_lvmetad_CFG, "use_lvmetad", global_CFG_SECTION, 0, CFG_TYPE_BOOL,
"devices/global_filter.\n")
cfg(global_lvmetad_update_wait_time_CFG, "lvmetad_update_wait_time", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_LVMETAD_UPDATE_WAIT_TIME, vsn(2, 2, 151), NULL, 0, NULL,
- "The number of seconds a command will wait for lvmetad update to finish.\n"
+ "Number of seconds a command will wait for lvmetad update to finish.\n"
"After waiting for this period, a command will not use lvmetad, and\n"
"will revert to disk scanning.\n")
6 years, 11 months
master - lvcreate: Fix last commit for virtual sizes.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2583732165b72d616dc...
Commit: 2583732165b72d616dc1c08cb7e9bc74fb5a6e6d
Parent: cf73f6cf61793e9d71391bb7a8f35162509898a4
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri May 12 13:16:10 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri May 12 13:16:10 2017 +0100
lvcreate: Fix last commit for virtual sizes.
Don't stop when extents is 0 if a virtual size parameter was supplied
instead.
---
tools/lvcreate.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index dddf8ad..e83c130 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -407,7 +407,7 @@ static int _update_extents_params(struct volume_group *vg,
}
}
- if (!lp->extents) {
+ if ((lcp->percent != PERCENT_NONE) && !lp->extents) {
log_error("Adjusted size of logical volume is 0 extents. Needs to be larger.");
return 0;
}
6 years, 11 months
master - lvcreate: Fix mirror percentage size calculations.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cf73f6cf61793e9d713...
Commit: cf73f6cf61793e9d71391bb7a8f35162509898a4
Parent: d49a20b7bdc9b741def219be897c5057db5e05ff
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri May 12 02:04:05 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri May 12 02:31:35 2017 +0100
lvcreate: Fix mirror percentage size calculations.
Trap cases where the percentage calculation currently leads to an empty
LV and the message:
Internal error: Unable to create new logical volume with no extents
Additionally convert the calculated number of extents from physical to
logical when creating a mirror using a percentage that is based on
Physical Extents. Otherwise a command like 'lvcreate -m3 -l80%FREE'
can never leave any free space.
This brings the behaviour closer to that of lvresize.
(A further patch is needed to cover all the raid types.)
---
WHATS_NEW | 1 +
tools/lvcreate.c | 37 ++++++++++++++++++++++++++++++-------
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e0741a9..abe4641 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Fix lvcreate extent percentage calculation for mirrors.
Don't reinstate still-missing devices when correcting inconsistent metadata.
Properly handle subshell return codes in fsadm.
Disallow cachepool creation with policy cleaner and mode writeback.
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index f775290..dddf8ad 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -251,6 +251,7 @@ static int _update_extents_params(struct volume_group *vg,
uint32_t size_rest;
uint32_t stripesize_extents;
uint32_t extents;
+ uint32_t base_calc_extents;
if (lcp->size &&
!(lp->extents = extents_from_size(vg->cmd, lcp->size,
@@ -275,17 +276,17 @@ static int _update_extents_params(struct volume_group *vg,
switch (lcp->percent) {
case PERCENT_VG:
- extents = percent_of_extents(lp->extents, vg->extent_count, 0);
+ extents = percent_of_extents(lp->extents, base_calc_extents = vg->extent_count, 0);
break;
case PERCENT_FREE:
- extents = percent_of_extents(lp->extents, vg->free_count, 0);
+ extents = percent_of_extents(lp->extents, base_calc_extents = vg->free_count, 0);
break;
case PERCENT_PVS:
if (lcp->pv_count) {
pv_extent_count = pv_list_extents_free(lp->pvh);
- extents = percent_of_extents(lp->extents, pv_extent_count, 0);
+ extents = percent_of_extents(lp->extents, base_calc_extents = pv_extent_count, 0);
} else
- extents = percent_of_extents(lp->extents, vg->extent_count, 0);
+ extents = percent_of_extents(lp->extents, base_calc_extents = vg->extent_count, 0);
break;
case PERCENT_LV:
log_error("Please express size as %%FREE%s, %%PVS or %%VG.",
@@ -304,7 +305,7 @@ static int _update_extents_params(struct volume_group *vg,
}
/* Add whole metadata size estimation */
extents = cow_max_extents(origin_lv, lp->chunk_size) - origin_lv->le_count +
- percent_of_extents(lp->extents, origin_lv->le_count, 1);
+ percent_of_extents(lp->extents, base_calc_extents = origin_lv->le_count, 1);
break;
case PERCENT_NONE:
extents = lp->extents;
@@ -314,10 +315,27 @@ static int _update_extents_params(struct volume_group *vg,
return 0;
}
- if (lcp->percent) {
+ if (lcp->percent != PERCENT_NONE) {
/* FIXME Don't do the adjustment for parallel allocation with PERCENT_ORIGIN! */
lp->approx_alloc = 1;
- log_verbose("Converted %" PRIu32 "%%%s into %" PRIu32 " extents.", lp->extents, get_percent_string(lcp->percent), extents);
+ if (!extents) {
+ log_error("Calculated size of logical volume is 0 extents. Needs to be larger.");
+ return 0;
+ }
+
+ /* For mirrors and raid with percentages based on physical extents, convert the total number of PEs
+ * into the number of logical extents per image (minimum 1) */
+ /* FIXME Handle all the supported raid layouts here based on already-known segtype. */
+ if ((lcp->percent != PERCENT_ORIGIN) && lp->mirrors) {
+ extents /= lp->mirrors;
+ if (!extents)
+ extents = 1;
+ }
+
+ log_verbose("Converted %" PRIu32 "%% of %s (%" PRIu32 ") extents into %" PRIu32 " (with mimages %" PRIu32 " and stripes %" PRIu32
+ " for segtype %s).", lp->extents, get_percent_string(lcp->percent), base_calc_extents,
+ extents, lp->mirrors, lp->stripes, lp->segtype->name);
+
lp->extents = extents;
}
@@ -389,6 +407,11 @@ static int _update_extents_params(struct volume_group *vg,
}
}
+ if (!lp->extents) {
+ log_error("Adjusted size of logical volume is 0 extents. Needs to be larger.");
+ return 0;
+ }
+
return 1;
}
6 years, 11 months
master - man lvmcache: add info about metadata formats
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d49a20b7bdc9b741def...
Commit: d49a20b7bdc9b741def219be897c5057db5e05ff
Parent: 80900dcf76d2c91d8892e54913367bfed1012056
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu May 11 10:52:59 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu May 11 10:52:59 2017 -0500
man lvmcache: add info about metadata formats
---
man/lvmcache.7_main | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/man/lvmcache.7_main b/man/lvmcache.7_main
index e573b58..1f29185 100644
--- a/man/lvmcache.7_main
+++ b/man/lvmcache.7_main
@@ -404,6 +404,24 @@ This is equivalent to:
.B lvconvert --type cache --cachepool VG/CachePoolLV VG/OriginLV
+.SS Cache metadata formats
+
+\&
+
+There are two disk formats for cache metadata. The metadata format can be
+specified when a cache pool is created, and cannot be changed.
+Format \fB2\fP has better performance; it is more compact, and stores
+dirty bits in a separate btree, which improves the speed of shutting down
+the cache.
+With \fBauto\fP, lvm selects the best option provided by the current
+dm-cache kernel target.
+
+.B lvconvert --type cache-pool --cachemetadataformat auto|1|2
+.RS
+.B VG/CacheDataLV
+.RE
+
+
.SH SEE ALSO
.BR lvm.conf (5),
.BR lvchange (8),
6 years, 11 months
master - metadata: Fix metadata repair when devs still missing.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=80900dcf76d2c91d889...
Commit: 80900dcf76d2c91d8892e54913367bfed1012056
Parent: d45531712d7c18035975980069a1683c218abec2
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu May 11 02:04:50 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu May 11 02:17:34 2017 +0100
metadata: Fix metadata repair when devs still missing.
_check_reappeared_pv() incorrectly clears the MISSING_PV flags of
PVs with unknown devices.
While one caller avoids passing such PVs into the function, the other
doesn't. Move the check inside the function so it's not forgotten.
Without this patch, if the normal VG reading code tries to repair
inconsistent metadata while there is an unknown PV, it incorrectly
considers the missing PVs no longer to be missing and produces
incorrect 'pvs' output omitting the missing PV, for example.
Easy reproducer:
Create a VG with 3 PVs pv1, pv2, pv3.
Hide pv2.
Run vgreduce --removemissing.
Reinstate the hidden PV pv2 and at the same time hide a different PV
pv3.
Run 'pvs' - incorrect output.
Run 'pvs' again - correct output.
See https://bugzilla.redhat.com/1434054
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 11 ++++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 79b6c67..e0741a9 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Don't reinstate still-missing devices when correcting inconsistent metadata.
Properly handle subshell return codes in fsadm.
Disallow cachepool creation with policy cleaner and mode writeback.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 972306e..a95b9e3 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3910,7 +3910,13 @@ static int _check_reappeared_pv(struct volume_group *correct_vg,
* confusing.
*/
if (correct_vg->cmd->handles_missing_pvs)
- return rv;
+ return rv;
+
+ /*
+ * Skip this if there is no underlying device present for this PV.
+ */
+ if (!pv->dev)
+ return rv;
dm_list_iterate_items(pvl, &correct_vg->pvs)
if (pv->dev == pvl->pv->dev && is_missing_pv(pvl->pv)) {
@@ -4174,8 +4180,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
if (lvmetad_used() && !use_precommitted) {
if ((correct_vg = lvmcache_get_vg(cmd, vgname, vgid, precommitted))) {
dm_list_iterate_items(pvl, &correct_vg->pvs)
- if (pvl->pv->dev)
- reappeared += _check_reappeared_pv(correct_vg, pvl->pv, *consistent);
+ reappeared += _check_reappeared_pv(correct_vg, pvl->pv, *consistent);
if (reappeared && *consistent)
*consistent = _repair_inconsistent_vg(correct_vg);
else
6 years, 11 months
master - vg_read: check for NULL dev to avoid segfault
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d45531712d7c1803597...
Commit: d45531712d7c18035975980069a1683c218abec2
Parent: b817cc5746ef3bd3105a73e43aaf4b2ccd134335
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 9 15:44:26 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 10 10:45:41 2017 -0500
vg_read: check for NULL dev to avoid segfault
There are certain situations (not fully understood)
where is_missing_pv() is false, but pv->dev is NULL,
so this adds a check for NULL pv->dev after is_missing_pv()
to avoid a segfault.
---
lib/metadata/metadata.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 1b500ed..972306e 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4039,6 +4039,7 @@ static int _check_or_repair_pv_ext(struct cmd_context *cmd,
struct volume_group *vg,
int repair, int *inconsistent_pvs)
{
+ char uuid[64] __attribute__((aligned(8)));
struct lvmcache_info *info;
uint32_t ext_version, ext_flags;
struct pv_list *pvl;
@@ -4052,6 +4053,14 @@ static int _check_or_repair_pv_ext(struct cmd_context *cmd,
if (is_missing_pv(pvl->pv))
continue;
+ if (!pvl->pv->dev) {
+ /* is_missing_pv doesn't catch NULL dev */
+ memset(&uuid, 0, sizeof(uuid));
+ id_write_format(&pvl->pv->id, uuid, sizeof(uuid));
+ log_warn("WARNING: Not repairing PV %s with missing device.", uuid);
+ continue;
+ }
+
if (!(info = lvmcache_info_from_pvid(pvl->pv->dev->pvid, pvl->pv->dev, 0))) {
log_error("Failed to find cached info for PV %s.", pv_dev_name(pvl->pv));
goto out;
6 years, 11 months
master - tests: better skip
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b817cc5746ef3bd3105...
Commit: b817cc5746ef3bd3105a73e43aaf4b2ccd134335
Parent: a1a9ae0aa5fe337935091320b6f27fb053381ff5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 21 12:18:56 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 10 15:40:32 2017 +0200
tests: better skip
---
test/shell/thin-resize-match.sh | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/test/shell/thin-resize-match.sh b/test/shell/thin-resize-match.sh
index c78842f..46b4531 100644
--- a/test/shell/thin-resize-match.sh
+++ b/test/shell/thin-resize-match.sh
@@ -12,13 +12,12 @@
# ensure there is no data loss during thin-pool resize
SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
. lib/inittest
-test -e LOCAL_LVMPOLLD && skip
-
which md5sum || skip
aux have_thin 1 0 0 || skip
6 years, 11 months