master - blkdeactivate: add -m|--mpathoption disablequeueing and use it for blk-availability systemd service and initscript
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=42e76a1920c9ee...
Commit: 42e76a1920c9ee1ae13a3ca4ba2fdd96cad8fe3f
Parent: 9f7e8f22dc42576875a436dee0034d37f89c468c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jul 12 09:52:18 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 12 10:01:07 2016 +0200
blkdeactivate: add -m|--mpathoption disablequeueing and use it for blk-availability systemd service and initscript
blkdeactivate -m disablequeueing causes "multipathd disablequeueing maps"
call inside blkdeactivate script before deactivating devices. This
avoids a situation where blkdeactivate may wait for paths to appear if
multipath is set to queueing and there's a stack of other devices and/or
mount points on top of such multipath device.
See also https://bugzilla.redhat.com/show_bug.cgi?id=1344381.
---
WHATS_NEW_DM | 2 +
man/blkdeactivate.8.in | 12 ++++
scripts/blk_availability_init_red_hat.in | 2 +-
.../blk_availability_systemd_red_hat.service.in | 2 +-
scripts/blkdeactivate.sh.in | 58 ++++++++++++++++----
5 files changed, 64 insertions(+), 12 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 40452a1..a1d41b4 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,7 @@
Version 1.02.131 -
================================
+ Disable queueing on mpath devs in blk-availability systemd service/initscript.
+ Add new -m|--mpathoption disablequeueing to blkdeactivate.
Automatically group regions with 'create --segments' unless --nogroup.
Fix resource leak when deleting the first member of a group.
Allow --bounds with 'create --filemap' for dmstats.
diff --git a/man/blkdeactivate.8.in b/man/blkdeactivate.8.in
index 2eb4c6f..8bb10b5 100644
--- a/man/blkdeactivate.8.in
+++ b/man/blkdeactivate.8.in
@@ -7,6 +7,7 @@ blkdeactivate \(em utility to deactivate block devices
.RB [ \-e ]
.RB [ \-h ]
.RB [ \-l \ \fIlvm_options\fP ]
+.RB [ \-m \ \fImpath_options\fP ]
.RB [ \-u ]
.RB [ \-v ]
.RI [ device ]
@@ -51,6 +52,16 @@ Deactivating Volume Group as a whole takes less time than deactivating each
Logical Volume separately.
.RE
.TP
+.BR \-m ", " \-\-mpathoption \ \fImpath_options\fP
+Comma separated list of device-mapper multipath specific options:
+.RS
+.IP \fIdisablequeueing\fP
+Disable queueing on all multipath devices first before deactivation.
+This avoids a situation where blkdeactivate may end up waiting if
+all paths are unavailable for any underlying device-mapper multipath
+device.
+.RE
+.TP
.BR \-u ", " \-\-umount
Unmount a mounted device before trying to deactivate it.
Without this option used, a device that is mounted is not deactivated.
@@ -90,4 +101,5 @@ of device-mapper devices in case the deactivation fails and force removal.
.BR lsblk (8),
.BR lvm (8),
.BR mdadm (8),
+.BR multipathd (8),
.BR umount (8)
diff --git a/scripts/blk_availability_init_red_hat.in b/scripts/blk_availability_init_red_hat.in
index 3bf2abf..a84ffe7 100644
--- a/scripts/blk_availability_init_red_hat.in
+++ b/scripts/blk_availability_init_red_hat.in
@@ -33,7 +33,7 @@
sbindir=@sbindir@
script=blkdeactivate
-options="-u -l wholevg"
+options="-u -l wholevg -m disablequeueing"
LOCK_FILE="/var/lock/subsys/blk-availability"
diff --git a/scripts/blk_availability_systemd_red_hat.service.in b/scripts/blk_availability_systemd_red_hat.service.in
index 3506738..cc4c678 100644
--- a/scripts/blk_availability_systemd_red_hat.service.in
+++ b/scripts/blk_availability_systemd_red_hat.service.in
@@ -7,7 +7,7 @@ Conflicts=shutdown.target
[Service]
Type=oneshot
ExecStart=/usr/bin/true
-ExecStop=@sbindir@/blkdeactivate -u -l wholevg
+ExecStop=@sbindir@/blkdeactivate -u -l wholevg -m disablequeueing
RemainAfterExit=yes
[Install]
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index b4c3237..de74756 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -38,6 +38,7 @@ UMOUNT="/bin/umount"
DMSETUP="@sbindir@/dmsetup"
LVM="@sbindir@/lvm"
MDADM="@sbindir@/mdadm"
+MPATHD="/sbin/multipathd"
if $UMOUNT --help | grep -- "--all-targets" >$DEV_DIR/null; then
UMOUNT_OPTS="--all-targets "
@@ -49,6 +50,7 @@ fi
DMSETUP_OPTS=""
LVM_OPTS=""
MDADM_OPTS=""
+MPATHD_OPTS=""
LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
LSBLK_VARS="local devtype local kname local name local mnt"
@@ -68,6 +70,9 @@ LVM_DO_WHOLE_VG=0
# Do not retry LV deactivation by default.
LVM_CONFIG="activation{retry_deactivation=0}"
+# Do not disable queueing if set on multipath devices.
+MPATHD_DO_DISABLEQUEUEING=0
+
#
# List of device names and/or VGs to be skipped.
# Device name is the KNAME from lsblk output.
@@ -107,20 +112,23 @@ usage() {
echo " If devices are specified, deactivate only supplied devices and their holders."
echo
echo " Options:"
- echo " -e | --errors Show errors reported from tools"
- echo " -h | --help Show this help message"
- echo " -d | --dmoption DM_OPTIONS Comma separated DM specific options"
- echo " -l | --lvmoption LVM_OPTIONS Comma separated LVM specific options"
- echo " -u | --umount Unmount the device if mounted"
- echo " -v | --verbose Verbose mode (also implies -e)"
+ echo " -e | --errors Show errors reported from tools"
+ echo " -h | --help Show this help message"
+ echo " -d | --dmoption DM_OPTIONS Comma separated DM specific options"
+ echo " -l | --lvmoption LVM_OPTIONS Comma separated LVM specific options"
+ echo " -m | --mpathoption MPATH_OPTIONS Comma separated DM-multipath specific options"
+ echo " -u | --umount Unmount the device if mounted"
+ echo " -v | --verbose Verbose mode (also implies -e)"
echo
echo " Device specific options:"
echo " DM_OPTIONS:"
- echo " retry retry removal several times in case of failure"
- echo " force force device removal"
+ echo " retry retry removal several times in case of failure"
+ echo " force force device removal"
echo " LVM_OPTIONS:"
- echo " retry retry removal several times in case of failure"
- echo " wholevg deactivate the whole VG when processing an LV"
+ echo " retry retry removal several times in case of failure"
+ echo " wholevg deactivate the whole VG when processing an LV"
+ echo " MPATH_OPTIONS:"
+ echo " disablequeueing disable queueing on all DM-multipath devices first"
exit
}
@@ -312,6 +320,11 @@ deactivate_all() {
echo "Deactivating block devices:"
+ test $MPATHD_RUNNING -eq 1 && {
+ echo -n " [DM]: disabling queueing on all multipath devices... "
+ eval $MPATHD $MPATHD_OPTS disablequeueing maps $ERR | grep '^ok$' >$DEV_DIR/null && echo "done" || echo "failed"
+ }
+
if test $# -eq 0; then
#######################
# Process all devices #
@@ -406,6 +419,20 @@ get_lvmopts() {
IFS=$ORIG_IFS
}
+get_mpathopts() {
+ ORIG_IFS=$IFS; IFS=','
+
+ for opt in $1; do
+ case "$opt" in
+ "") ;;
+ "disablequeueing") MPATHD_DO_DISABLEQUEUEING=1 ;;
+ *) echo "$opt: unknown DM-multipath option"
+ esac
+ done
+
+ IFS=$ORIG_IFS
+}
+
set_env() {
if test "$ERRORS" -eq "1"; then
unset ERR
@@ -419,6 +446,7 @@ set_env() {
DMSETUP_OPTS+="-vvvv"
LVM_OPTS+="-vvvv"
MDADM_OPTS+="-vv"
+ MPATHD_OPTS+="-v 3"
else
OUT="1>$DEV_DIR/null"
fi
@@ -434,6 +462,15 @@ set_env() {
else
MDADM_AVAILABLE=0
fi
+
+ MPATHD_RUNNING=0
+ test $MPATHD_DO_DISABLEQUEUEING -eq 1 && {
+ if test -f $MPATHD; then
+ if eval $MPATHD show daemon $ERR | grep "running" >$DEVDIR/null; then
+ MPATHD_RUNNING=1
+ fi
+ fi
+ }
}
while test $# -ne 0; do
@@ -443,6 +480,7 @@ while test $# -ne 0; do
"-h"|"--help") usage ;;
"-d"|"--dmoption ") get_dmopts "$2" ; shift ;;
"-l"|"--lvmoption ") get_lvmopts "$2" ; shift ;;
+ "-m"|"--mpathoption ") get_mpathopts "$2" ; shift ;;
"-u"|"--umount") DO_UMOUNT=1 ;;
"-v"|"--verbose") VERBOSE=1 ; ERRORS=1 ;;
"-vv") VERBOSE=1 ; ERRORS=1 ; set -x ;;
7 years, 10 months
master - lvconvert: remove some FIXME comments
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9f7e8f22dc4257...
Commit: 9f7e8f22dc42576875a436dee0034d37f89c468c
Parent: c526c327d7352e60eb19a739a2f394e2744c5629
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Jul 8 15:31:27 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 11 10:29:10 2016 -0500
lvconvert: remove some FIXME comments
---
tools/lvconvert.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 0319601..72dc381 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3653,8 +3653,6 @@ static int _convert_mirror_linear(struct cmd_context *cmd, struct logical_volume
/*
* Convert mirror LV to raid1 LV.
* lvconvert --type raid1 LV
- *
- * FIXME: this is not yet implemented in the raid code.
*/
static int _convert_mirror_raid(struct cmd_context *cmd, struct logical_volume *lv,
@@ -3846,8 +3844,6 @@ static int _convert_raid_raid(struct cmd_context *cmd, struct logical_volume *lv
/*
* Convert a raid* LV to a striped LV.
* lvconvert --type striped LV
- *
- * FIXME: this is not yet implemented in the raid code.
*/
static int _convert_raid_striped(struct cmd_context *cmd, struct logical_volume *lv,
@@ -3859,8 +3855,6 @@ static int _convert_raid_striped(struct cmd_context *cmd, struct logical_volume
/*
* Convert a raid* LV to a linear LV.
* lvconvert --type linear LV
- *
- * FIXME: this is not yet implemented in the raid code.
*/
static int _convert_raid_linear(struct cmd_context *cmd, struct logical_volume *lv,
7 years, 10 months
master - man: lvconvert changes
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c526c327d7352e...
Commit: c526c327d7352e60eb19a739a2f394e2744c5629
Parent: 06a9dab730f5b1636c19ffd47124d76e60447efd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Jul 8 15:22:31 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 11 10:29:07 2016 -0500
man: lvconvert changes
---
man/lvconvert.8.in | 110 +++++++++++++++++++++++++++++++++++++---------------
1 files changed, 79 insertions(+), 31 deletions(-)
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index e85fe96..f51ad61 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -87,13 +87,16 @@ avoid the direct use of hidden LVs.
.B lvconvert \-\-merge
VG/StripedLV
+./" FIXME: use --merge-mirror
.br
\[bu]
Merge StripedLV into an LV when it is a previously split mirror.
.br
\[bu]
-See --splitmirror.
-./" FIXME: use --merge-mirror
+See corresponding operation --splitmirrors.
+.br
+\[bu]
+Also see \-\-background, \-\-interval.
.B lvconvert \-\-type snapshot
VG/StripedLV VG/SnapshotLV
@@ -102,7 +105,7 @@ VG/StripedLV VG/SnapshotLV
Recombine StripedLV with SnapshotLV which was previously split.
.br
\[bu]
-See --splitsnapshot.
+See corresponding operation --splitsnapshot.
.B lvconvert \-\-type thin
VG/StripedLV
@@ -111,13 +114,13 @@ VG/StripedLV
Convert StripedLV to type thin with an external origin.
.br
\[bu]
-Also specify a thin pool to use, see \-\-thinpool.
+Requires \-\-thinpool to specify the thin pool to use.
.br
\[bu]
StripedLV becomes a read\-only external origin LV with a new name.
.br
\[bu]
-See \-\-originname.
+Also see \-\-originname.
.B lvconvert \-\-type cache
VG/StripedLV
@@ -126,19 +129,28 @@ VG/StripedLV
Convert StripedLV to type cache.
.br
\[bu]
-Also specify a cache pool to use, see \-\-cachepool.
+Requires \-\-cachepool to specify the cache pool to use.
+.br
+\[bu]
+Also see \-\-cachepolicy, \-\-cachesettings.
.B lvconvert \-\-type thin\-pool
VG/StripedLV
.br
\[bu]
Convert StripedLV to type thin\-pool.
+.br
+\[bu]
+Also see \-\-chunksize, \-\-discards, \-\-zero, \-\-poolmetadata{size}.
.B lvconvert \-\-type cache\-pool
VG/StripedLV
.br
\[bu]
Convert StripedLV to type cache\-pool.
+.br
+\[bu]
+Also see \-\-chunksize, \-\-poolmetadata{size}.
.B lvconvert \-\-type mirror
VG/StripedLV
@@ -147,7 +159,7 @@ VG/StripedLV
Convert StripedLV to type mirror.
.br
\[bu]
-Also specify the number of mirrors, see \-\-mirrors.
+Requires \-\-mirrors to specify the number of mirrors to use.
.B lvconvert \-\-type raid*
VG/StripedLV
@@ -156,7 +168,7 @@ VG/StripedLV
Convert StripedLV to type raid*.
.br
\[bu]
-Also specify the number of mirrors, see \-\-mirrors.
+Required options depend on the raid level, see lvmraid(7).
.SS Operations on RaidLV with type raid*:
@@ -177,17 +189,20 @@ VG/RaidLV
Split images from raid1 RaidLV and use them to create a new LV.
.br
\[bu]
-Also specify \-\-name for new LV, or use \-\-trackchanges.
+Requires \-\-name for the new LV, or the use of \-\-trackchanges.
.B lvconvert \-\-merge
VG/RaidLV
+./" FIXME: use --merge-mirror
.br
\[bu]
Merge RaidLV into an LV when it is a previously split mirror.
.br
\[bu]
-See --splitmirror.
-./" FIXME: use --merge-mirror
+See corresponding operation --splitmirrors.
+.br
+\[bu]
+Also see \-\-background, \-\-interval.
.B lvconvert \-\-repair
VG/RaidLV
@@ -216,7 +231,7 @@ VG/SnapshotLV
Combine RaidLV with SnapshotLV that was previously split.
.br
\[bu]
-See \-\-splitsnapshot.
+See corresponding operation \-\-splitsnapshot.
.B lvconvert \-\-type thin
VG/RaidLV
@@ -225,13 +240,13 @@ VG/RaidLV
Convert RaidLV to type thin with an external origin.
.br
\[bu]
-Also specify a thin pool to use, see \-\-thinpool.
+Requires \-\-thinpool to specify the thin pool to use.
.br
\[bu]
RaidLV becomes a read\-only external origin LV with a new name.
.br
\[bu]
-See \-\-originname.
+Also see \-\-originname.
.B lvconvert \-\-type cache
VG/RaidLV
@@ -240,25 +255,37 @@ VG/RaidLV
Convert RaidLV to type cache.
.br
\[bu]
-Also specify a cache pool to use, see \-\-cachepool.
+Requires \-\-cachepool to specify the cache pool to use.
+.br
+\[bu]
+Also see \-\-cachepolicy, \-\-cachesettings.
.B lvconvert \-\-type thin\-pool
VG/RaidLV
.br
\[bu]
Convert RaidLV to type thin\-pool.
+.br
+\[bu]
+Also see \-\-chunksize, \-\-discards, \-\-zero, \-\-poolmetadata{size}.
.B lvconvert \-\-type cache\-pool
VG/RaidLV
.br
\[bu]
Convert RaidLV to type cache\-pool.
+.br
+\[bu]
+Also see \-\-chunksize, \-\-poolmetadata{size}.
.B lvconvert \-\-type raid*
VG/RaidLV
.br
\[bu]
Convert RaidLV to use a different raid level.
+.br
+\[bu]
+Required options depend on the raid level, see lvmraid(7).
.B lvconvert \-\-type striped
VG/RaidLV
@@ -291,7 +318,7 @@ VG/MirrorLV
Split images from MirrorLV and use them to create a new LV.
.br
\[bu]
-Also specify \-\-name for new LV.
+Requires \-\-name for the new LV.
.B lvconvert \-\-mirrorlog
LogType
@@ -299,9 +326,6 @@ VG/MirrorLV
.br
\[bu]
Change the type of log used by MirrorLV.
-.br
-\[bu]
-See --mirrorlog and --corelog for log types.
.B lvconvert \-\-repair
VG/MirrorLV
@@ -322,7 +346,7 @@ VG/MirrorLV
Convert MirrorLV to type raid*.
.br
\[bu]
-See lvmraid(7) for permitted raid levels.
+Required options depend on the raid level, see lvmraid(7).
.SS Operations on CachePoolLV with type cache\-pool:
@@ -364,7 +388,7 @@ Split images from the mirrored origin of CacheLV to create a new LV.
Operates on mirror or raid1 sub LV.
.br
\[bu]
-Also specify \-\-name for new LV, or use \-\-trackchanges.
+Requires \-\-name for the new LV, or the use of \-\-trackchanges.
.B lvconvert \-\-type thin\-pool
VG/CacheLV
@@ -374,6 +398,9 @@ Convert CacheLV to type thin-pool.
.br
\[bu]
The CacheLV is used for thin pool data.
+.br
+\[bu]
+Also see \-\-chunksize, \-\-discards, \-\-zero, \-\-poolmetadata{size}.
.SS Operations on ThinPoolLV with type thin\-pool:
@@ -412,6 +439,9 @@ Convert the data portion of ThinPoolLV to type cache.
.br
\[bu]
Operates on the data sub LV of the thin pool LV.
+.br
+\[bu]
+Also see \-\-cachepolicy, \-\-cachesettings.
.B lvconvert \-\-repair
VG/ThinPoolLV
@@ -425,13 +455,16 @@ Repair ThinPoolLV.
.B lvconvert \-\-merge
VG/ThinLV
+./" FIXME: use --merge-snapshot
.br
\[bu]
Merge ThinLV into its origin LV.
.br
\[bu]
ThinLV must have been created as a snapshot of another thin LV.
-./" FIXME: use --merge-snapshot
+.br
+\[bu]
+Also see \-\-background, \-\-interval.
.SS Operations on SnapshotLV with type snapshot:
@@ -445,10 +478,13 @@ Separate COW snapshot SnapshotLV from its origin LV.
.B lvconvert \-\-merge
VG/SnapshotLV
+./" FIXME: use --merge-snapshot
.br
\[bu]
Merge COW snapshot SnapshotLV into its origin.
-./" FIXME: use --merge-snapshot
+.br
+\[bu]
+Also see \-\-background, \-\-interval.
.SH OPTIONS
.
@@ -528,6 +564,8 @@ It is an alias for \fB\-\-mirrorlog core\fP.
Specifies if discards will be processed by the thin layer in the
kernel and passed down to the Physical Volume. This applies only
to thin pools. The default is \fBpassdown\fP.
+Also see
+.BR lvmthin (7).
.
.HP
.BR \-i ,
@@ -700,6 +738,8 @@ Use \fB\-f\fP if you do not want any replacement. You may use
\fB\-\-use\-policies\fP to use the device replacement policy specified in
\fBlvm.conf\fP(5), see \fBactivation/mirror_log_fault_policy\fP or
\fBactivation/mirror_device_fault_policy\fP.
+Also see
+.BR lvmraid (7).
When used with a thin pool LV, this option automates the use of the
\fBthin_repair\fP(8) tool on the thin pool. This repairs a very limitted
@@ -707,6 +747,8 @@ number of problems. Only inactive thin pools can be repaired. There is
no validation of metadata between kernel and LVM. This requires further
manual work. After successfull repair the old unmodified metadata are
still available in "<pool>_meta<n>" LV.
+Also see
+.BR lvmthin (7).
.
.HP
.BR \-\-replace
@@ -726,14 +768,16 @@ for specific limits on device replacement for each raid level.
Separates \fISplitableLogicalVolume\fP.
This option tries to detect the necessary split operation from its arguments.
Avoid using this option and use one of the following instead:
-.B \-\-splitcache, \-\-splitmirror, \-\-splitsnapshot.
+.B \-\-splitcache, \-\-splitmirrors, \-\-splitsnapshot.
.
.HP
.BR \-\-splitcache
.br
Separates a cache pool from a cache LV, and keeps the unused cache pool
-LV. Before the separation, the cache is flushed. Also see
+LV. Before the separation, the cache is flushed. See similar option
.B \-\-uncache.
+Also see
+.BR lvmcache (7).
.
.HP
.BR \-\-splitmirrors
@@ -756,7 +800,7 @@ required without \fB\-\-trackchanges\fP).
Separates a COW snapshot from its origin LV. The LV that is split off
contains the chunks that differ from the origin LV along with metadata
describing them. This LV can be wiped and then destroyed with lvremove.
-Also see
+See corresponding operation
.B lvconvert \-\-type snapshot.
.
.HP
@@ -764,10 +808,10 @@ Also see
.IR Number
.br
Specifies the number of stripes in a striped LV. This is the number of
-physical volumes (devices) a striped LV is spread across. Data that
-appears sequential in the LV is spread (striped) across multiple devices
-in units of the stripe size (see below). This does not apply to existing
-allocated space, only newly allocated space can be striped.
+physical volumes (devices) that a striped LV is spread across. Data that
+appears sequential in the LV is spread across multiple devices in units of
+the stripe size (see \fB\-\-stripesize\fP). This does not apply to
+existing allocated space, only newly allocated space can be striped.
.
.HP
.BR \-I ,
@@ -809,8 +853,10 @@ to the \fBraid1\fP LV type.)
.BR \-\-uncache
.br
Separates a cache pool from a cache LV, and removes the unused cache pool
-LV. Before the separation, the cache is flushed. Also see
+LV. Before the separation, the cache is flushed. See similar option
.B \-\-splitcache.
+Also see
+.BR lvmcache (7).
.
.HP
.BR \-Z ,
@@ -822,6 +868,8 @@ snapshot. If the LV is read\-only, the snapshot will not be zeroed.
For thin pools, this controls zeroing of provisioned blocks.
Provisioning of large zeroed chunks negatively impacts performance.
+Also see
+.BR lvmthin (7).
.
.SS Option aliases
7 years, 10 months
master - tests: skip some tests for older cache driver
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=06a9dab730f5b1...
Commit: 06a9dab730f5b1636c19ffd47124d76e60447efd
Parent: 6336b5dedf2a7adbc32fb7ae4f7f7aa1d9cda75a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 11 15:45:28 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 11 15:45:28 2016 +0200
tests: skip some tests for older cache driver
Cache target 1.4 on f19 kernel shows error, skipping some tests...
---
test/shell/lvchange-cache.sh | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvchange-cache.sh b/test/shell/lvchange-cache.sh
index 06d2f09..25c59b1 100644
--- a/test/shell/lvchange-cache.sh
+++ b/test/shell/lvchange-cache.sh
@@ -68,6 +68,10 @@ grep 'migration_threshold=2048' out
grep 'sequential_threshold=13' out
grep 'random_threshold=4' out
+# Skip these test on older cache driver as it shows errors with these lvchanges
+# device-mapper: space map common: index_check failed: blocknr 17179869216 != wanted 11
+if aux have_cache 1 5 0 ; then
+
lvchange --cachesettings migration_threshold=233 --cachesettings sequential_threshold=13 --cachesettings random_threshold=1 $vg/corigin
get lv_field $vg/corigin kernel_cache_settings | tee out
grep 'migration_threshold=233' out
@@ -80,6 +84,8 @@ grep 'migration_threshold=2048' out
grep 'sequential_threshold=13' out
grep 'random_threshold=4' out
+fi
+
else
# When MQ is emulated by SMQ policy it does not hold settings.
# So just skip testing of param changes when sequential_threshold=0
7 years, 10 months
master - tests: reduce amount of pvcreates
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6336b5dedf2a7a...
Commit: 6336b5dedf2a7adbc32fb7ae4f7f7aa1d9cda75a
Parent: 8756297a8d39d33766f1f19060749b9570d76b1a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 11 15:29:28 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 11 15:29:28 2016 +0200
tests: reduce amount of pvcreates
Reduce number of evualted pvcreate commands.
Since 0 is default value used to fill missing params,
and 0 is also 1st. value in array, it's being tested.
Drop unused data_alignment_offset.
---
test/api/python_lvm_unit.py | 21 +++------------------
1 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/test/api/python_lvm_unit.py b/test/api/python_lvm_unit.py
index d715231..75c370e 100755
--- a/test/api/python_lvm_unit.py
+++ b/test/api/python_lvm_unit.py
@@ -906,7 +906,6 @@ class TestLvm(unittest.TestCase):
pvmeta_copies = [0, 1, 2]
pvmeta_size = [0, 255, 512, 1024]
data_alignment = [0, 2048, 4096]
- data_alignment_offset = [1, 1, 1]
zero = [0, 1]
device_names = TestLvm._get_pv_device_names()
@@ -927,27 +926,13 @@ class TestLvm(unittest.TestCase):
#Try a number of combinations and permutations
for s in size:
- lvm.pvCreate(d, s)
- lvm.pvRemove(d)
for copies in pvmeta_copies:
- lvm.pvCreate(d, s, copies)
- lvm.pvRemove(d)
for pv_size in pvmeta_size:
- lvm.pvCreate(d, s, copies, pv_size)
- lvm.pvRemove(d)
for align in data_alignment:
- lvm.pvCreate(d, s, copies, pv_size, align)
- lvm.pvRemove(d)
- for align_offset in data_alignment_offset:
- lvm.pvCreate(
- d, s, copies, pv_size, align,
- align * align_offset)
+ for z in zero:
+ lvm.pvCreate(d, s, copies, pv_size, align,
+ align, z)
lvm.pvRemove(d)
- for z in zero:
- lvm.pvCreate(
- d, s, copies, pv_size, align,
- align * align_offset, z)
- lvm.pvRemove(d)
#Restore
for d in device_names:
7 years, 10 months
master - tests: increase max lines for clvmd
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8756297a8d39d3...
Commit: 8756297a8d39d33766f1f19060749b9570d76b1a
Parent: 34c55d98eefd88f85476c0f62f0649c706bde6f0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 11 14:45:25 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 11 14:45:25 2016 +0200
tests: increase max lines for clvmd
Clvmd is a bit more verbose long time running process so
let it live with more logged lines.
Also fix typo in warn message from last commit.
---
lib/log/log.c | 2 +-
test/lib/aux.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/log/log.c b/lib/log/log.c
index 434b8d0..6d5fc59 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -116,7 +116,7 @@ void init_log_file(const char *log_file, int append)
if ((env = getenv("LVM_LOG_FILE_MAX_LINES"))) {
if (sscanf(env, FMTu64, &_log_file_max_lines) != 1) {
- log_warn("WARNING: Ingnoring incorrect LVM_LOG_MAX_LINES envvar \"%s\".", env);
+ log_warn("WARNING: Ignoring invalid LVM_LOG_MAX_LINES envvar \"%s\".", env);
_log_file_max_lines = 0;
}
_log_file_lines = 0;
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 7724723..90f2ab1 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -169,7 +169,7 @@ prepare_clvmd() {
rm -f "$CLVMD_PIDFILE"
echo "<======== Starting CLVMD ========>"
# lvs is executed from clvmd - use our version
- LVM_LOG_FILE_EPOCH=CLVMD LVM_BINARY=$(which lvm) $run_valgrind clvmd -Isinglenode -d 1 -f &
+ LVM_LOG_FILE_EPOCH=CLVMD LVM_LOG_FILE_MAX_LINES=1000000 LVM_BINARY=$(which lvm) $run_valgrind clvmd -Isinglenode -d 1 -f &
echo $! > LOCAL_CLVMD
for i in {1..100} ; do
7 years, 10 months
master - tests: add LVM_LOG_FILE_MAX_LINES
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=34c55d98eefd88...
Commit: 34c55d98eefd88f85476c0f62f0649c706bde6f0
Parent: 309bdfa22417cf77e7be2349c414295d83d47fbc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 11 12:43:28 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 11 12:43:28 2016 +0200
tests: add LVM_LOG_FILE_MAX_LINES
When logging to epoch files we would like to prevent creating too large
log files otherwise a spining command could fulfill available space
very easily and quickly.
Limit for to 100000 per command.
---
WHATS_NEW | 1 +
lib/log/log.c | 13 +++++++++++++
man/lvm.8.in | 5 +++++
test/lib/inittest.sh | 1 +
4 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5be0449..5653b13 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.161 -
================================
+ New LVM_LOG_FILE_MAX_LINES env var to limit max size of created logs.
Version 2.02.160 - 6th July 2016
================================
diff --git a/lib/log/log.c b/lib/log/log.c
index 30d71ef..434b8d0 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -31,6 +31,8 @@ static struct dm_str_list _log_dev_alias;
static int _syslog = 0;
static int _log_to_file = 0;
+static uint64_t _log_file_max_lines = 0;
+static uint64_t _log_file_lines = 0;
static int _log_direct = 0;
static int _log_while_suspended = 0;
static int _indent = 1;
@@ -111,6 +113,14 @@ void init_log_file(const char *log_file, int append)
if (st && fclose(st))
log_sys_debug("fclose", statfile);
+
+ if ((env = getenv("LVM_LOG_FILE_MAX_LINES"))) {
+ if (sscanf(env, FMTu64, &_log_file_max_lines) != 1) {
+ log_warn("WARNING: Ingnoring incorrect LVM_LOG_MAX_LINES envvar \"%s\".", env);
+ _log_file_max_lines = 0;
+ }
+ _log_file_lines = 0;
+ }
}
no_epoch:
@@ -487,6 +497,9 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
fputc('\n', _log_file);
fflush(_log_file);
+
+ if (_log_file_max_lines && ++_log_file_lines >= _log_file_max_lines)
+ fatal_internal_error = 1;
}
if (_syslog && (_log_while_suspended || !critical_section())) {
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 729518b..82d0558 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -778,6 +778,11 @@ followed by the process ID and a startup timestamp using
this format string "_%s_%d_%llu". When set, each process logs to a
separate file.
.TP
+.B LVM_LOG_FILE_MAX_LINES
+A max number of lines to be printed to log file before
+the application aborts. Useful for testing to prevent creation
+of too big log files from spinning command.
+.TP
.B LVM_EXPECTED_EXIT_STATUS
The status anticipated when the process exits. Use ">N" to match any
status greater than N. If the actual exit status matches and a log
diff --git a/test/lib/inittest.sh b/test/lib/inittest.sh
index a453ee6..dcc1304 100644
--- a/test/lib/inittest.sh
+++ b/test/lib/inittest.sh
@@ -58,6 +58,7 @@ RUNNING_DMEVENTD=$(pgrep dmeventd || true)
export TESTOLDPWD TESTDIR COMMON_PREFIX PREFIX RUNNING_DMEVENTD
export LVM_LOG_FILE_EPOCH=DEBUG
+export LVM_LOG_FILE_MAX_LINES=100000
export LVM_EXPECTED_EXIT_STATUS=1
test -n "$BASH" && trap 'set +vx; STACKTRACE; set -vx' ERR
7 years, 10 months
master - libdm: add configure.in checks for fiemap.h and magic.h
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=309bdfa22417cf...
Commit: 309bdfa22417cf77e7be2349c414295d83d47fbc
Parent: 61cb58e549e5ff55095733bc3c7277c83584e5a0
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Fri Jul 8 23:38:32 2016 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Fri Jul 8 23:42:32 2016 +0100
libdm: add configure.in checks for fiemap.h and magic.h
---
configure | 2 +-
configure.in | 2 +-
include/configure.h.in | 6 ++++++
libdm/libdm-stats.c | 29 ++++++++++++++++++++++++++---
4 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/configure b/configure
index 83d5964..8253bfc 100755
--- a/configure
+++ b/configure
@@ -5875,7 +5875,7 @@ fi
done
-for ac_header in termios.h sys/statvfs.h sys/timerfd.h
+for ac_header in termios.h sys/statvfs.h sys/timerfd.h linux/magic.h linux/fiemap.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/configure.in b/configure.in
index b87f8ff..33b5c76 100644
--- a/configure.in
+++ b/configure.in
@@ -103,7 +103,7 @@ AC_CHECK_HEADERS([assert.h ctype.h dirent.h errno.h fcntl.h float.h \
sys/time.h sys/types.h sys/utsname.h sys/wait.h time.h \
unistd.h], , [AC_MSG_ERROR(bailing out)])
-AC_CHECK_HEADERS(termios.h sys/statvfs.h sys/timerfd.h)
+AC_CHECK_HEADERS(termios.h sys/statvfs.h sys/timerfd.h linux/magic.h linux/fiemap.h)
case "$host_os" in
linux*)
diff --git a/include/configure.h.in b/include/configure.h.in
index d94d55d..3c43bd5 100644
--- a/include/configure.h.in
+++ b/include/configure.h.in
@@ -264,9 +264,15 @@
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
+/* Define to 1 if you have the <linux/fiemap.h> header file. */
+#undef HAVE_LINUX_FIEMAP_H
+
/* Define to 1 if you have the <linux/fs.h> header file. */
#undef HAVE_LINUX_FS_H
+/* Define to 1 if you have the <linux/magic.h> header file. */
+#undef HAVE_LINUX_MAGIC_H
+
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 612f9bf..57ef11d 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -21,9 +21,18 @@
#include <sys/ioctl.h>
#include <sys/vfs.h> /* fstatfs */
-#include <linux/fs.h> /* FS_IOC_FIEMAP */
-#include <linux/fiemap.h> /* fiemap */
-#include <linux/magic.h> /* BTRFS_SUPER_MAGIC */
+
+#ifdef __linux__
+ #include <linux/fs.h> /* FS_IOC_FIEMAP */
+#endif
+
+#ifdef HAVE_LINUX_FIEMAP_H
+ #include <linux/fiemap.h> /* fiemap */
+#endif
+
+#ifdef HAVE_LINUX_MAGIC_H
+ #include <linux/magic.h> /* BTRFS_SUPER_MAGIC */
+#endif
#define DM_STATS_REGION_NOT_PRESENT UINT64_MAX
#define DM_STATS_GROUP_NOT_PRESENT DM_STATS_GROUP_NONE
@@ -4064,6 +4073,7 @@ int dm_stats_get_group_descriptor(const struct dm_stats *dms,
return 1;
}
+#ifdef HAVE_LINUX_FIEMAP_H
/*
* Group a table of region_ids corresponding to the extents of a file.
*/
@@ -4258,6 +4268,7 @@ static uint64_t *_stats_create_file_regions(struct dm_stats *dms, int fd,
struct statfs fsbuf;
struct stat buf;
+#ifdef BTRFS_SUPER_MAGIC
if (fstatfs(fd, &fsbuf)) {
log_error("fstatfs failed for fd %d", fd);
return 0;
@@ -4268,6 +4279,7 @@ static uint64_t *_stats_create_file_regions(struct dm_stats *dms, int fd,
"physical FIEMAP extent data.");
return 0;
}
+#endif
if (fstat(fd, &buf)) {
log_error("fstat failed for fd %d", fd);
@@ -4360,6 +4372,17 @@ out:
return NULL;
}
+#else /* HAVE_LINUX_FIEMAP */
+uint64_t *dm_stats_create_regions_from_fd(struct dm_stats *dms, int fd,
+ int group, int precise,
+ struct dm_histogram *bounds,
+ const char *alias)
+{
+ log_error("File mapping requires FIEMAP ioctl support.");
+ return 0;
+}
+#endif /* HAVE_LINUX_FIEMAP */
+
/*
* Backward compatible dm_stats_create_region() implementations.
*
7 years, 10 months
master - libdm: use 'goto_bad' if extent pool allocation fails
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=61cb58e549e5ff...
Commit: 61cb58e549e5ff55095733bc3c7277c83584e5a0
Parent: feb69966d404346208f460f2b5c45d85783cc1ce
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Fri Jul 8 22:28:50 2016 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Fri Jul 8 22:28:50 2016 +0100
libdm: use 'goto_bad' if extent pool allocation fails
Generate a backtrace if unable to extend the extent table.
---
libdm/libdm-stats.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index a5358bf..612f9bf 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4208,7 +4208,7 @@ static struct _extent *_stats_get_extents_for_file(struct dm_pool *mem, int fd,
tot_extents++;
if (!_stats_add_extent(mem, fm_ext + i,
tot_extents - 1))
- goto bad;
+ goto_bad;
} else {
expected = 0;
if (!tot_extents)
@@ -4216,7 +4216,7 @@ static struct _extent *_stats_get_extents_for_file(struct dm_pool *mem, int fd,
if (fm_ext[i].fe_logical == 0)
if (!_stats_add_extent(mem, fm_ext + i,
tot_extents - 1))
- goto bad;
+ goto_bad;
}
num += tot_extents;
if (fm_ext[i].fe_flags & FIEMAP_EXTENT_LAST)
7 years, 10 months
master - libdm: use macro for boundary test in _stats_get_extents_for_file()
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=feb69966d40434...
Commit: feb69966d404346208f460f2b5c45d85783cc1ce
Parent: 74565e41fc55a99c2c7b750225fd3a616ea84648
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Fri Jul 8 22:21:14 2016 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Fri Jul 8 22:21:14 2016 +0100
libdm: use macro for boundary test in _stats_get_extents_for_file()
---
libdm/libdm-stats.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index bf9b7e3..a5358bf 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4137,6 +4137,12 @@ static int _stats_add_extent(struct dm_pool *mem, struct fiemap_extent *fm_ext,
}
+/* test for the boundary of an extent */
+#define ext_boundary(ext, exp, exp_dense) \
+(((ext).fe_logical != 0) && \
+((ext).fe_physical != (exp)) && \
+((ext).fe_physical != (exp_dense)))
+
/*
* Read the extents of an open file descriptor into a table of struct _extent.
*
@@ -4198,9 +4204,7 @@ static struct _extent *_stats_get_extents_for_file(struct dm_pool *mem, int fd,
fm_last.fe_length;
expected = fm_last.fe_physical +
fm_ext[i].fe_logical - fm_last.fe_logical;
- if ((fm_ext[i].fe_logical != 0)
- && (fm_ext[i].fe_physical != expected)
- && (fm_ext[i].fe_physical != expected_dense)) {
+ if (ext_boundary(fm_ext[i], expected, expected_dense)) {
tot_extents++;
if (!_stats_add_extent(mem, fm_ext + i,
tot_extents - 1))
7 years, 10 months