master - writecache: report status fields
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bddbbcb98ca135b91aa...
Commit: bddbbcb98ca135b91aa688c04c1c8be7d76a2bd1
Parent: 2444e830a90fe84721bd61f950946eedcbce0af7
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Jan 31 11:52:49 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Jan 31 11:52:49 2020 -0600
writecache: report status fields
reporting fields (-o) directly from kernel:
writecache_total_blocks
writecache_free_blocks
writecache_writeback_blocks
writecache_error
The data_percent field shows used cache blocks / total cache blocks.
---
device_mapper/all.h | 2 +-
device_mapper/libdm-targets.c | 4 ++--
lib/metadata/lv.c | 8 ++++++++
lib/report/columns.h | 4 ++++
lib/report/properties.c | 9 +++++++++
lib/report/report.c | 21 +++++++++++++++++++++
6 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/device_mapper/all.h b/device_mapper/all.h
index 57673b4..b23485f 100644
--- a/device_mapper/all.h
+++ b/device_mapper/all.h
@@ -383,7 +383,7 @@ int dm_get_status_cache(struct dm_pool *mem, const char *params,
struct dm_status_cache **status);
struct dm_status_writecache {
- uint32_t error;
+ uint64_t error;
uint64_t total_blocks;
uint64_t free_blocks;
uint64_t writeback_blocks;
diff --git a/device_mapper/libdm-targets.c b/device_mapper/libdm-targets.c
index d82e28b..86cb847 100644
--- a/device_mapper/libdm-targets.c
+++ b/device_mapper/libdm-targets.c
@@ -366,8 +366,8 @@ int dm_get_status_writecache(struct dm_pool *mem, const char *params,
if (!(s = dm_pool_zalloc(mem, sizeof(struct dm_status_writecache))))
return_0;
- if (sscanf(params, "%u %llu %llu %llu",
- &s->error,
+ if (sscanf(params, "%llu %llu %llu %llu",
+ (unsigned long long *)&s->error,
(unsigned long long *)&s->total_blocks,
(unsigned long long *)&s->free_blocks,
(unsigned long long *)&s->writeback_blocks) != 4) {
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 4c2ab2b..ab26b8d 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -405,6 +405,14 @@ dm_percent_t lvseg_percent_with_info_and_seg_status(const struct lv_with_info_an
}
}
break;
+ case SEG_STATUS_WRITECACHE:
+ if (type != PERCENT_GET_DATA)
+ p = DM_PERCENT_INVALID;
+ else {
+ uint64_t used = s->writecache->total_blocks - s->writecache->free_blocks;
+ p = dm_make_percent(used, s->writecache->total_blocks);
+ }
+ break;
case SEG_STATUS_RAID:
switch (type) {
case PERCENT_GET_DIRTY:
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 0a89451..31a1d17 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -151,6 +151,10 @@ FIELD(LVSSTATUS, lv, STR, "VDOCompressionState", lvid, 0, vdo_compression_state,
FIELD(LVSSTATUS, lv, STR, "VDOIndexState", lvid, 0, vdo_index_state, vdo_index_state, "For vdo pools, state of index for deduplication.", 0)
FIELD(LVSSTATUS, lv, NUM, "VDOUsedSize", lvid, 0, vdo_used_size, vdo_used_size, "For vdo pools, currently used space.", 0)
FIELD(LVSSTATUS, lv, NUM, "VDOSaving%", lvid, 0, vdo_saving_percent, vdo_saving_percent, "For vdo pools, percentage of saved space.", 0)
+FIELD(LVSSTATUS, lv, NUM, "WCacheTotalBlocks", lvid, 0, writecache_total_blocks, writecache_total_blocks, "Total writecache blocks.", 0)
+FIELD(LVSSTATUS, lv, NUM, "WCacheFreeBlocks", lvid, 0, writecache_free_blocks, writecache_free_blocks, "Total writecache free blocks.", 0)
+FIELD(LVSSTATUS, lv, NUM, "WCacheWritebackBlocks", lvid, 0, writecache_writeback_blocks, writecache_writeback_blocks, "Total writecache writeback blocks.", 0)
+FIELD(LVSSTATUS, lv, NUM, "WCacheErrors", lvid, 0, writecache_error, writecache_error, "Total writecache errors.", 0)
/*
* End of LVSSTATUS type fields
*/
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 25e263f..3257505 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -279,6 +279,15 @@ GET_PV_NUM_PROPERTY_FN(pv_ba_size, SECTOR_SIZE * pv->ba_size)
#define _cache_write_misses_set prop_not_implemented_set
#define _cache_write_misses_get prop_not_implemented_get
+#define _writecache_total_blocks_set prop_not_implemented_set
+#define _writecache_total_blocks_get prop_not_implemented_get
+#define _writecache_free_blocks_set prop_not_implemented_set
+#define _writecache_free_blocks_get prop_not_implemented_get
+#define _writecache_writeback_blocks_set prop_not_implemented_set
+#define _writecache_writeback_blocks_get prop_not_implemented_get
+#define _writecache_error_set prop_not_implemented_set
+#define _writecache_error_get prop_not_implemented_get
+
#define _vdo_operating_mode_set prop_not_implemented_set
#define _vdo_operating_mode_get prop_not_implemented_get
#define _vdo_compression_state_set prop_not_implemented_set
diff --git a/lib/report/report.c b/lib/report/report.c
index 70ee514..d379e2a 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3875,6 +3875,27 @@ GENERATE_CACHE_STATUS_DISP_FN(read_misses)
GENERATE_CACHE_STATUS_DISP_FN(write_hits)
GENERATE_CACHE_STATUS_DISP_FN(write_misses)
+/*
+ * Macro to generate '_writecache_<cache_status_field_name>_disp' reporting function.
+ * The 'writecache_status_field_name' is field name from struct dm_writecache_status.
+ */
+#define GENERATE_WRITECACHE_STATUS_DISP_FN(writecache_status_field_name) \
+static int _writecache_ ## writecache_status_field_name ## _disp (struct dm_report *rh, \
+ struct dm_pool *mem, \
+ struct dm_report_field *field, \
+ const void *data, \
+ void *private) \
+{ \
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data; \
+ if (lvdm->seg_status.type != SEG_STATUS_WRITECACHE) \
+ return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_64)); \
+ return dm_report_field_uint64(rh, field, &lvdm->seg_status.writecache->writecache_status_field_name); \
+}
+
+GENERATE_WRITECACHE_STATUS_DISP_FN(total_blocks)
+GENERATE_WRITECACHE_STATUS_DISP_FN(free_blocks)
+GENERATE_WRITECACHE_STATUS_DISP_FN(writeback_blocks)
+GENERATE_WRITECACHE_STATUS_DISP_FN(error)
/*
* Macro to generate '_vdo_<vdo_field_name>_disp' reporting function.
3 years, 8 months
master - man: updates to lvmcache
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2444e830a90fe84721b...
Commit: 2444e830a90fe84721bd61f950946eedcbce0af7
Parent: 8810c11bc924e8871f97aa25c61e73b3b3f1fa87
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jan 30 14:09:21 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jan 30 14:09:21 2020 -0600
man: updates to lvmcache
---
man/lvmcache.7_main | 99 +++++++++++++++++++++++++++++------------------------
1 file changed, 54 insertions(+), 45 deletions(-)
diff --git a/man/lvmcache.7_main b/man/lvmcache.7_main
index 985b79a..fb91be8 100644
--- a/man/lvmcache.7_main
+++ b/man/lvmcache.7_main
@@ -5,24 +5,32 @@ lvmcache \(em LVM caching
.SH DESCRIPTION
\fBlvm\fP(8) includes two kinds of caching that can be used to improve the
-performance of a Logical Volume (LV). Typically, a smaller, faster device
-is used to improve i/o performance of a larger, slower LV. To do this, a
-separate LV is created from the faster device, and then the original LV is
-converted to start using the fast LV.
+performance of a Logical Volume (LV). When caching, varying subsets of an
+LV's data are temporarily stored on a smaller, faster device (e.g. an SSD)
+to improve the performance of the LV.
+
+To do this with lvm, a new special LV is first created from the faster
+device. This LV will hold the cache. Then, the new fast LV is attached to
+the main LV by way of an lvconvert command. lvconvert inserts one of the
+device mapper caching targets into the main LV's i/o path. The device
+mapper target combines the main LV and fast LV into a hybrid device that looks
+like the main LV, but has better performance. While the main LV is being
+used, portions of its data will be temporarily and transparently stored on
+the special fast LV.
The two kinds of caching are:
.IP \[bu] 2
-A read and write hot-spot cache, using the dm-cache kernel module. This
-cache is slow moving, and adjusts the cache content over time so that the
-most used parts of the LV are kept on the faster device. Both reads and
-writes use the cache. LVM refers to this using the LV type \fBcache\fP.
+A read and write hot-spot cache, using the dm-cache kernel module.
+This cache tracks access patterns and adjusts its content deliberately so
+that commonly used parts of the main LV are likely to be found on the fast
+storage. LVM refers to this using the LV type \fBcache\fP.
.IP \[bu] 2
-A streaming write cache, using the dm-writecache kernel module. This
-cache is intended to be used with SSD or PMEM devices to speed up all
-writes to an LV. Reads do not use this cache. LVM refers to this using
-the LV type \fBwritecache\fP.
+A write cache, using the dm-writecache kernel module. This cache can be
+used with SSD or PMEM devices to speed up all writes to the main LV. Data
+read from the main LV is not stored in the cache, only newly written data.
+LVM refers to this using the LV type \fBwritecache\fP.
.SH USAGE
@@ -30,30 +38,31 @@ Both kinds of caching use similar lvm commands:
.B 1. Identify main LV that needs caching
-A main LV exists on slower devices.
+The main LV may already exist, and is located on larger, slower devices.
+A main LV would be created with a command like:
.nf
- $ lvcreate -n main -L Size vg /dev/slow
+ $ lvcreate -n main -L Size vg /dev/slow_hhd
.fi
.B 2. Identify fast LV to use as the cache
-A fast LV exists on faster devices. This LV will be used to hold the
-cache.
+A fast LV is created using one or more fast devices, like an SSD. This
+special LV will be used to hold the cache:
.nf
- $ lvcreate -n fast -L Size vg /dev/fast
+ $ lvcreate -n fast -L Size vg /dev/fast_ssd
$ lvs -a
LV Attr Type Devices
- fast -wi------- linear /dev/fast
- main -wi------- linear /dev/slow
+ fast -wi------- linear /dev/fast_ssd
+ main -wi------- linear /dev/slow_hhd
.fi
.B 3. Start caching the main LV
-To start caching the main LV using the fast LV, convert the main LV to the
-desired caching type, and specify the fast LV to use:
+To start caching the main LV, convert the main LV to the desired caching
+type, and specify the fast LV to use as the cache:
.nf
using dm-cache:
@@ -83,16 +92,16 @@ using dm-cache:
$ lvs -a
LV Pool Type Devices
main [fast_cvol] cache main_corig(0)
- [fast_cvol] linear /dev/fast
- [main_corig] linear /dev/slow
+ [fast_cvol] linear /dev/fast_ssd
+ [main_corig] linear /dev/slow_hhd
using dm-writecache:
$ lvs -a
LV Pool Type Devices
main [fast_cvol] writecache main_wcorig(0)
- [fast_cvol] linear /dev/fast
- [main_wcorig] linear /dev/slow
+ [fast_cvol] linear /dev/fast_ssd
+ [main_wcorig] linear /dev/slow_hhd
using dm-cache (with cachepool):
@@ -100,9 +109,9 @@ using dm-cache (with cachepool):
LV Pool Type Devices
main [fast_cpool] cache main_corig(0)
[fast_cpool] cache-pool fast_pool_cdata(0)
- [fast_cpool_cdata] linear /dev/fast
- [fast_cpool_cmeta] linear /dev/fast
- [main_corig] linear /dev/slow
+ [fast_cpool_cdata] linear /dev/fast_ssd
+ [fast_cpool_cmeta] linear /dev/fast_ssd
+ [main_corig] linear /dev/slow_hhd
.fi
.B 5. Use the main LV
@@ -120,8 +129,8 @@ attached.
$ lvs -a
LV VG Attr Type Devices
- fast vg -wi------- linear /dev/fast
- main vg -wi------- linear /dev/slow
+ fast vg -wi------- linear /dev/fast_ssd
+ main vg -wi------- linear /dev/slow_hhd
.fi
@@ -137,21 +146,21 @@ attached.
.I LV
.br
-Pass this option a standard LV. With a cachevol, cache data and metadata
-are contained within the single LV. This is used with dm-writecache or
-dm-cache.
+Pass this option a fast LV that should be used to hold the cache. With a
+cachevol, cache data and metadata are stored in different parts of the
+same fast LV. This option can be used with dm-writecache or dm-cache.
.B --cachepool
.IR CachePoolLV | LV
.br
-Pass this option a cache pool object. With a cache pool, lvm places cache
-data and cache metadata on different LVs. The two LVs together are called
-a cache pool. This permits specific placement of data and metadata. A
-cache pool is represented as a special type of LV that cannot be used
-directly. (If a standard LV is passed to this option, lvm will first
-convert it to a cache pool by combining it with another LV to use for
-metadata.) This can be used with dm-cache.
+Pass this option a cachepool LV or a standard LV. When using a cache
+pool, lvm places cache data and cache metadata on different LVs. The two
+LVs together are called a cache pool. This permits specific placement of
+data and metadata. A cache pool is represented as a special type of LV
+that cannot be used directly. If a standard LV is passed with this
+option, lvm will first convert it to a cache pool by combining it with
+another LV to use for metadata. This option can be used with dm-cache.
\&
@@ -267,8 +276,8 @@ LV that references two sub LVs, one for data and one for metadata.
To create a cache pool from two separate LVs:
.nf
-$ lvcreate -n fast -L DataSize vg /dev/fast1
-$ lvcreate -n fastmeta -L MetadataSize vg /dev/fast2
+$ lvcreate -n fast -L DataSize vg /dev/fast_ssd1
+$ lvcreate -n fastmeta -L MetadataSize vg /dev/fast_ssd2
$ lvconvert --type cache-pool --poolmetadata fastmeta vg/fast
.fi
@@ -286,8 +295,8 @@ cache pool LV from the two specified LVs, and use the cache pool to start
caching the main LV.
.nf
-$ lvcreate -n fast -L DataSize vg /dev/fast1
-$ lvcreate -n fastmeta -L MetadataSize vg /dev/fast2
+$ lvcreate -n fast -L DataSize vg /dev/fast_ssd1
+$ lvcreate -n fastmeta -L MetadataSize vg /dev/fast_ssd2
$ lvconvert --type cache --cachepool fast --poolmetadata fastmeta vg/main
.fi
@@ -418,7 +427,7 @@ and metadata LVs, each of the sub-LVs can use raid1.)
.nf
$ lvcreate -n main -L Size vg /dev/slow
-$ lvcreate --type raid1 -m 1 -n fast -L Size vg /dev/fast1 /dev/fast2
+$ lvcreate --type raid1 -m 1 -n fast -L Size vg /dev/ssd1 /dev/ssd2
$ lvconvert --type cache --cachevol fast vg/main
.fi
3 years, 8 months
master - lvmlockd: use ret value in query function
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8810c11bc924e8871f9...
Commit: 8810c11bc924e8871f97aa25c61e73b3b3f1fa87
Parent: 7404216241827d903dcb3ff441bae0c8819309d2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jan 29 10:37:28 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jan 29 10:37:28 2020 -0600
lvmlockd: use ret value in query function
---
lib/locking/lvmlockd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index f396478..cbe2121 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2114,7 +2114,7 @@ static int _query_lock_lv(struct cmd_context *cmd, struct volume_group *vg,
if (result == -ENOENT)
return 1;
- return 1;
+ return ret;
}
/*
3 years, 8 months
master - WHATS_NEW: update
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7404216241827d903dc...
Commit: 7404216241827d903dcb3ff441bae0c8819309d2
Parent: bab3b70e3ae253da39da6fb9146ccf428cdb6ab3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jan 23 10:25:35 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jan 23 10:32:15 2020 +0100
WHATS_NEW: update
---
WHATS_NEW | 2 ++
1 file changed, 2 insertions(+)
diff --git a/WHATS_NEW b/WHATS_NEW
index b7aa4e9..66ea748 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.03.08 -
====================================
+ Accept more output lines from vdo_format.
+ Prohibit reshaping of stacked raid LVs.
Avoid running cache input arg validation when creating vdo pool.
Prevent raid reshaping of stacked volumes.
Added VDO lvmdbusd methods for enable/disable compression & dedupe.
3 years, 8 months
master - tests: add corruption write on PV test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bab3b70e3ae253da39d...
Commit: bab3b70e3ae253da39da6fb9146ccf428cdb6ab3
Parent: ecb77e9db31c88ed1a53e3194366e642f9b04e5a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 20 14:16:13 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jan 23 10:32:15 2020 +0100
tests: add corruption write on PV test
Test a case where PV is readable, but fails on write updating.
Check the failure is reported only for a single PV.
---
test/shell/pv-corruption.sh | 56 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/test/shell/pv-corruption.sh b/test/shell/pv-corruption.sh
new file mode 100644
index 0000000..b3c5059
--- /dev/null
+++ b/test/shell/pv-corruption.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 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
+
+# tests, write failer on PV1 is not reporting errors on PV2 or PV3...
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+# skip test early if there is no 'delay' target available
+aux target_at_least dm-delay 1 1 0 || skip "missing dm-delay target"
+touch HAVE_DM_DELAY
+
+#
+# Main
+#
+aux prepare_devs 3 20
+
+pvcreate -y --setphysicalvolumesize 10m "$dev1"
+pvcreate "$dev2"
+pvcreate "$dev3"
+
+vgcreate $vg "$dev1" "$dev2" "$dev3"
+
+pvs -o +uuid
+
+# Keep device readable, but any write fails
+aux writeerror_dev "$dev1" 0:100
+
+# Suppose to fail, size PV1 is not writable
+not pvresize "$dev1" 2>&1 | tee out
+
+# Output should not complain about any error on pv2 nor pv3
+not grep pv2 out
+not grep pv3 out
+
+# Restore working PV1 back
+aux enable_dev "$dev1"
+
+# FIXME: Takes a lot of time ATM....
+pvck "$dev2"
+
+pvs -o +uuid
+vgdisplay
+
+vgremove $vg
3 years, 8 months
master - tests: writeerror_dev
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ecb77e9db31c88ed1a5...
Commit: ecb77e9db31c88ed1a53e3194366e642f9b04e5a
Parent: cf844941d4f0939a78a9e0d0e0ef932172e55bfb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 20 13:15:46 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jan 23 10:32:15 2020 +0100
tests: writeerror_dev
Intruduce aux function for easy simulation of disk areas,
that are 'normally' readable, but will fail on write.
---
test/lib/aux.sh | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index ea126de..a9d1fe4 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -516,6 +516,8 @@ teardown() {
echo -n "## teardown..."
unset LVM_LOG_FILE_EPOCH
+ test ! -f ERR_DEV || should dmsetup remove $(cat ERR_DEV_NAME)
+
if test -f TESTNAME ; then
if test ! -f SKIP_THIS_TEST ; then
@@ -954,6 +956,8 @@ common_dev_() {
case "$tgtype" in
delay)
echo "$from $len delay $pvdev $(( pos + offset )) $read_ms $pvdev $(( pos + offset )) $write_ms" ;;
+ writeerror)
+ echo "$from $len delay $pvdev $(( pos + offset )) 0 $(cat ERR_DEV) 0 0" ;;
error|zero)
echo "$from $len $tgtype" ;;
esac
@@ -1082,6 +1086,29 @@ error_dev() {
}
#
+# Convert device to device with write errors but normal reads.
+# For this 'delay' dev is used and reroutes 'reads' back to original device
+# and for writes it will use extra new TEST-errordev (huge error target)
+# i.e. writeerror_dev "$dev1" 8:32
+writeerror_dev() {
+ local name=${PREFIX}-errordev
+
+ if test ! -e ERR_DEV; then
+ # delay target is used for error mapping
+ if test ! -f HAVE_DM_DELAY ; then
+ target_at_least dm-delay 1 1 0 || return 0
+ touch HAVE_DM_DELAY
+ fi
+ dmsetup create -u "TEST-$name" "$name" --table "0 4611686018427387904 error"
+ # Take major:minor of our error device
+ echo "$name" > ERR_DEV_NAME
+ dmsetup info -c --noheadings -o major,minor "$name" > ERR_DEV
+ fi
+
+ common_dev_ writeerror "$@"
+}
+
+#
# Convert existing device to a device with zero segments
# Takes the list of pairs of zero segment from:len
# Combination with error or delay is unsupported
3 years, 8 months
master - vdo: adapt for multi line vdo_format output
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cf844941d4f0939a78a...
Commit: cf844941d4f0939a78a9e0d0e0ef932172e55bfb
Parent: d7bf7091c35d3d34aae0d118fa4b78cd30cd4778
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jan 22 12:57:23 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jan 23 10:32:15 2020 +0100
vdo: adapt for multi line vdo_format output
Do not close pipeline after 1st. line parsed from vdo_format.
Also reprint the output for a user so new messages from vdo_format
can be seen by users.
---
lib/metadata/vdo_manip.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
index 26694cc..b690e73 100644
--- a/lib/metadata/vdo_manip.c
+++ b/lib/metadata/vdo_manip.c
@@ -317,15 +317,17 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
}
if (!*logical_size)
- while (fgets(buf, sizeof(buf), f)) {
+ while (!feof(f) && fgets(buf, sizeof(buf), f)) {
/* TODO: Watch out for locales */
if (sscanf(buf, "Logical blocks defaulted to " FMTu64 " blocks", &lb) == 1) {
*logical_size = lb * DM_VDO_BLOCK_SIZE;
log_verbose("Available VDO logical blocks " FMTu64 " (%s).",
lb, display_size(data_lv->vg->cmd, *logical_size));
- break;
- } else
- log_warn("WARNING: Cannot parse output '%s' from %s.", buf, argv[0]);
+ }
+ if ((dpath = strchr(buf, '\n')))
+ *dpath = 0; /* cut last '\n' away */
+ if (buf[0])
+ log_print(" %s", buf); /* Print vdo_format messages */
}
if (!pipe_close(&pdata)) {
@@ -333,6 +335,11 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
return 0;
}
+ if (!*logical_size) {
+ log_error("Number of VDO logical blocks was not provided by vdo_format output.");
+ return 0;
+ }
+
return 1;
}
3 years, 8 months
master - raid: more limitted prohibition of stacked raid usage
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d7bf7091c35d3d34aae...
Commit: d7bf7091c35d3d34aae0d118fa4b78cd30cd4778
Parent: 7078dd01e86b176aa5bcb964f57db4ba108eeb4e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jan 16 16:43:55 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jan 23 10:32:15 2020 +0100
raid: more limitted prohibition of stacked raid usage
We actually need to prohibit only reshaping cases which are
running over multiple commands.
---
lib/metadata/raid_manip.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 4855039..486dea1 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6210,6 +6210,13 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
if (seg_flag) {
if (!(*segtype = get_segtype_from_flag(cmd, seg_flag)))
return_0;
+
+ /* FIXME Can't reshape volume in use - aka not toplevel devices */
+ if (!dm_list_empty(&seg_from->lv->segs_using_this_lv)) {
+ log_error("Can't reshape stacked volume %s.", display_lvname(seg_from->lv));
+ return 0;
+ }
+
if (segtype_sav != *segtype) {
log_warn("Replaced LV type %s%s with possible type %s.",
segtype_sav->name, _get_segtype_alias_str(seg_from->lv, segtype_sav),
@@ -6438,12 +6445,6 @@ int lv_raid_convert(struct logical_volume *lv,
uint32_t available_slvs, removed_slvs;
takeover_fn_t takeover_fn;
- /* FIXME Can't reshape volume in use - aka not toplevel devices */
- if (!dm_list_empty(&lv->segs_using_this_lv)) {
- log_error("Can't reshape stacked volume %s.", display_lvname(lv));
- return 0;
- }
-
/* FIXME If not active, prompt and activate */
/* FIXME Some operations do not require the LV to be active */
/* LV must be active to perform raid conversion operations */
3 years, 8 months
master - man: pvck dump description improvements
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7078dd01e86b176aa5b...
Commit: 7078dd01e86b176aa5bcb964f57db4ba108eeb4e
Parent: d53bfae273677975bd805bfaa3d7e7cd995aaa52
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jan 22 15:01:00 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jan 22 15:01:00 2020 -0600
man: pvck dump description improvements
---
man/pvck.8_des | 60 +++++++++++++++++++++++++++++++++-------------------------
1 file changed, 34 insertions(+), 26 deletions(-)
diff --git a/man/pvck.8_des b/man/pvck.8_des
index 8e81493..b87345e 100644
--- a/man/pvck.8_des
+++ b/man/pvck.8_des
@@ -1,43 +1,49 @@
pvck checks and repairs LVM metadata on PVs.
-.SS Dump
+.SS Dump options
.B headers
.br
-Print header values and warn if any values are incorrect. Checks the
-label_header, pv_header, mda_header(s), and metadata text.
+Print LVM on-disk headers and structures: label_header, pv_header,
+mda_header(s), and metadata text. Warnings are printed if any values are
+incorrect. The label_header and pv_header both exist in a 512 byte
+sector, usually the second sector of the device. An mda_header exists in
+a 512 byte sector at offset 4096 bytes. A second mda_header can
+optionally exist near the end of the device. The metadata text exists in
+an area (about 1MiB by default) immediately following the mda_header
+sector. The metadata text is checked but not printed (see other options).
.B metadata
.br
-Print or save the current metadata text, using headers to locate the
-metadata. If headers are damaged, the metadata may not be found. Use
---settings "mda_num=2" to look in mda2 (the second mda at the end of the
-device (if used). The metadata text is printed to stdout. With --file,
-the metadata text is saved to a file.
+Print the current LVM VG metadata text (or save to a file), using headers
+to locate the latest copy of metadata. If headers are damaged, metadata
+may not be found (see metadata_search). Use --settings "mda_num=2" to
+look in mda2 (the second mda at the end of the device, if used). The
+metadata text is printed to stdout or saved to a file with --file.
.B metadata_all
.br
-List or save all versions of metadata found in the metadata area, using
-headers to locate the metadata. If headers are damaged, the metadata may
-not be found. Use --settings "mda_num=2" as above. All metadata versions
-are listed (add -v to include descriptions and dates in the listing.)
-With -file, all versions are written to a file.
+List all versions of VG metadata found in the metadata area, using headers
+to locate metadata. Full copies of all metadata are saved to a file with
+the --file option. If headers are damaged, metadata may not be found (see
+metadata_search). Use --settings "mda_num=2" as above. Use -v to include
+descriptions and dates when listing metadata versions.
.B metadata_search
.br
-Search for all versions of metadata in the common locations. This does
-not use headers, so it can find metadata even when headers are damaged.
-Use --settings "mda_num=2" as above. All metadata versions are listed
-(add -v to include descriptions and dates in the listing.) With --file,
-all versions are written to a file. To save one copy of metadata, use
---settings "metadata_offset=<offset>", where the offset is taken from the
-dump listing.
+List all versions of VG metadata found in the metadata area, searching
+common locations so metadata can be found if headers are damaged. Full
+copies of all metadata are saved to a file with the --file option. To
+save one specific version of metadata, use --settings
+"metadata_offset=<offset>", where the offset is taken from the list of
+versions found. Use -v to include descriptions and dates when listing
+metadata versions.
.B metadata_area
.br
Save the entire text metadata area to a file without processing.
-.SS Repair
+.SS Repair options
.B --repair
.br
@@ -55,14 +61,15 @@ VG, it is important for the user to determine the correct PV UUID and
specify it in --settings. Otherwise, the wrong PV UUID could be used if
device names have been swapped since the metadata was last written.
-If a PV had no metadata areas and the pv_header is damaged, then the
+If a PV has no metadata areas and the pv_header is damaged, then the
repair will not know to create no metadata areas during repair. It will
by default repair metadata in mda1. To repair with no metadata areas, use
--settings "mda_offset=0 mda_size=0".
There are cases where repair should be run on all PVs in the VG (using the
same metadata file): if all PVs in the VG are damaged, if using an old
-metadata version, or if a backup file is used instead of raw metadata.
+metadata version, or if a backup file is used instead of raw metadata
+(taken from pvck dump.)
Using --repair is equivalent to running --repairtype pv_header followed by
--repairtype metadata.
@@ -102,9 +109,10 @@ print/save one instance of metadata text.
\fBmda_offset=\fP\fIbytes\fP \fBmda_size=\fP\fIbytes\fP
.br
Refers to a metadata area (mda) location and size. An mda includes an
-mda_header and circular text buffer. Setting this forces metadata_search
-look for metadata in the given area instead of the normal locations. When
-set to zero with repair, it indicates no metadata areas should exist.
+mda_header and circular metadata text buffer. Setting this forces
+metadata_search look for metadata in the given area instead of the
+standard locations. When set to zero with repair, it indicates no
+metadata areas should exist.
\fBmda2_offset=\fP\fIbytes\fP \fBmda2_size=\fP\fIbytes\fP
.br
3 years, 8 months
stable-2.02 - tests: partial revert of test change of b6e6ea2d65785f03f3cee7938be635bcb8ad4944
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a1f06e2faebfbc091b4...
Commit: a1f06e2faebfbc091b4bbb900398cda05264c753
Parent: 62888e9c7692443066e90494764791753277f02e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jan 21 17:07:20 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jan 21 17:07:20 2020 +0100
tests: partial revert of test change of b6e6ea2d65785f03f3cee7938be635bcb8ad4944
With the update with commit b6e6ea2d65785f03f3cee7938be635bcb8ad4944
the test file has been updated - however stable branch still has
clvmd & lvmetad so we want to omit runnig unit tests for these runs.
---
test/unit/unit-test.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/test/unit/unit-test.sh b/test/unit/unit-test.sh
index f545f14..e8332d6 100644
--- a/test/unit/unit-test.sh
+++ b/test/unit/unit-test.sh
@@ -13,6 +13,8 @@
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
+SKIP_WITH_LVMETAD=1
+SKIP_WITH_CLVMD=1
SKIP_ROOT_DM_CHECK=1
3 years, 8 months