Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2444e830a90fe84721bd6…
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
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bab3b70e3ae253da39da6…
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
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ecb77e9db31c88ed1a53e…
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
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7078dd01e86b176aa5bcb…
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
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a1f06e2faebfbc091b4bb…
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