Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=888dd33148563e95b2b3f…
Commit: 888dd33148563e95b2b3faac98f6c6dd5f00a60a
Parent: df3ff32fc012b1e881dd492c1e34a7d1020747b1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 23 11:51:51 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 23 12:01:16 2017 +0200
tests: check stacked cache dataLV of thin-pool
---
test/shell/lvcreate-thin-cache.sh | 48 +++++++++++++++++++++++++++++++++++++
test/shell/lvextend-thin-cache.sh | 36 +++++++++++++++++++++++++++
2 files changed, 84 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvcreate-thin-cache.sh b/test/shell/lvcreate-thin-cache.sh
new file mode 100644
index 0000000..0b9f3c8
--- /dev/null
+++ b/test/shell/lvcreate-thin-cache.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Exercise caching thin-pool's data LV
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+#
+# Main
+#
+aux have_thin 1 0 0 || skip
+aux have_cache 1 3 0 || skip
+
+which mkfs.ext4 || skip
+
+aux prepare_pvs 2 64
+get_devs
+
+vgcreate -s 64K "$vg" "${DEVICES[@]}"
+
+lvcreate -L10M -V10M -T $vg/pool --name $lv1
+
+lvcreate -H -L10 $vg/pool
+
+mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+lvconvert --uncache $vg/pool
+fsck -n "$DM_DEV_DIR/$vg/$lv1"
+
+lvcreate -H -L10 $vg/pool_tdata
+fsck -n "$DM_DEV_DIR/$vg/$lv1"
+lvconvert --uncache $vg/pool_tdata
+
+vgremove -ff $vg
diff --git a/test/shell/lvextend-thin-cache.sh b/test/shell/lvextend-thin-cache.sh
new file mode 100644
index 0000000..8983b7d
--- /dev/null
+++ b/test/shell/lvextend-thin-cache.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Exercise resize of cached thin pool data volumes
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+aux have_thin 1 0 0 || skip
+aux have_cache 1 3 0 || skip
+
+aux prepare_vg 2
+
+lvcreate -l2 -T $vg/pool
+# Caching of thin-pool's dataLV
+lvcreate -H -L10 $vg/pool
+
+# Resize is unsupported
+not lvextend -l+2 $vg/pool 2>&1 | tee out
+
+grep "Unable to resize" out
+
+vgremove -ff $vg
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=df3ff32fc012b1e881dd4…
Commit: df3ff32fc012b1e881dd492c1e34a7d1020747b1
Parent: d6fcab900b5b33c55c7894c3f4a7cdd1dbb81c1a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 23 11:36:51 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 23 12:01:15 2017 +0200
lvcreate: skip checking for name restriction for caching
lvcreate supports a 'conversion' when caching LV.
This normally worked fine, however in case passed LV was
thin-pool's data LV with suffix _tdata we have failed to early.
As the easiest fix looks dropping validation of name when
caching type is select - such name check will happen later
once the VG is opened again and properly detect if the LV
with protected name already exists and can be converted,
or will be rejected as ambigiuous operation requiring user
to specify --type cache | --type cache-pool.
---
WHATS_NEW | 1 +
tools/lvcreate.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2f08468..d91900b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.176 -
===================================
+ Allow lvcreate to be used for caching of _tdata LV.
Avoid internal error when resizing cache type _tdata LV (not yet supported).
Show original converted names when lvconverting LV to pool volume.
Move lib code used only by liblvm into metadata-liblvm.c.
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 8aa16f2..ff57baf 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -1425,7 +1425,7 @@ static int _check_pool_parameters(struct cmd_context *cmd,
if (lp->create_pool) {
/* Given pool name needs to follow restrictions for created LV */
if (lp->pool_name) {
- if (!apply_lvname_restrictions(lp->pool_name))
+ if (!seg_is_cache(lp) && !apply_lvname_restrictions(lp->pool_name))
return_0;
/* We could check existance only when we have vg */
if (vg && find_lv(vg, lp->pool_name)) {
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d6fcab900b5b33c55c789…
Commit: d6fcab900b5b33c55c7894c3f4a7cdd1dbb81c1a
Parent: de58df390b6bd3f46841fdacb9a75defccf9f3e2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 23 11:20:32 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 23 12:00:43 2017 +0200
lvextend: detect stacked cache lv used for thinpool
Ensure, that cacheLV is not tried to be resize until full support is
added.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2644d37..2f08468 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.176 -
===================================
+ Avoid internal error when resizing cache type _tdata LV (not yet supported).
Show original converted names when lvconverting LV to pool volume.
Move lib code used only by liblvm into metadata-liblvm.c.
Distinguish between device not found and excluded by filter.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index c0e9a99..b03f9cf 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4797,7 +4797,8 @@ static int _lvresize_check(struct logical_volume *lv,
return 0;
}
- if (lv_is_cache_type(lv)) {
+ if (lv_is_cache_type(lv) ||
+ (lv_is_thin_pool(lv) && lv_is_cache_type(seg_lv(first_seg(lv), 0)))) {
log_error("Unable to resize logical volumes of cache type.");
return 0;
}
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=146745ad88abc0512650b…
Commit: 146745ad88abc0512650b5b40d00ca587784ca36
Parent: 1f359f7558b5ae7750fa629575426ae110781566
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Oct 17 02:12:41 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Oct 17 02:12:41 2017 +0100
device: Separate errors for dev not found and filtered.
Replaced the confusing device error message "not found (or ignored by
filtering)" by either "not found" or "excluded by a filter".
(Later we should be able to say which filter.)
Left the the liblvm code paths alone.
---
WHATS_NEW | 1 +
lib/device/dev-cache.c | 13 +++++++++++++
lib/device/dev-cache.h | 1 +
lib/metadata/metadata.c | 3 +--
tools/toollib.c | 4 ++--
5 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 4ad6b1f..665517b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.176 -
===================================
+ Distinguish between device not found and excluded by filter.
Monitor external origin LVs.
Remove the replicator code, including configure --with-replicators.
Allow lvcreate --type mirror to work with 100%FREE.
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 7802e45..83c2b12 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1370,6 +1370,19 @@ const char *dev_name_confirmed(struct device *dev, int quiet)
return dev_name(dev);
}
+/* Provide a custom reason when a device is ignored */
+const char *dev_cache_filtered_reason(const char *name)
+{
+ const char *reason = "not found";
+ struct device *d = (struct device *) dm_hash_lookup(_cache.names, name);
+
+ if (d)
+ /* FIXME Record which filter caused the exclusion */
+ reason = "excluded by a filter";
+
+ return reason;
+}
+
struct device *dev_cache_get(const char *name, struct dev_filter *f)
{
struct stat buf;
diff --git a/lib/device/dev-cache.h b/lib/device/dev-cache.h
index 0406970..546b1fe 100644
--- a/lib/device/dev-cache.h
+++ b/lib/device/dev-cache.h
@@ -55,6 +55,7 @@ int dev_cache_add_dir(const char *path);
int dev_cache_add_loopfile(const char *path);
__attribute__((nonnull(1)))
struct device *dev_cache_get(const char *name, struct dev_filter *f);
+const char *dev_cache_filtered_reason(const char *name);
// TODO
struct device *dev_cache_get_by_devt(dev_t device, struct dev_filter *f);
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 1606b39..496dbee 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -5488,8 +5488,7 @@ int pv_analyze(struct cmd_context *cmd, const char *pv_name,
dev = dev_cache_get(pv_name, cmd->filter);
if (!dev) {
- log_error("Device %s not found (or ignored by filtering).",
- pv_name);
+ log_error("Device %s %s.", pv_name, dev_cache_filtered_reason(pv_name));
return 0;
}
diff --git a/tools/toollib.c b/tools/toollib.c
index b28167b..fc615f3 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -5532,7 +5532,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
* Check if all arg_devices were found by process_each_pv.
*/
dm_list_iterate_items(pd, &pp->arg_devices)
- log_error("Device %s not found (or ignored by filtering).", pd->name);
+ log_error("Device %s %s.", pd->name, dev_cache_filtered_reason(pd->name));
/*
* Can the command continue if some specified devices were not found?
@@ -5652,7 +5652,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
process_each_pv(cmd, 0, NULL, NULL, 1, 0, handle, _pv_confirm_single);
dm_list_iterate_items(pd, &pp->arg_confirm)
- log_error("Device %s not found (or ignored by filtering).", pd->name);
+ log_error("Device %s %s.", pd->name, dev_cache_filtered_reason(pd->name));
/* Some devices were not found during the second check. */
if (!dm_list_empty(&pp->arg_confirm) && must_use_all)