master - fsadm: all path define MAJOR MINOR
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a1a9ae0aa5fe3379350...
Commit: a1a9ae0aa5fe337935091320b6f27fb053381ff5
Parent: 8ea33b633a1d856a4347f6ecf98a50c1d2b60d76
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 10 15:23:54 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 10 15:40:32 2017 +0200
fsadm: all path define MAJOR MINOR
---
scripts/fsadm.sh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 5574143..534aac1 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -191,6 +191,8 @@ detect_fs() {
/dev/dm-[0-9]*)
read </sys/block/${RVOLUME#/dev/}/dm/name SYSVOLUME 2>&1 && VOLUME="$DM_DEV_DIR/mapper/$SYSVOLUME"
read </sys/block/${RVOLUME#/dev/}/dev MAJORMINOR 2>&1 || error "Cannot get major:minor for \"$VOLUME\"."
+ MAJOR=${MAJORMINOR%%:*}
+ MINOR=${MAJORMINOR##*:}
;;
*)
STAT=$(stat --format "MAJOR=\$((0x%t)) MINOR=\$((0x%T))" ${RVOLUME})
6 years, 11 months
master - fsadm: some cleanup
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8ea33b633a1d856a434...
Commit: 8ea33b633a1d856a4347f6ecf98a50c1d2b60d76
Parent: 1107d483a26a5735de7d740fd3182d2e58960f63
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 10 15:13:35 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 10 15:40:31 2017 +0200
fsadm: some cleanup
Put some extra "" around vars.
Indent.
Error messages with dots.
---
scripts/fsadm.sh | 52 +++++++++++++++++++++++++---------------------------
1 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 0d6c503..5574143 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -187,18 +187,16 @@ detect_fs() {
test -n "$VOLUME" || error "Cannot get readlink \"$1\"."
RVOLUME=$VOLUME
case "$RVOLUME" in
- # hardcoded /dev since udev does not create these entries elsewhere
+ # hardcoded /dev since udev does not create these entries elsewhere
/dev/dm-[0-9]*)
read </sys/block/${RVOLUME#/dev/}/dm/name SYSVOLUME 2>&1 && VOLUME="$DM_DEV_DIR/mapper/$SYSVOLUME"
- read </sys/block/${RVOLUME#/dev/}/dev MAJORMINOR 2>&1 || error "Cannot get major:minor for \"$VOLUME\""
+ read </sys/block/${RVOLUME#/dev/}/dev MAJORMINOR 2>&1 || error "Cannot get major:minor for \"$VOLUME\"."
;;
*)
- STAT=$(stat --format "MAJOR=%t MINOR=%T" ${RVOLUME})
+ STAT=$(stat --format "MAJOR=\$((0x%t)) MINOR=\$((0x%T))" ${RVOLUME})
test -n "$STAT" || error "Cannot get major:minor for \"$VOLUME\"."
- eval $STAT
- MAJOR=$((0x${MAJOR}))
- MINOR=$((0x${MINOR}))
- MAJORMINOR=${MAJOR}:${MINOR}
+ eval "$STAT"
+ MAJORMINOR="${MAJOR}:${MINOR}"
;;
esac
# use null device as cache file to be sure about the result
@@ -207,10 +205,10 @@ detect_fs() {
test -n "$FSTYPE" || error "Cannot get FSTYPE of \"$VOLUME\"."
FSTYPE=${FSTYPE##*TYPE=\"} # cut quotation marks
FSTYPE=${FSTYPE%%\"*}
- verbose "\"$FSTYPE\" filesystem found on \"$VOLUME\""
+ verbose "\"$FSTYPE\" filesystem found on \"$VOLUME\"."
}
-detect_mounted_with_proc_self_mountinfo() {
+detect_mounted_with_proc_self_mountinfo() {
MOUNTED=$("$GREP" "^[0-9]* [0-9]* $MAJORMINOR " "$PROCSELFMOUNTINFO")
# extract 5th field which is mount point
@@ -221,7 +219,7 @@ detect_mounted_with_proc_self_mountinfo() {
test -n "$MOUNTED"
}
-detect_mounted_with_proc_mounts() {
+detect_mounted_with_proc_mounts() {
MOUNTED=$("$GREP" "^$VOLUME[ \t]" "$PROCMOUNTS")
# for empty string try again with real volume name
@@ -245,13 +243,13 @@ detect_mounted_with_proc_mounts() {
# check if the given device is already mounted and where
# FIXME: resolve swap usage and device stacking
-detect_mounted() {
+detect_mounted() {
if test -e "$PROCSELFMOUNTINFO"; then
detect_mounted_with_proc_self_mountinfo
elif test -e "$PROCMOUNTS"; then
detect_mounted_with_proc_mounts
else
- error "Cannot detect mounted device \"$VOLUME\""
+ error "Cannot detect mounted device \"$VOLUME\"."
fi
}
@@ -279,14 +277,14 @@ round_up_block_size() {
}
temp_mount() {
- dry "$MKDIR" -p -m 0000 "$TEMPDIR" || error "Failed to create $TEMPDIR"
- dry "$MOUNT" "$VOLUME" "$TEMPDIR" || error "Failed to mount $TEMPDIR"
+ dry "$MKDIR" -p -m 0000 "$TEMPDIR" || error "Failed to create $TEMPDIR."
+ dry "$MOUNT" "$VOLUME" "$TEMPDIR" || error "Failed to mount $TEMPDIR."
}
temp_umount() {
- dry "$UMOUNT" "$TEMPDIR" || error "Failed to umount \"$TEMPDIR\""
- dry "$RMDIR" "${TEMPDIR}" || error "Failed to remove \"$TEMPDIR\""
- dry "$RMDIR" "${TEMPDIR%%m}" || error "Failed to remove \"${TEMPDIR%%m}\""
+ dry "$UMOUNT" "$TEMPDIR" || error "Failed to umount \"$TEMPDIR\"."
+ dry "$RMDIR" "${TEMPDIR}" || error "Failed to remove \"$TEMPDIR\","
+ dry "$RMDIR" "${TEMPDIR%%m}" || error "Failed to remove \"${TEMPDIR%%m}\"."
}
yes_no() {
@@ -306,11 +304,11 @@ yes_no() {
try_umount() {
yes_no "Do you want to unmount \"$MOUNTED\"" && dry "$UMOUNT" "$MOUNTED" && return 0
- error "Cannot proceed with mounted filesystem \"$MOUNTED\""
+ error "Cannot proceed with mounted filesystem \"$MOUNTED\"."
}
validate_parsing() {
- test -n "$BLOCKSIZE" && test -n "$BLOCKCOUNT" || error "Cannot parse $1 output"
+ test -n "$BLOCKSIZE" && test -n "$BLOCKCOUNT" || error "Cannot parse $1 output."
}
####################################
# Resize ext2/ext3/ext4 filesystem
@@ -380,7 +378,7 @@ resize_xfs() {
MOUNTPOINT=$MOUNTED
if [ -z "$MOUNTED" ]; then
MOUNTPOINT=$TEMPDIR
- temp_mount || error "Cannot mount Xfs filesystem"
+ temp_mount || error "Cannot mount Xfs filesystem."
fi
verbose "Parsing $TUNE_XFS \"$MOUNTPOINT\""
for i in $(LC_ALL=C "$TUNE_XFS" "$MOUNTPOINT"); do
@@ -398,7 +396,7 @@ resize_xfs() {
elif [ $NEWBLOCKCOUNT -eq $BLOCKCOUNT ]; then
verbose "Xfs filesystem already has the right size"
else
- error "Xfs filesystem shrinking is unsupported"
+ error "Xfs filesystem shrinking is unsupported."
fi
}
@@ -418,8 +416,8 @@ resize() {
"ext3"|"ext2"|"ext4") resize_ext $NEWSIZE ;;
"reiserfs") resize_reiser $NEWSIZE ;;
"xfs") resize_xfs $NEWSIZE ;;
- *) error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool" ;;
- esac || error "Resize $FSTYPE failed"
+ *) error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;
+ esac || error "Resize $FSTYPE failed."
cleanup 0
}
@@ -500,12 +498,12 @@ for i in "$TUNE_EXT" "$RESIZE_EXT" "$TUNE_REISER" "$RESIZE_REISER" \
test -n "$i" || error "Required command definitions in the script are missing!"
done
-"$LVM" version >"$NULL" 2>&1 || error "Could not run lvm binary \"$LVM\""
+"$LVM" version >"$NULL" 2>&1 || error "Could not run lvm binary \"$LVM\"."
$("$READLINK" -e / >"$NULL" 2>&1) || READLINK_E="-f"
TEST64BIT=$(( 1000 * 1000000000000 ))
-test "$TEST64BIT" -eq 1000000000000000 || error "Shell does not handle 64bit arithmetic"
-$(echo Y | "$GREP" Y >"$NULL") || error "Grep does not work properly"
-test $("$DATE" -u -d"Jan 01 00:00:01 1970" +%s) -eq 1 || error "Date translation does not work"
+test "$TEST64BIT" -eq 1000000000000000 || error "Shell does not handle 64bit arithmetic."
+$(echo Y | "$GREP" Y >"$NULL") || error "Grep does not work properly."
+test $("$DATE" -u -d"Jan 01 00:00:01 1970" +%s) -eq 1 || error "Date translation does not work."
if [ "$#" -eq 0 ] ; then
6 years, 11 months
master - fsadm: fix test of subshell return value
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1107d483a26a5735de7...
Commit: 1107d483a26a5735de7d740fd3182d2e58960f63
Parent: 455a4de090f10f98ac2932a2540a30b7fdc34f61
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue May 9 20:52:15 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 10 15:40:29 2017 +0200
fsadm: fix test of subshell return value
Subshell is not returning error code value upward thus
error results in this case were actually ignored.
Also add dots to moved error messages.
---
WHATS_NEW | 1 +
scripts/fsadm.sh | 18 ++++++++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0b9fab9..79b6c67 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Properly handle subshell return codes in fsadm.
Disallow cachepool creation with policy cleaner and mode writeback.
Version 2.02.171 - 3rd May 2017
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 26be102..0d6c503 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -183,7 +183,8 @@ decode_size() {
detect_fs() {
VOLUME_ORIG=$1
VOLUME=${1/#"${DM_DEV_DIR}/"/}
- VOLUME=$("$READLINK" $READLINK_E "$DM_DEV_DIR/$VOLUME") || error "Cannot get readlink \"$1\""
+ VOLUME=$("$READLINK" $READLINK_E "$DM_DEV_DIR/$VOLUME")
+ test -n "$VOLUME" || error "Cannot get readlink \"$1\"."
RVOLUME=$VOLUME
case "$RVOLUME" in
# hardcoded /dev since udev does not create these entries elsewhere
@@ -192,7 +193,8 @@ detect_fs() {
read </sys/block/${RVOLUME#/dev/}/dev MAJORMINOR 2>&1 || error "Cannot get major:minor for \"$VOLUME\""
;;
*)
- STAT=$(stat --format "MAJOR=%t MINOR=%T" ${RVOLUME}) || error "Cannot get major:minor for \"$VOLUME\""
+ STAT=$(stat --format "MAJOR=%t MINOR=%T" ${RVOLUME})
+ test -n "$STAT" || error "Cannot get major:minor for \"$VOLUME\"."
eval $STAT
MAJOR=$((0x${MAJOR}))
MINOR=$((0x${MINOR}))
@@ -201,7 +203,8 @@ detect_fs() {
esac
# use null device as cache file to be sure about the result
# not using option '-o value' to be compatible with older version of blkid
- FSTYPE=$("$BLKID" -c "$NULL" -s TYPE "$VOLUME") || error "Cannot get FSTYPE of \"$VOLUME\""
+ FSTYPE=$("$BLKID" -c "$NULL" -s TYPE "$VOLUME")
+ test -n "$FSTYPE" || error "Cannot get FSTYPE of \"$VOLUME\"."
FSTYPE=${FSTYPE##*TYPE=\"} # cut quotation marks
FSTYPE=${FSTYPE%%\"*}
verbose "\"$FSTYPE\" filesystem found on \"$VOLUME\""
@@ -257,10 +260,13 @@ detect_device_size() {
# check if blockdev supports getsize64
"$BLOCKDEV" 2>&1 | "$GREP" getsize64 >"$NULL"
if test $? -eq 0; then
- DEVSIZE=$("$BLOCKDEV" --getsize64 "$VOLUME") || error "Cannot read size of device \"$VOLUME\""
+ DEVSIZE=$("$BLOCKDEV" --getsize64 "$VOLUME")
+ test -n "$DEVSIZE" || error "Cannot read size of device \"$VOLUME\"."
else
- DEVSIZE=$("$BLOCKDEV" --getsize "$VOLUME") || error "Cannot read size of device \"$VOLUME\""
- SSSIZE=$("$BLOCKDEV" --getss "$VOLUME") || error "Cannot block size read device \"$VOLUME\""
+ DEVSIZE=$("$BLOCKDEV" --getsize "$VOLUME")
+ test -n "$DEVSIZE" || error "Cannot read size of device \"$VOLUME\"."
+ SSSIZE=$("$BLOCKDEV" --getss "$VOLUME")
+ test -n "$SSSIZE" || error "Cannot read sector size of device \"$VOLUME\"."
DEVSIZE=$(($DEVSIZE * $SSSIZE))
fi
}
6 years, 11 months
master - dmeventd: restore multiple warnings
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=455a4de090f10f98ac2...
Commit: 455a4de090f10f98ac2932a2540a30b7fdc34f61
Parent: a9940d16fe5251f2f1d7cb008cfd3be1bfb50120
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 19 19:57:00 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 10 15:39:36 2017 +0200
dmeventd: restore multiple warnings
With recent updates for thin pool monitoring in version 169
we lost multiple WARNINGs to be printed in syslog, when
pool crossed 80%, 85%, 90%, 95%, 100%.
Restore this logic as we want to keep user informed more
then just once when 80% boundary is passed.
---
WHATS_NEW_DM | 1 +
daemons/dmeventd/plugins/thin/dmeventd_thin.c | 12 +---
test/shell/thin-dmeventd-warns.sh | 85 +++++++++++++++++++++++++
3 files changed, 90 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index a8b721c..2894d62 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.141 -
===============================
+ Restore Warning by 5% increment when thin-pool is over 80% (1.02.138).
Version 1.02.140 - 3rd May 2017
===============================
diff --git a/daemons/dmeventd/plugins/thin/dmeventd_thin.c b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
index e7d24c5..7fd7b0e 100644
--- a/daemons/dmeventd/plugins/thin/dmeventd_thin.c
+++ b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
@@ -47,10 +47,8 @@ struct dso_state {
struct dm_pool *mem;
int metadata_percent_check;
int metadata_percent;
- int metadata_warn_once;
int data_percent_check;
int data_percent;
- int data_warn_once;
uint64_t known_metadata_size;
uint64_t known_data_size;
unsigned fails;
@@ -253,9 +251,8 @@ void process_event(struct dm_task *dmt,
* action is called for: >50%, >55% ... >95%, 100%
*/
state->metadata_percent = dm_make_percent(tps->used_metadata_blocks, tps->total_metadata_blocks);
- if (state->metadata_percent <= WARNING_THRESH)
- state->metadata_warn_once = 0; /* Dropped bellow threshold, reset warn once */
- else if (!state->metadata_warn_once++) /* Warn once when raised above threshold */
+ if ((state->metadata_percent > WARNING_THRESH) &&
+ (state->metadata_percent > state->metadata_percent_check))
log_warn("WARNING: Thin pool %s metadata is now %.2f%% full.",
device, dm_percent_to_float(state->metadata_percent));
if (state->metadata_percent > CHECK_MINIMUM) {
@@ -269,9 +266,8 @@ void process_event(struct dm_task *dmt,
state->metadata_percent_check = CHECK_MINIMUM;
state->data_percent = dm_make_percent(tps->used_data_blocks, tps->total_data_blocks);
- if (state->data_percent <= WARNING_THRESH)
- state->data_warn_once = 0;
- else if (!state->data_warn_once++)
+ if ((state->data_percent > WARNING_THRESH) &&
+ (state->data_percent > state->data_percent_check))
log_warn("WARNING: Thin pool %s data is now %.2f%% full.",
device, dm_percent_to_float(state->data_percent));
if (state->data_percent > CHECK_MINIMUM) {
diff --git a/test/shell/thin-dmeventd-warns.sh b/test/shell/thin-dmeventd-warns.sh
new file mode 100644
index 0000000..d22863b
--- /dev/null
+++ b/test/shell/thin-dmeventd-warns.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# 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
+
+# test if dmeventd produces multiple warnings when pools runs above 80%
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+SKIP_WITH_CLVMD=1
+SKIP_WITH_LVMETAD=1
+
+. lib/inittest
+
+which blkdiscard || skip
+
+percent_() {
+ get lv_field $vg/pool data_percent | cut -d. -f1
+}
+
+wait_warn_() {
+
+ for i in $(seq 1 7)
+ do
+ test $(egrep "WARNING: Thin pool.*is now" debug.log_DMEVENTD_out | wc -l) -eq $1 && return 0
+ sleep 2
+ done
+
+ die "Waiting too log for dmeventd log warning"
+}
+#
+# Main
+#
+aux have_thin 1 0 0 || skip
+
+aux prepare_dmeventd
+aux prepare_vg
+
+lvcreate -L8 -V8 -T $vg/pool -n $lv1
+
+
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=26
+test $(percent_) -gt 80
+
+# Give it some time to dmeventd to log WARNING
+wait_warn_ 1
+
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30
+test $(percent_) -gt 90
+
+# Give it some time to dmeventd to log WARNING
+wait_warn_ 2
+
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=8
+test $(percent_) -eq 100
+
+wait_warn_ 3
+
+blkdiscard "$DM_DEV_DIR/$vg/$lv1"
+
+# FIXME: Enforce thin-pool metadata commit with flushing status
+dmsetup status ${vg}-pool-tpool
+# Wait for thin-pool monitoring to notice lower values
+sleep 11
+# ATM dmeventd is not logging event for thin-pool getting
+# below 'WARNED' threshold.
+
+
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30
+test $(percent_) -gt 90
+
+lvs -a $vg
+dmsetup status ${vg}-pool-tpool
+
+# Check pool again Warns
+wait_warn_ 4
+
+vgremove -f $vg
6 years, 11 months
master - dmfilemapd: always initialise 'same' local variable (Coverity)
by Bryn Reeves
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a9940d16fe5251f2f1d...
Commit: a9940d16fe5251f2f1d7cb008cfd3be1bfb50120
Parent: c5fee2ee6e483ee9e56d842f402d2de9dfe5151a
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Mon May 8 17:10:25 2017 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Mon May 8 17:10:25 2017 +0100
dmfilemapd: always initialise 'same' local variable (Coverity)
Fix a regression introduced in 70bb726 that allows a local variable
in the monitored file checking routine to be accessed before its
assignment when the file has already been unlinked.
---
daemons/dmfilemapd/dmfilemapd.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c
index bbaabda..2637bd2 100644
--- a/daemons/dmfilemapd/dmfilemapd.c
+++ b/daemons/dmfilemapd/dmfilemapd.c
@@ -562,6 +562,7 @@ static int _filemap_monitor_check_file_unlinked(struct filemap_monitor *fm)
ssize_t len;
fm->deleted = 0;
+ same = 0;
if ((fd = open(fm->path, O_RDONLY)) < 0)
goto check_unlinked;
6 years, 11 months
master - man lvmetad: mention repair as a reason for disabling
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c5fee2ee6e483ee9e56...
Commit: c5fee2ee6e483ee9e56d842f402d2de9dfe5151a
Parent: 405a3689bcc40c8782685a739310e337a7c268a9
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 5 10:48:58 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri May 5 10:48:58 2017 -0500
man lvmetad: mention repair as a reason for disabling
lvconvert --repair now also disables lvmetad.
---
man/lvmetad.8_main | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/man/lvmetad.8_main b/man/lvmetad.8_main
index 31a89cc..ec55171 100644
--- a/man/lvmetad.8_main
+++ b/man/lvmetad.8_main
@@ -53,10 +53,13 @@ metadata.
In some cases, lvmetad will be temporarily disabled while it continues
running. In this state, LVM commands will ignore the lvmetad cache and
revert to scanning disks. A warning will also be printed which includes
-the reason why lvmetad is not being used. The most common reason is the
-existence of duplicate PVs (lvmetad cannot cache data for duplicate PVs.)
-Once duplicates have been resolved, the lvmetad cache is can be updated
-with pvscan --cache and commands will return to using the cache.
+the reason why lvmetad is not being used. The most common reasons are the
+existence of duplicate PVs (lvmetad cannot cache data for duplicate PVs),
+or an 'lvconvert --repair' command has been run (the lvmetad cache may
+not be reliable while repairs are neeeded.)
+Once duplicates have been resolved, or repairs have been completed,
+the lvmetad cache is can be updated with pvscan --cache and commands
+will return to using the cache.
Use of lvmetad is enabled/disabled by:
.br
6 years, 11 months
master - lvmdbustest.py: Add PV symlink testing
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fcce7e16601caf3941f...
Commit: fcce7e16601caf3941fd0d090c03c94ac83a329e
Parent: 97d5e192fe899d6c4d50377205db7b37c116900b
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed May 3 14:07:13 2017 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Fri May 5 10:30:06 2017 -0500
lvmdbustest.py: Add PV symlink testing
We fixed this issue once before and it's back, add a test to make
sure it never comes back again!
https://bugzilla.redhat.com/show_bug.cgi?id=1318754
https://bugzilla.redhat.com/show_bug.cgi?id=1445654
---
test/dbus/lvmdbustest.py | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 50f6ad4..e3eeb6e 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -18,6 +18,8 @@ import pyudev
from testlib import *
import testlib
from subprocess import Popen, PIPE
+from glob import glob
+import os
g_tmo = 0
@@ -1865,6 +1867,46 @@ class TestDbusService(unittest.TestCase):
for i in range(0, 5):
pv_object_path = self._create_nested(pv_object_path)
+ def test_pv_symlinks(self):
+ # Lets take one of our test PVs, pvremove it, find a symlink to it
+ # and re-create using the symlink to ensure we return an object
+ # path to it. Additionally, we will take the symlink and do a lookup
+ # (Manager.LookUpByLvmId) using it and the original device path to
+ # ensure that we can find the PV.
+ symlink = None
+
+ pv = self.objs[PV_INT][0]
+ pv_device_path = pv.Pv.Name
+
+ self._pv_remove(pv)
+
+ # Make sure we no longer find the pv
+ rc = self._lookup(pv_device_path)
+ self.assertEqual(rc, '/')
+
+ # Lets locate a symlink for it
+ devices = glob('/dev/disk/*/*')
+ for d in devices:
+ if pv_device_path == os.path.realpath(d):
+ symlink = d
+ break
+
+ self.assertIsNotNone(symlink, "We expected to find at least 1 symlink!")
+
+ # Make sure symlink look up fails too
+ rc = self._lookup(symlink)
+ self.assertEqual(rc, '/')
+
+ pv_object_path = self._pv_create(symlink)
+ self.assertNotEqual(pv_object_path, '/')
+
+ pv_proxy = ClientProxy(self.bus, pv_object_path, interfaces=(PV_INT, ))
+ self.assertEqual(pv_proxy.Pv.Name, pv_device_path)
+
+ # Lets check symlink lookup
+ self.assertEqual(pv_object_path, self._lookup(symlink))
+ self.assertEqual(pv_object_path, self._lookup(pv_device_path))
+
class AggregateResults(object):
6 years, 11 months
master - lvmdbusd: Correct PV lookups
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=405a3689bcc40c87826...
Commit: 405a3689bcc40c8782685a739310e337a7c268a9
Parent: fcce7e16601caf3941fd0d090c03c94ac83a329e
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed May 3 13:06:10 2017 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Fri May 5 10:30:06 2017 -0500
lvmdbusd: Correct PV lookups
When a user does a Manager.PvCreate they can specify the block device using a
device path that may be different than what lvm reports is the device path. For
example a user could use:
/dev/disk/by-id/wwn-0x5002538500000000 instead of /dev/sdc
In this case the pvcreate will succeed, but when we query lvm we don't find the
newly created PV. We fail because it's device path is returned as /dev/sdc. This
change re-uses an internal lookup which can accommodate this and correctly find
the newly created PV.
Corrects https://bugzilla.redhat.com/show_bug.cgi?id=1445654
---
daemons/lvmdbusd/objectmanager.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/daemons/lvmdbusd/objectmanager.py b/daemons/lvmdbusd/objectmanager.py
index a9d13a7..563b9ec 100644
--- a/daemons/lvmdbusd/objectmanager.py
+++ b/daemons/lvmdbusd/objectmanager.py
@@ -223,8 +223,9 @@ class ObjectManager(AutomatedProperties):
:param lvm_id: The lvm identifier
"""
with self.rlock:
- if lvm_id in self._id_to_object_path:
- return self.get_object_by_path(self._id_to_object_path[lvm_id])
+ lookup_rc = self._id_lookup(lvm_id)
+ if lookup_rc:
+ return self.get_object_by_path(lookup_rc)
return None
def get_object_path_by_lvm_id(self, lvm_id):
@@ -234,8 +235,9 @@ class ObjectManager(AutomatedProperties):
:return: Object path or '/' if not found
"""
with self.rlock:
- if lvm_id in self._id_to_object_path:
- return self._id_to_object_path[lvm_id]
+ lookup_rc = self._id_lookup(lvm_id)
+ if lookup_rc:
+ return lookup_rc
return '/'
def _uuid_verify(self, path, uuid, lvm_id):
6 years, 11 months
master - WHATS_NEW: cache pool options
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=97d5e192fe899d6c4d5...
Commit: 97d5e192fe899d6c4d50377205db7b37c116900b
Parent: df5fd5ae8843e6bbbe7f61c4919a594693639a60
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 5 10:02:54 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri May 5 10:02:54 2017 -0500
WHATS_NEW: cache pool options
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 003a9c7..0b9fab9 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Disallow cachepool creation with policy cleaner and mode writeback.
Version 2.02.171 - 3rd May 2017
===============================
6 years, 11 months
master - lvcreate: cachemode writeback and cachepolicy cleaner is invalid
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=df5fd5ae8843e6bbbe7...
Commit: df5fd5ae8843e6bbbe7f61c4919a594693639a60
Parent: 7fbeea30e5ce4dbb4877910877575ed6c37dfb8c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 5 09:59:12 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri May 5 09:59:12 2017 -0500
lvcreate: cachemode writeback and cachepolicy cleaner is invalid
Return an error if lvconvert is used to create a cache pool
with that combination.
---
tools/toollib.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index f3cf4ca..e5a854f 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1335,9 +1335,17 @@ int get_stripe_params(struct cmd_context *cmd, const struct segment_type *segtyp
return _validate_stripe_params(cmd, segtype, stripes, stripe_size);
}
-static int _validate_cachepool_params(const char *name,
- const struct dm_config_tree *settings)
+static int _validate_cachepool_params(const char *policy_name, cache_mode_t cache_mode)
{
+ /*
+ * FIXME: it might be nice if cmd def rules could check option values,
+ * then a rule could do this.
+ */
+ if ((cache_mode == CACHE_MODE_WRITEBACK) && policy_name && !strcmp(policy_name, "cleaner")) {
+ log_error("Cache mode \"writeback\" is not compatible with cache policy \"cleaner\".");
+ return 0;
+ }
+
return 1;
}
@@ -1371,6 +1379,9 @@ int get_cache_params(struct cmd_context *cmd,
*name = arg_str_value(cmd, cachepolicy_ARG, NULL);
+ if (!_validate_cachepool_params(*name, *cache_mode))
+ goto_out;
+
dm_list_iterate_items(group, &cmd->arg_value_groups) {
if (!grouped_arg_is_set(group->arg_values, cachesettings_ARG))
continue;
@@ -1401,9 +1412,6 @@ int get_cache_params(struct cmd_context *cmd,
cn->child = result->root;
result->root = cn;
}
-
- if (!_validate_cachepool_params(*name, result))
- goto_out;
}
ok = 1;
6 years, 11 months