master - tests: allow override of LVM_LOG_FILE_MAX_LINES
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1e80ec892615f9da897...
Commit: 1e80ec892615f9da897da518cb3c55261d2bd51e
Parent: 04186616bef6789d6f363a1d461c01d344616c7a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 26 13:58:43 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 26 14:04:58 2017 +0200
tests: allow override of LVM_LOG_FILE_MAX_LINES
Just like with other vars support this:
make check_local T=xyz LVM_LOG_FILE_MAX_LINES=10000000
Allows easily to override existing line limit.
Also increase limiting size of logs per command since some of
our commands are becoming very verbose....
---
test/lib/inittest.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/inittest.sh b/test/lib/inittest.sh
index a33748d..78bd987 100644
--- a/test/lib/inittest.sh
+++ b/test/lib/inittest.sh
@@ -84,7 +84,7 @@ RUNNING_DMEVENTD=$(pgrep dmeventd || true)
export TESTOLDPWD TESTDIR COMMON_PREFIX PREFIX RUNNING_DMEVENTD
LVM_LOG_FILE_EPOCH=DEBUG
-LVM_LOG_FILE_MAX_LINES=100000
+LVM_LOG_FILE_MAX_LINES=${LVM_LOG_FILE_MAX_LINES-1000000}
LVM_EXPECTED_EXIT_STATUS=1
export LVM_LOG_FILE_EPOCH LVM_LOG_FILE_MAX_LINES LVM_EXPECTED_EXIT_STATUS
6 years, 6 months
master - Makefile: help shows hint about LVM_LOG_FILE_MAX_LINES
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=04186616bef6789d6f3...
Commit: 04186616bef6789d6f363a1d461c01d344616c7a
Parent: 837bfab75c712c28c161309f1381bb7a84eb17fb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 26 13:57:51 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 26 14:04:58 2017 +0200
Makefile: help shows hint about LVM_LOG_FILE_MAX_LINES
---
test/Makefile.in | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index c3285e4..230ce5b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -114,8 +114,9 @@ help:
@echo " LVM_STRACE Enable strace logging."
@echo " LVM_DEBUG_LEVEL Sets debuging level for valgrind/strace (use > 0)."
@echo " LVM_VERIFY_UDEV Default verify state for lvm.conf."
- @echo " S Skip given test (regex)."
- @echo " T Run given test (regex)."
+ @echo " LVM_LOG_FILE_MAX_LINES Maximum number of logged lines for lvm2 command [1000000]."
+ @echo " S Skip given test(s) (regex)."
+ @echo " T Run given test(s) (regex)."
@echo " VERBOSE Verbose output (1), timing (2)."
check: .tests-stamp
6 years, 6 months
master - log: better message when reached log limit
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=837bfab75c712c28c16...
Commit: 837bfab75c712c28c161309f1381bb7a84eb17fb
Parent: 1758614f9648d4dfba91377336c60aaf3cc5265c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 26 13:55:36 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 26 14:04:58 2017 +0200
log: better message when reached log limit
Add explaining message, when command was aborted due to the reach
of configure line number count (LVM_LOG_FILE_MAX_LINES)
for logging (used mainly with testing).
---
lib/log/log.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/log/log.c b/lib/log/log.c
index 8ca60e4..c0789b4 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -646,11 +646,16 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
vfprintf(_log_file, trformat, ap);
va_end(ap);
+ if (_log_file_max_lines && ++_log_file_lines >= _log_file_max_lines) {
+ fprintf(_log_file, "\n%s:%d %sAborting. Command has reached limit "
+ "for logged lines (LVM_LOG_FILE_MAX_LINES=" FMTu64 ").",
+ file, line, _msg_prefix,
+ _log_file_max_lines);
+ fatal_internal_error = 1;
+ }
+
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())) {
6 years, 6 months
master - WHATS_NEW: missed
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1758614f9648d4dfba9...
Commit: 1758614f9648d4dfba91377336c60aaf3cc5265c
Parent: 44c4fe8e61e4ae43e7513130bc62f1a584879b2e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 26 14:02:44 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 26 14:04:58 2017 +0200
WHATS_NEW: missed
Last patch missed to mention, we've improved/fixed generated paths
in units and init.d shell scripts when lvm2 was plainly configured
with just i.e. --prefix.
Note: some distros might have fully specified --sbindir and
--usrsbindir - thus those very not seeing problems in generated paths.
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 78a8052..55e06f6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.176 -
===================================
+ Improve used paths for generated systemd units and init shells.
Disallow creation of snapshot of mirror/raid subLV (was never supported).
Fix regression in more advanced vgname extraction in lvconvert (2.02.169).
Allow lvcreate to be used for caching of _tdata LV.
6 years, 6 months
master - shellcheck: some apostrophe changes and cleanups
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=35df4b10eb17065f893...
Commit: 35df4b10eb17065f893bbf96cba01efdb9f46e4a
Parent: 34618c2d3061e7f9f563d4c9ad9a185c77935f0e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 25 17:02:31 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Oct 25 22:02:54 2017 +0200
shellcheck: some apostrophe changes and cleanups
---
scripts/blk_availability_init_red_hat.in | 8 +++---
scripts/blkdeactivate.sh.in | 2 +-
scripts/clvmd_init_red_hat.in | 32 ++++++++++++------------
scripts/cmirrord_init_red_hat.in | 18 +++++++-------
scripts/lvm2_cluster_activation_red_hat.sh.in | 16 ++++++------
scripts/lvm2_lvmetad_init_red_hat.in | 11 ++++----
scripts/lvm2_lvmpolld_init_red_hat.in | 11 ++++----
scripts/lvm2_monitoring_init_red_hat.in | 14 +++++-----
scripts/vgimportclone.sh | 8 +++---
9 files changed, 59 insertions(+), 61 deletions(-)
diff --git a/scripts/blk_availability_init_red_hat.in b/scripts/blk_availability_init_red_hat.in
index 52399fb..347c395 100644
--- a/scripts/blk_availability_init_red_hat.in
+++ b/scripts/blk_availability_init_red_hat.in
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-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
@@ -40,12 +40,12 @@ LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/blk-availability"
case "$1" in
start)
- touch $LOCK_FILE
+ touch "$LOCK_FILE"
;;
stop)
- action "Stopping block device availability:" $sbindir/$script $options
- rm -f $LOCK_FILE
+ action "Stopping block device availability:" "$sbindir/$script" $options
+ rm -f "$LOCK_FILE"
;;
status)
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index 4680f16..cfec0af 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -300,7 +300,7 @@ deactivate_md () {
echo -n " [MD]: deactivating $devtype device $kname... "
test "$MDRAID_DO_WAIT" -eq 1 && {
- sync_action="$(cat $SYS_BLK_DIR/$kname/md/sync_action)"
+ sync_action=$(cat "$SYS_BLK_DIR/$kname/md/sync_action")
test "$sync_action" != "idle" && {
echo -n "$sync_action action in progress... "
if eval "$MDADM" $MDADM_OPTS -W "$DEV_DIR/$kname" "$OUT" "$ERR"; then
diff --git a/scripts/clvmd_init_red_hat.in b/scripts/clvmd_init_red_hat.in
index e5fbe04..fff7912 100644
--- a/scripts/clvmd_init_red_hat.in
+++ b/scripts/clvmd_init_red_hat.in
@@ -23,15 +23,15 @@ DAEMON=clvmd
sbindir="@SBINDIR@"
usrsbindir="@USRSBINDIR@"
-lvm_vgchange=${sbindir}/vgchange
-lvm_vgs=${sbindir}/vgs
-lvm_vgscan=${sbindir}/vgscan
-lvm_lvs=${sbindir}/lvs
+lvm_vgchange="$sbindir/vgchange"
+lvm_vgs="$sbindir/vgs"
+lvm_vgscan="$sbindir/vgscan"
+lvm_lvs="$sbindir/lvs"
CLVMDOPTS="-T30"
[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
-[ -f /etc/sysconfig/$DAEMON ] && . /etc/sysconfig/$DAEMON
+[ -f "/etc/sysconfig/$DAEMON" ] && . "/etc/sysconfig/$DAEMON"
[ -n "$CLVMD_CLUSTER_IFACE" ] && CLVMDOPTS="$CLVMDOPTS -I $CLVMD_CLUSTER_IFACE"
@@ -43,15 +43,15 @@ CLVMDOPTS="-T30"
LOCK_FILE="/var/lock/subsys/$DAEMON"
clustered_vgs() {
- ${lvm_vgs} --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null
+ "$lvm_vgs" --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null
}
clustered_active_lvs() {
- ${lvm_lvs} --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null
+ "$lvm_lvs" --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null
}
rh_status() {
- status $DAEMON
+ status "$DAEMON"
}
rh_status_q() {
@@ -81,11 +81,11 @@ start()
# Ideally vgscan should have a startup mode that would not print
# unnecessary warnings.
- ${lvm_vgscan} > /dev/null 2>&1
+ "$lvm_vgscan" > /dev/null 2>&1
- action "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $?
+ action "Activating VG(s):" "$lvm_vgchange" -aay $LVM_VGS || return $?
- touch $LOCK_FILE
+ touch "$LOCK_FILE"
return 0
}
@@ -108,10 +108,10 @@ stop()
[ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)"
if [ -n "$LVM_VGS" ]; then
- action "Deactivating clustered VG(s):" ${lvm_vgchange} -anl $LVM_VGS || return $?
+ action "Deactivating clustered VG(s):" "$lvm_vgchange" -anl $LVM_VGS || return $?
fi
- action "Signaling $DAEMON to exit" kill -TERM $(pidofproc $DAEMON) || return $?
+ action "Signaling $DAEMON to exit" kill -TERM "$(pidofproc "$DAEMON")" || return $?
# wait half second before we start the waiting loop or we will show
# the loop more time than really necessary
@@ -131,7 +131,7 @@ stop()
echo
fi
- rm -f $LOCK_FILE
+ rm -f "$LOCK_FILE"
return 0
}
@@ -156,7 +156,7 @@ restart() {
stop && start
return $?
else
- touch $LOCK_FILE
+ touch "$LOCK_FILE"
return 0
fi
}
@@ -197,7 +197,7 @@ case "$1" in
status)
rh_status
rtrn=$?
- if [ $rtrn = 0 ]; then
+ if [ "$rtrn" = 0 ]; then
cvgs="$(clustered_vgs)"
echo Clustered Volume Groups: ${cvgs:-"(none)"}
clvs="$(clustered_active_lvs)"
diff --git a/scripts/cmirrord_init_red_hat.in b/scripts/cmirrord_init_red_hat.in
index 7b1df06..c82f8f5 100755
--- a/scripts/cmirrord_init_red_hat.in
+++ b/scripts/cmirrord_init_red_hat.in
@@ -25,8 +25,8 @@ LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
start()
{
rtrn=0
- if ! pidof $DAEMON > /dev/null
- then
+ if ! pidof "$DAEMON" > /dev/null
+ then
echo -n "Starting $DAEMON: "
daemon "$usrsbindir/$DAEMON"
rtrn=$?
@@ -39,7 +39,7 @@ start()
stop()
{
echo -n "Stopping $DAEMON:"
- killproc $DAEMON -TERM
+ killproc "$DAEMON" -TERM
rtrn=$?
echo
@@ -55,8 +55,8 @@ wait_for_finish()
sleep 1
count=$((count + 1))
done
-
- if [ `pidof $DAEMON` ]
+
+ if [ "$(pidof "$DAEMON")" ]
then
return 1
else
@@ -66,7 +66,7 @@ wait_for_finish()
cmirror_status()
{
- status $DAEMON
+ status "$DAEMON"
}
rtrn=1
@@ -76,13 +76,13 @@ case "$1" in
start)
start
rtrn=$?
- [ $rtrn = 0 ] && touch $LOCK_FILE
+ [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
;;
stop)
stop
rtrn=$?
- [ $rtrn = 0 ] && rm -f $LOCK_FILE
+ [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
;;
restart)
@@ -97,7 +97,7 @@ case "$1" in
status)
cmirror_status
rtrn=$?
- if [ $rtrn -eq 0 ]; then
+ if [ "$rtrn" -eq 0 ]; then
echo "cmirror is running."
fi
;;
diff --git a/scripts/lvm2_cluster_activation_red_hat.sh.in b/scripts/lvm2_cluster_activation_red_hat.sh.in
index 6dacf91..e600745 100644
--- a/scripts/lvm2_cluster_activation_red_hat.sh.in
+++ b/scripts/lvm2_cluster_activation_red_hat.sh.in
@@ -2,13 +2,13 @@
sbindir="@SBINDIR@"
-lvm_vgchange="${sbindir}/vgchange"
-lvm_vgscan="${sbindir}/vgscan"
-lvm_vgs="${sbindir}/vgs"
-lvm_lvm="${sbindir}/lvm"
+lvm_vgchange="$sbindir/vgchange"
+lvm_vgscan="$sbindir/vgscan"
+lvm_vgs="$sbindir/vgs"
+lvm_lvm="$sbindir/lvm"
clustered_vgs() {
- "${lvm_vgs}" --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null
+ "$lvm_vgs" --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null
}
activate() {
@@ -19,13 +19,13 @@ activate() {
if [ -z "$obtain_device_list_from_udev" ] || [ "$obtain_device_list_from_udev" -ne 1 ]; then
echo -n "lvm.conf option obtain_device_list_from_udev!=1: Executing vgscan"
- "${lvm_vgscan}" > /dev/null 2>&1
+ "$lvm_vgscan" > /dev/null 2>&1
fi
echo -n "Activating ${LVM_VGS:-"all VG(s)"}: "
# Respect activation/auto_activation_volume_list!
# Call "-aay" which is equal to "-aly" but respects this list.
- "${lvm_vgchange}" -aay $LVM_VGS || return 1
+ "$lvm_vgchange" -aay $LVM_VGS || return 1
return 0
}
@@ -38,7 +38,7 @@ deactivate()
[ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)"
if [ -n "$LVM_VGS" ]; then
echo -n "Deactivating clustered VG(s): "
- "${lvm_vgchange}" -anl $LVM_VGS || return 1
+ "$lvm_vgchange" -anl $LVM_VGS || return 1
fi
return 0
diff --git a/scripts/lvm2_lvmetad_init_red_hat.in b/scripts/lvm2_lvmetad_init_red_hat.in
index 9a6c4f8..daec7ac 100644
--- a/scripts/lvm2_lvmetad_init_red_hat.in
+++ b/scripts/lvm2_lvmetad_init_red_hat.in
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-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
@@ -41,7 +41,7 @@ LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
PID_FILE="@LVMETAD_PIDFILE@"
rh_status() {
- status -p $PID_FILE $DAEMON
+ status -p "$PID_FILE" "$DAEMON"
}
rh_status_q() {
@@ -55,11 +55,10 @@ start()
return $ret
}
-
stop()
{
ret=0
- action "Signaling LVM metadata daemon to exit:" killproc -p $PID_FILE $DAEMON -TERM || ret=$?
+ action "Signaling LVM metadata daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
return $ret
}
@@ -71,14 +70,14 @@ case "$1" in
rh_status_q && exit 0
start
rtrn=$?
- [ $rtrn = 0 ] && touch $LOCK_FILE
+ [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
;;
stop|force-stop)
rh_status_q || exit 0
stop
rtrn=$?
- [ $rtrn = 0 ] && rm -f $LOCK_FILE
+ [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
;;
restart)
diff --git a/scripts/lvm2_lvmpolld_init_red_hat.in b/scripts/lvm2_lvmpolld_init_red_hat.in
index 05f8b08..176ff5d 100644
--- a/scripts/lvm2_lvmpolld_init_red_hat.in
+++ b/scripts/lvm2_lvmpolld_init_red_hat.in
@@ -43,7 +43,7 @@ LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/$DAEMON"
PID_FILE="@LVMPOLLD_PIDFILE@"
rh_status() {
- status -p $PID_FILE $DAEMON
+ status -p "$PID_FILE" "$DAEMON"
}
rh_status_q() {
@@ -57,12 +57,11 @@ start()
return $ret
}
-
stop()
{
ret=0
- action "Signaling LVM poll daemon to exit:" killproc -p $PID_FILE $DAEMON -TERM || ret=$?
- return $ret
+ action "Signaling LVM poll daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
+ return "$ret"
}
rtrn=1
@@ -73,14 +72,14 @@ case "$1" in
rh_status_q && exit 0
start
rtrn=$?
- [ $rtrn = 0 ] && touch $LOCK_FILE
+ [ $rtrn = 0 ] && touch "$LOCK_FILE"
;;
stop|force-stop)
rh_status_q || exit 0
stop
rtrn=$?
- [ $rtrn = 0 ] && rm -f $LOCK_FILE
+ [ $rtrn = 0 ] && rm -f "$LOCK_FILE"
;;
restart)
diff --git a/scripts/lvm2_monitoring_init_red_hat.in b/scripts/lvm2_monitoring_init_red_hat.in
index 3b0d542..95e4125 100644
--- a/scripts/lvm2_monitoring_init_red_hat.in
+++ b/scripts/lvm2_monitoring_init_red_hat.in
@@ -47,7 +47,7 @@ WARN=1
export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
rh_status() {
- status -p $PID_FILE $DMEVENTD_DAEMON
+ status -p "$PID_FILE" "$DMEVENTD_DAEMON"
}
rh_status_q() {
@@ -60,7 +60,7 @@ start()
VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' 2> /dev/null`
for vg in $VGSLIST
do
- action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y --poll y --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' $vg || ret=$?
+ action "Starting monitoring for VG $vg:" "$VGCHANGE" --monitor y --poll y --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' $vg || ret=$?
done
return $ret
@@ -78,7 +78,7 @@ stop()
VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' 2> /dev/null`
for vg in $VGSLIST
do
- action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' $vg || ret=$?
+ action "Stopping monitoring for VG $vg:" "$VGCHANGE" --monitor n --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' $vg || ret=$?
done
return $ret
}
@@ -91,7 +91,7 @@ case "$1" in
rh_status_q && exit 0
start
rtrn=$?
- [ $rtrn = 0 ] && touch $LOCK_FILE
+ [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
;;
force-stop)
@@ -99,7 +99,7 @@ case "$1" in
WARN=0
stop
rtrn=$?
- [ $rtrn = 0 ] && rm -f $LOCK_FILE
+ [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
;;
stop)
@@ -108,7 +108,7 @@ case "$1" in
test "$runlevel" = "6" && WARN=0
stop
rtrn=$?
- [ $rtrn = 0 ] && rm -f $LOCK_FILE
+ [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
;;
restart)
@@ -123,7 +123,7 @@ case "$1" in
status)
rh_status
rtrn=$?
- [ $rtrn = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
+ [ "$rtrn" = 0 ] && "$LVS" -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
;;
*)
diff --git a/scripts/vgimportclone.sh b/scripts/vgimportclone.sh
index 061d0d3..d56827f 100755
--- a/scripts/vgimportclone.sh
+++ b/scripts/vgimportclone.sh
@@ -83,12 +83,12 @@ function usage {
function cleanup {
#set to use old lvm.conf
- LVM_SYSTEM_DIR=${ORIG_LVM_SYS_DIR}
+ LVM_SYSTEM_DIR=$ORIG_LVM_SYS_DIR
if [ "$KEEP_TMP_LVM_SYSTEM_DIR" -eq 1 ]; then
echo "${SCRIPTNAME}: LVM_SYSTEM_DIR (${TMP_LVM_SYSTEM_DIR}) must be cleaned up manually."
else
- "$RM" -rf -- "${TMP_LVM_SYSTEM_DIR}"
+ "$RM" -rf -- "$TMP_LVM_SYSTEM_DIR"
fi
}
@@ -309,11 +309,11 @@ done <<< "$(echo "$VGLIST")"
### Restore the old environment
#####################################################################
### set to use old lvm.conf
-if [ -z "${ORIG_LVM_SYS_DIR}" ]
+if [ -z "$ORIG_LVM_SYS_DIR" ]
then
unset LVM_SYSTEM_DIR
else
- LVM_SYSTEM_DIR=${ORIG_LVM_SYS_DIR}
+ LVM_SYSTEM_DIR=$ORIG_LVM_SYS_DIR
fi
### update the device cache and make sure all
6 years, 6 months
master - commands: drop secondary for lvconvert --type snapshot
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=44c4fe8e61e4ae43e75...
Commit: 44c4fe8e61e4ae43e7513130bc62f1a584879b2e
Parent: 35df4b10eb17065f893bbf96cba01efdb9f46e4a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 25 19:56:40 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Oct 25 22:02:54 2017 +0200
commands: drop secondary for lvconvert --type snapshot
Both form were marked and secondary thus none of the supported
syntax entered manpage.
This restores appearance of snapshot conversion in man page.
---
tools/command-lines.in | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 265bda8..d0e5e06 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -633,7 +633,6 @@ DESC: Combine a former COW snapshot (second arg) with a former
DESC: origin LV (first arg) to reverse a splitsnapshot command.
RULE: all not lv_is_locked lv_is_pvmove
RULE: all and lv_is_visible
-FLAGS: SECONDARY_SYNTAX
lvconvert --snapshot LV LV_linear
OO: --type snapshot, --chunksize SizeKB, --zero Bool, OO_LVCONVERT
6 years, 6 months
master - scripts: paths update
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=34618c2d3061e7f9f56...
Commit: 34618c2d3061e7f9f563d4c9ad9a185c77935f0e
Parent: d809fbb541a63002214ed1d77914c7a4c7d02c60
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 25 17:08:00 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Oct 25 22:02:54 2017 +0200
scripts: paths update
Correct usage of sbindir also for scripts so the path
no longer needs resolving more vars like exec_prefix & prefix.
---
scripts/blk_availability_init_red_hat.in | 8 +++-----
scripts/blkdeactivate.sh.in | 12 +++++++-----
scripts/clvmd_init_red_hat.in | 10 +++++-----
scripts/cmirrord_init_red_hat.in | 6 ++++--
scripts/lvm2_cluster_activation_red_hat.sh.in | 2 +-
scripts/lvm2_lvmetad_init_red_hat.in | 7 +++----
scripts/lvm2_lvmpolld_init_red_hat.in | 7 +++----
scripts/lvm2_monitoring_init_red_hat.in | 11 +++++------
8 files changed, 31 insertions(+), 32 deletions(-)
diff --git a/scripts/blk_availability_init_red_hat.in b/scripts/blk_availability_init_red_hat.in
index 73d52ac..52399fb 100644
--- a/scripts/blk_availability_init_red_hat.in
+++ b/scripts/blk_availability_init_red_hat.in
@@ -31,14 +31,12 @@
. /etc/init.d/functions
-sbindir=@sbindir@
script=blkdeactivate
-options="-u -l wholevg -m disablequeueing -r wait"
-
-LOCK_FILE="/var/lock/subsys/blk-availability"
+sbindir=@SBINDIR@
+options="-u -l wholevg -m disablequeueing -r wait"
-rtrn=1
+LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/blk-availability"
case "$1" in
start)
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index daa53df..4680f16 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -31,14 +31,16 @@ shopt -s dotglob nullglob
TOOL=blkdeactivate
-DEV_DIR='/dev'
-SYS_BLK_DIR='/sys/block'
+sbindir="@SBINDIR@"
+
+DEV_DIR="/dev"
+SYS_BLK_DIR="/sys/block"
MOUNTPOINT="/bin/mountpoint"
UMOUNT="/bin/umount"
-DMSETUP="@sbindir@/dmsetup"
-LVM="@sbindir@/lvm"
-MDADM="@sbindir@/mdadm"
+DMSETUP="$sbindir/dmsetup"
+LVM="$sbindir/lvm"
+MDADM="$sbindir/mdadm"
MPATHD="/sbin/multipathd"
if "$UMOUNT" --help | grep -- "--all-targets" >"$DEV_DIR/null"; then
diff --git a/scripts/clvmd_init_red_hat.in b/scripts/clvmd_init_red_hat.in
index d7f3392..e5fbe04 100644
--- a/scripts/clvmd_init_red_hat.in
+++ b/scripts/clvmd_init_red_hat.in
@@ -20,8 +20,8 @@
DAEMON=clvmd
-exec_prefix=@exec_prefix@
-sbindir=@sbindir@
+sbindir="@SBINDIR@"
+usrsbindir="@USRSBINDIR@"
lvm_vgchange=${sbindir}/vgchange
lvm_vgs=${sbindir}/vgs
@@ -62,7 +62,7 @@ start()
{
if ! rh_status_q; then
echo -n "Starting $DAEMON: "
- $DAEMON $CLVMDOPTS || return $?
+ "$usrsbindir/$DAEMON" $CLVMDOPTS || return $?
echo
fi
@@ -138,7 +138,7 @@ stop()
reload() {
rh_status_q || exit 7
- action "Reloading $DAEMON configuration: " $DAEMON -R || return $?
+ action "Reloading $DAEMON configuration: " "$usrsbindir/$DAEMON" -R || return $?
}
restart() {
@@ -149,7 +149,7 @@ restart() {
# Try to get clvmd to restart itself. This will preserve
# exclusive LV locks
- action "Restarting $DAEMON: " $DAEMON -S
+ action "Restarting $DAEMON: " "$usrsbindir/$DAEMON" -S
# If that fails then do a normal stop & restart
if [ $? != 0 ]; then
diff --git a/scripts/cmirrord_init_red_hat.in b/scripts/cmirrord_init_red_hat.in
index d4b7e37..7b1df06 100755
--- a/scripts/cmirrord_init_red_hat.in
+++ b/scripts/cmirrord_init_red_hat.in
@@ -18,7 +18,9 @@
DAEMON=cmirrord
-LOCK_FILE="/var/lock/subsys/$DAEMON"
+usrsbindir="@USRSBINDIR@"
+
+LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
start()
{
@@ -26,7 +28,7 @@ start()
if ! pidof $DAEMON > /dev/null
then
echo -n "Starting $DAEMON: "
- daemon $DAEMON
+ daemon "$usrsbindir/$DAEMON"
rtrn=$?
echo
fi
diff --git a/scripts/lvm2_cluster_activation_red_hat.sh.in b/scripts/lvm2_cluster_activation_red_hat.sh.in
index 04d2cc6..6dacf91 100644
--- a/scripts/lvm2_cluster_activation_red_hat.sh.in
+++ b/scripts/lvm2_cluster_activation_red_hat.sh.in
@@ -1,6 +1,6 @@
#!/bin/bash
-sbindir=@sbindir@
+sbindir="@SBINDIR@"
lvm_vgchange="${sbindir}/vgchange"
lvm_vgscan="${sbindir}/vgscan"
diff --git a/scripts/lvm2_lvmetad_init_red_hat.in b/scripts/lvm2_lvmetad_init_red_hat.in
index b2f5d50..9a6c4f8 100644
--- a/scripts/lvm2_lvmetad_init_red_hat.in
+++ b/scripts/lvm2_lvmetad_init_red_hat.in
@@ -35,10 +35,9 @@
DAEMON=lvmetad
-exec_prefix=@exec_prefix@
-sbindir=@sbindir@
+sbindir="@SBINDIR@"
-LOCK_FILE="/var/lock/subsys/$DAEMON"
+LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
PID_FILE="@LVMETAD_PIDFILE@"
rh_status() {
@@ -52,7 +51,7 @@ rh_status_q() {
start()
{
ret=0
- action "Starting LVM metadata daemon:" $DAEMON || ret=$?
+ action "Starting LVM metadata daemon:" "$sbindir/$DAEMON" || ret=$?
return $ret
}
diff --git a/scripts/lvm2_lvmpolld_init_red_hat.in b/scripts/lvm2_lvmpolld_init_red_hat.in
index c521955..05f8b08 100644
--- a/scripts/lvm2_lvmpolld_init_red_hat.in
+++ b/scripts/lvm2_lvmpolld_init_red_hat.in
@@ -37,10 +37,9 @@
DAEMON=lvmpolld
-exec_prefix=@exec_prefix@
-sbindir=@sbindir@
+sbindir="@SBINDIR@"
-LOCK_FILE="/var/lock/subsys/$DAEMON"
+LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/$DAEMON"
PID_FILE="@LVMPOLLD_PIDFILE@"
rh_status() {
@@ -54,7 +53,7 @@ rh_status_q() {
start()
{
ret=0
- action "Starting LVM poll daemon:" $DAEMON || ret=$?
+ action "Starting LVM poll daemon:" "$sbindir/$DAEMON" || ret=$?
return $ret
}
diff --git a/scripts/lvm2_monitoring_init_red_hat.in b/scripts/lvm2_monitoring_init_red_hat.in
index de7ff0d..3b0d542 100644
--- a/scripts/lvm2_monitoring_init_red_hat.in
+++ b/scripts/lvm2_monitoring_init_red_hat.in
@@ -34,14 +34,13 @@
DAEMON=lvm2-monitor
DMEVENTD_DAEMON=dmeventd
-exec_prefix=@exec_prefix@
-sbindir=@sbindir@
+sbindir=@SBINDIR@
-VGCHANGE=${sbindir}/vgchange
-VGS=${sbindir}/vgs
-LVS=${sbindir}/lvs
+VGCHANGE="$sbindir/vgchange"
+VGS="$sbindir/vgs"
+LVS="$sbindir/lvs"
-LOCK_FILE="/var/lock/subsys/$DAEMON"
+LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
PID_FILE="@DMEVENTD_PIDFILE@"
WARN=1
6 years, 6 months
master - systemd: use proper sbindir path
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d809fbb541a63002214...
Commit: d809fbb541a63002214ed1d77914c7a4c7d02c60
Parent: 3f59969c3fcbff2a3bb177fc07262f1ea569e134
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 25 17:06:41 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Oct 25 22:02:54 2017 +0200
systemd: use proper sbindir path
Replace lowercase @sbindir@ with @SBINDIR@ which contains
fully decoded path.
Same with @usrsbindir@ which is also used with clvmd and cmirrord.
Also handle SYSCONFDIR for EnvironmentFile.
Patch fixes generated unit files with strings like:
ExecStart=${exec_prefix}/sbin/lvm
---
.../blk_availability_systemd_red_hat.service.in | 2 +-
scripts/com.redhat.lvmdbus1.service.in | 2 +-
scripts/dm_event_systemd_red_hat.service.in | 2 +-
...2_cluster_activation_systemd_red_hat.service.in | 2 +-
scripts/lvm2_clvmd_systemd_red_hat.service.in | 4 ++--
scripts/lvm2_cmirrord_systemd_red_hat.service.in | 2 +-
scripts/lvm2_lvmdbusd_systemd_red_hat.service.in | 2 +-
scripts/lvm2_lvmetad_systemd_red_hat.service.in | 2 +-
scripts/lvm2_lvmlockd_systemd_red_hat.service.in | 2 +-
scripts/lvm2_lvmlocking_systemd_red_hat.service.in | 8 ++++----
scripts/lvm2_lvmpolld_systemd_red_hat.service.in | 2 +-
scripts/lvm2_monitoring_systemd_red_hat.service.in | 4 ++--
scripts/lvm2_pvscan_systemd_red_hat@.service.in | 4 ++--
13 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/scripts/blk_availability_systemd_red_hat.service.in b/scripts/blk_availability_systemd_red_hat.service.in
index 10c3f44..1198baa 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 -m disablequeueing -r wait
+ExecStop=@SBINDIR@/blkdeactivate -u -l wholevg -m disablequeueing -r wait
RemainAfterExit=yes
[Install]
diff --git a/scripts/com.redhat.lvmdbus1.service.in b/scripts/com.redhat.lvmdbus1.service.in
index 5578ed1..02d8ac1 100644
--- a/scripts/com.redhat.lvmdbus1.service.in
+++ b/scripts/com.redhat.lvmdbus1.service.in
@@ -1,5 +1,5 @@
[D-BUS Service]
Name=com.redhat.lvmdbus1
-Exec=@sbindir@/lvmdbusd --udev
+Exec=@SBINDIR@/lvmdbusd --udev
User=root
SystemdService=lvm2-lvmdbusd.service
diff --git a/scripts/dm_event_systemd_red_hat.service.in b/scripts/dm_event_systemd_red_hat.service.in
index 4924d39..de9aa52 100644
--- a/scripts/dm_event_systemd_red_hat.service.in
+++ b/scripts/dm_event_systemd_red_hat.service.in
@@ -9,7 +9,7 @@ DefaultDependencies=no
[Service]
Type=simple
-ExecStart=@sbindir@/dmeventd -f
+ExecStart=@SBINDIR@/dmeventd -f
Environment=SD_ACTIVATION=1
PIDFile=@DMEVENTD_PIDFILE@
OOMScoreAdjust=-1000
diff --git a/scripts/lvm2_cluster_activation_systemd_red_hat.service.in b/scripts/lvm2_cluster_activation_systemd_red_hat.service.in
index 970e93a..bf4aa1e 100644
--- a/scripts/lvm2_cluster_activation_systemd_red_hat.service.in
+++ b/scripts/lvm2_cluster_activation_systemd_red_hat.service.in
@@ -9,7 +9,7 @@ Conflicts=shutdown.target
[Service]
Type=simple
RemainAfterExit=yes
-EnvironmentFile=-@sysconfdir@/sysconfig/clvmd
+EnvironmentFile=-@SYSCONFDIR@/sysconfig/clvmd
ExecStart=@systemdutildir@/lvm2-cluster-activation activate
ExecStop=@systemdutildir@/lvm2-cluster-activation deactivate
diff --git a/scripts/lvm2_clvmd_systemd_red_hat.service.in b/scripts/lvm2_clvmd_systemd_red_hat.service.in
index f506fa8..ced2774 100644
--- a/scripts/lvm2_clvmd_systemd_red_hat.service.in
+++ b/scripts/lvm2_clvmd_systemd_red_hat.service.in
@@ -13,8 +13,8 @@ Conflicts=shutdown.target
[Service]
Type=forking
Environment=CLVMD_OPTS=-T30
-EnvironmentFile=-@sysconfdir@/sysconfig/clvmd
-ExecStart=@sbindir@/clvmd $CLVMD_OPTS
+EnvironmentFile=-@SYSCONFDIR@/sysconfig/clvmd
+ExecStart=@USRSBINDIR@/clvmd $CLVMD_OPTS
SuccessExitStatus=5
TimeoutStartSec=30
TimeoutStopSec=10
diff --git a/scripts/lvm2_cmirrord_systemd_red_hat.service.in b/scripts/lvm2_cmirrord_systemd_red_hat.service.in
index 2dfc2a4..e482b9a 100644
--- a/scripts/lvm2_cmirrord_systemd_red_hat.service.in
+++ b/scripts/lvm2_cmirrord_systemd_red_hat.service.in
@@ -9,7 +9,7 @@ Conflicts=shutdown.target
[Service]
Type=forking
-ExecStart=@sbindir@/cmirrord
+ExecStart=@USRSBINDIR@/cmirrord
PIDFile=@CMIRRORD_PIDFILE@
Restart=on-abort
diff --git a/scripts/lvm2_lvmdbusd_systemd_red_hat.service.in b/scripts/lvm2_lvmdbusd_systemd_red_hat.service.in
index 64cec4e..7e4d7e4 100644
--- a/scripts/lvm2_lvmdbusd_systemd_red_hat.service.in
+++ b/scripts/lvm2_lvmdbusd_systemd_red_hat.service.in
@@ -5,7 +5,7 @@ Documentation=man:lvmdbusd(8)
[Service]
Type=dbus
BusName=com.redhat.lvmdbus1
-ExecStart=@sbindir@/lvmdbusd
+ExecStart=@SBINDIR@/lvmdbusd
[Install]
WantedBy=multi-user.target
diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.service.in b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
index 8f4c60d..af34d82 100644
--- a/scripts/lvm2_lvmetad_systemd_red_hat.service.in
+++ b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
@@ -9,7 +9,7 @@ Conflicts=shutdown.target
[Service]
Type=simple
NonBlocking=true
-ExecStart=@sbindir@/lvmetad -f
+ExecStart=@SBINDIR@/lvmetad -f
Environment=SD_ACTIVATION=1
Restart=on-abort
PIDFile=@LVMETAD_PIDFILE@
diff --git a/scripts/lvm2_lvmlockd_systemd_red_hat.service.in b/scripts/lvm2_lvmlockd_systemd_red_hat.service.in
index 17c7dbf..2a7544a 100644
--- a/scripts/lvm2_lvmlockd_systemd_red_hat.service.in
+++ b/scripts/lvm2_lvmlockd_systemd_red_hat.service.in
@@ -6,7 +6,7 @@ After=lvm2-lvmetad.service
[Service]
Type=simple
NonBlocking=true
-ExecStart=@sbindir@/lvmlockd -f
+ExecStart=@SBINDIR@/lvmlockd -f
Environment=SD_ACTIVATION=1
PIDFile=@LVMLOCKD_PIDFILE@
SendSIGKILL=no
diff --git a/scripts/lvm2_lvmlocking_systemd_red_hat.service.in b/scripts/lvm2_lvmlocking_systemd_red_hat.service.in
index bfac578..62d8177 100644
--- a/scripts/lvm2_lvmlocking_systemd_red_hat.service.in
+++ b/scripts/lvm2_lvmlocking_systemd_red_hat.service.in
@@ -8,16 +8,16 @@ Type=oneshot
RemainAfterExit=yes
# start lockspaces and wait for them to finish starting
-ExecStart=@sbindir@/vgchange --lock-start --lock-opt autowait
+ExecStart=@SBINDIR@/lvm vgchange --lock-start --lock-opt autowait
# auto activate LVs in the newly started lockd VGs
-ExecStart=@sbindir@/vgchange -aay -S 'locktype=sanlock || locktype=dlm'
+ExecStart=@SBINDIR@/lvm vgchange -aay -S 'locktype=sanlock || locktype=dlm'
# deactivate LVs in lockd VGs
-ExecStop=@sbindir@/vgchange -an -S 'locktype=sanlock || locktype=dlm'
+ExecStop=@SBINDIR@/lvm vgchange -an -S 'locktype=sanlock || locktype=dlm'
# stop lockspaces and wait for them to finish stopping
-ExecStop=@sbindir@/lvmlockctl --stop-lockspaces --wait 1
+ExecStop=@SBINDIR@/lvmlockctl --stop-lockspaces --wait 1
[Install]
WantedBy=multi-user.target
diff --git a/scripts/lvm2_lvmpolld_systemd_red_hat.service.in b/scripts/lvm2_lvmpolld_systemd_red_hat.service.in
index d7ff492..66fbd91 100644
--- a/scripts/lvm2_lvmpolld_systemd_red_hat.service.in
+++ b/scripts/lvm2_lvmpolld_systemd_red_hat.service.in
@@ -9,7 +9,7 @@ Conflicts=shutdown.target
[Service]
Type=simple
NonBlocking=true
-ExecStart=@sbindir@/lvmpolld -t 60 -f
+ExecStart=@SBINDIR@/lvmpolld -t 60 -f
Environment=SD_ACTIVATION=1
PIDFile=@LVMPOLLD_PIDFILE@
diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in b/scripts/lvm2_monitoring_systemd_red_hat.service.in
index 22238b7..ebc069e 100644
--- a/scripts/lvm2_monitoring_systemd_red_hat.service.in
+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in
@@ -10,8 +10,8 @@ Conflicts=shutdown.target
[Service]
Type=oneshot
Environment=LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
-ExecStart=@sbindir@/lvm vgchange --monitor y --ignoreskippedcluster
-ExecStop=@sbindir@/lvm vgchange --monitor n --ignoreskippedcluster
+ExecStart=@SBINDIR@/lvm vgchange --monitor y --ignoreskippedcluster
+ExecStop=@SBINDIR@/lvm vgchange --monitor n --ignoreskippedcluster
RemainAfterExit=yes
[Install]
diff --git a/scripts/lvm2_pvscan_systemd_red_hat@.service.in b/scripts/lvm2_pvscan_systemd_red_hat@.service.in
index 0989590..839bfd1 100644
--- a/scripts/lvm2_pvscan_systemd_red_hat@.service.in
+++ b/scripts/lvm2_pvscan_systemd_red_hat@.service.in
@@ -12,5 +12,5 @@ Conflicts=shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStart=@sbindir@/lvm pvscan --cache --activate ay %i
-ExecStop=@sbindir@/lvm pvscan --cache %i
+ExecStart=@SBINDIR@/lvm pvscan --cache --activate ay %i
+ExecStop=@SBINDIR@/lvm pvscan --cache %i
6 years, 6 months
master - configure: improve support for sbindir path
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3f59969c3fcbff2a3bb...
Commit: 3f59969c3fcbff2a3bb177fc07262f1ea569e134
Parent: f32ef63b6c97fbf95568fee88aad8ef92e732c5a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 25 16:49:17 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Oct 25 22:02:54 2017 +0200
configure: improve support for sbindir path
Introduce few more AC_SUBST vars for usage in *.in generation.
In some case we want to replace i.e. $sbindir with full path
instead of current ${exec_prefix}/sbin.
This patch provides:
USRSBINDIR
SBINDIR
DEFAULT_SYS_LOCK_DIR
SYSCONFDIR
At the same time properly use sbindir & usrsbindir with
lvm, fsadm, clvmd from one primary definition.
---
configure | 51 +++++++++++++++++++++++++++++++--------------------
configure.in | 45 ++++++++++++++++++++++++++-------------------
2 files changed, 57 insertions(+), 39 deletions(-)
diff --git a/configure b/configure
index e5f8e19..fc0a27a 100755
--- a/configure
+++ b/configure
@@ -643,6 +643,7 @@ LVMETAD_PIDFILE
DMEVENTD_PIDFILE
WRITE_INSTALL
VALGRIND_POOL
+USRSBINDIR
USE_TRACKING
UDEV_HAS_BUILTIN_BLKID
UDEV_RULE_EXEC_DETECTION
@@ -656,8 +657,10 @@ TESTING
STATIC_LINK
STATICDIR
SNAPSHOTS
+SYSCONFDIR
SELINUX_PC
SELINUX_LIBS
+SBINDIR
REPLICATORS
READLINE_LIBS
RT_LIBS
@@ -710,6 +713,7 @@ DEFAULT_USE_LVMLOCKD
DEFAULT_USE_LVMPOLLD
DEFAULT_USE_LVMETAD
DEFAULT_USE_BLKID_WIPING
+DEFAULT_SYS_LOCK_DIR
DEFAULT_SYS_DIR
DEFAULT_SPARSE_SEGTYPE
DEFAULT_RUN_DIR
@@ -8238,9 +8242,14 @@ $as_echo "$ac_cv_flag_HAVE_FULL_RELRO" >&6; }
################################################################################
-if test "$prefix" = NONE; then
- datarootdir=${ac_default_prefix}/share
-fi
+
+################################################################################
+test "$exec_prefix" = NONE -a "$prefix" = NONE && exec_prefix=""
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking file owner" >&5
@@ -12890,7 +12899,7 @@ if ${am_cv_pathless_PYTHON+:} false; then :
$as_echo_n "(cached) " >&6
else
- for am_cv_pathless_PYTHON in python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
+ for am_cv_pathless_PYTHON in python python2 python3 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
test "$am_cv_pathless_PYTHON" = none && break
prog="import sys
# split strings by '.' and convert to numeric. Append some zeros
@@ -13458,7 +13467,7 @@ if ${am_cv_pathless_PYTHON+:} false; then :
$as_echo_n "(cached) " >&6
else
- for am_cv_pathless_PYTHON in python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
+ for am_cv_pathless_PYTHON in python python2 python3 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
test "$am_cv_pathless_PYTHON" = none && break
prog="import sys
# split strings by '.' and convert to numeric. Append some zeros
@@ -14014,9 +14023,6 @@ fi
################################################################################
-test "$exec_prefix" = NONE -a "$prefix" = NONE && exec_prefix=""
-
-################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
if ${ac_cv_lib_dl_dlopen+:} false; then :
@@ -15397,28 +15403,25 @@ _ACEOF
fi
+SYSCONFDIR="$(eval echo $(eval echo $sysconfdir))"
-lvm_exec_prefix=$exec_prefix
-test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$prefix
-test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$ac_default_prefix
-LVM_PATH="$lvm_exec_prefix/sbin/lvm"
+SBINDIR="$(eval echo $(eval echo $sbindir))"
+LVM_PATH="$SBINDIR/lvm"
cat >>confdefs.h <<_ACEOF
#define LVM_PATH "$LVM_PATH"
_ACEOF
-clvmd_prefix=$ac_default_prefix
-test "$prefix" != NONE && clvmd_prefix=$prefix
-CLVMD_PATH="$clvmd_prefix/sbin/clvmd"
+USRSBINDIR="$(eval echo $(eval echo $usrsbindir))"
+CLVMD_PATH="$USRSBINDIR/clvmd"
cat >>confdefs.h <<_ACEOF
#define CLVMD_PATH "$CLVMD_PATH"
_ACEOF
-
-FSADM_PATH="$lvm_exec_prefix/sbin/fsadm"
+FSADM_PATH="$SBINDIR/fsadm"
cat >>confdefs.h <<_ACEOF
#define FSADM_PATH "$FSADM_PATH"
@@ -15448,7 +15451,7 @@ if test "$BUILD_DMEVENTD" = yes; then
if test "${with_dmeventd_path+set}" = set; then :
withval=$with_dmeventd_path; DMEVENTD_PATH=$withval
else
- DMEVENTD_PATH="$lvm_exec_prefix/sbin/dmeventd"
+ DMEVENTD_PATH="$SBINDIR/dmeventd"
fi
@@ -15529,6 +15532,11 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+# Select default system locking dir, prefer /run/lock over /var/lock
+DEFAULT_SYS_LOCK_DIR="$RUN_DIR/lock"
+test -d "$DEFAULT_SYS_LOCK_DIR" || DEFAULT_SYS_LOCK_DIR="/var/lock"
+
+# Support configurable locking subdir for lvm
# Check whether --with-default-locking-dir was given.
if test "${with_default_locking_dir+set}" = set; then :
@@ -15536,8 +15544,7 @@ if test "${with_default_locking_dir+set}" = set; then :
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for default lock directory" >&5
$as_echo_n "checking for default lock directory... " >&6; }
- DEFAULT_LOCK_DIR="$RUN_DIR/lock/lvm"
- test -d "$RUN_DIR/lock" || DEFAULT_LOCK_DIR="/var/lock/lvm"
+ DEFAULT_LOCK_DIR="$DEFAULT_SYS_LOCK_DIR/lvm"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEFAULT_LOCK_DIR" >&5
$as_echo "$DEFAULT_LOCK_DIR" >&6; }
fi
@@ -15766,6 +15773,10 @@ _ACEOF
+
+
+
+
################################################################################
ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/dmfilemapd/Makefile daemons/lvmdbusd/Makefile daemons/lvmdbusd/path.py daemons/lvmetad/Makefile daemons/lvmpolld/Makefile daemons/lvmlockd/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile include/lvm-version.h lib/raid/Makefile lib/snapshot/Makefile lib/thin/Makefile lib/cache_segtype/Makefile libdaemon/Makefile libdaemon/client/Makefile libdaem
on/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/com.redhat.lvmdbus1.service scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cluster_activation_red_hat.sh scripts/lvm2_cluster_activation_systemd_red_hat.service scripts/lvm2_clvmd_systemd_red_hat.service scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmdbusd_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_lvmlockd_systemd_red_hat.service scripts/lvm2_lvmlocking_systemd_
red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile unit-tests/datastruct/Makefile unit-tests/regex/Makefile unit-tests/mm/Makefile"
diff --git a/configure.in b/configure.in
index 1366dc4..7d4f5b3 100644
--- a/configure.in
+++ b/configure.in
@@ -191,9 +191,15 @@ AC_SUBST(HAVE_FULL_RELRO)
################################################################################
dnl -- Prefix is /usr by default, the exec_prefix default is setup later
AC_PREFIX_DEFAULT(/usr)
-if test "$prefix" = NONE; then
- datarootdir=${ac_default_prefix}/share
-fi
+
+################################################################################
+dnl -- Clear default exec_prefix - install into /sbin rather than /usr/sbin
+test "$exec_prefix" = NONE -a "$prefix" = NONE && exec_prefix=""
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
################################################################################
dnl -- Setup the ownership of the files
@@ -1599,10 +1605,6 @@ AC_CHECK_LIB(c, canonicalize_file_name,
[Define to 1 if canonicalize_file_name is available.]))
################################################################################
-dnl -- Clear default exec_prefix - install into /sbin rather than /usr/sbin
-test "$exec_prefix" = NONE -a "$prefix" = NONE && exec_prefix=""
-
-################################################################################
dnl -- Check for dlopen
AC_CHECK_LIB(dl, dlopen,
[AC_DEFINE([HAVE_LIBDL], 1, [Define to 1 if dynamic libraries are available.])
@@ -1874,20 +1876,17 @@ if test -n "$MODPROBE_CMD"; then
AC_DEFINE_UNQUOTED([MODPROBE_CMD], ["$MODPROBE_CMD"], [The path to 'modprobe', if available.])
fi
+SYSCONFDIR="$(eval echo $(eval echo $sysconfdir))"
-lvm_exec_prefix=$exec_prefix
-test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$prefix
-test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$ac_default_prefix
-LVM_PATH="$lvm_exec_prefix/sbin/lvm"
+SBINDIR="$(eval echo $(eval echo $sbindir))"
+LVM_PATH="$SBINDIR/lvm"
AC_DEFINE_UNQUOTED(LVM_PATH, ["$LVM_PATH"], [Path to lvm binary.])
-clvmd_prefix=$ac_default_prefix
-test "$prefix" != NONE && clvmd_prefix=$prefix
-CLVMD_PATH="$clvmd_prefix/sbin/clvmd"
+USRSBINDIR="$(eval echo $(eval echo $usrsbindir))"
+CLVMD_PATH="$USRSBINDIR/clvmd"
AC_DEFINE_UNQUOTED(CLVMD_PATH, ["$CLVMD_PATH"], [Path to clvmd binary.])
-
-FSADM_PATH="$lvm_exec_prefix/sbin/fsadm"
+FSADM_PATH="$SBINDIR/fsadm"
AC_DEFINE_UNQUOTED(FSADM_PATH, ["$FSADM_PATH"], [Path to fsadm binary.])
################################################################################
@@ -1907,7 +1906,7 @@ if test "$BUILD_DMEVENTD" = yes; then
AC_HELP_STRING([--with-dmeventd-path=PATH],
[dmeventd path [EPREFIX/sbin/dmeventd]]),
DMEVENTD_PATH=$withval,
- DMEVENTD_PATH="$lvm_exec_prefix/sbin/dmeventd")
+ DMEVENTD_PATH="$SBINDIR/dmeventd")
AC_DEFINE_UNQUOTED(DMEVENTD_PATH, ["$DMEVENTD_PATH"],
[Path to dmeventd binary.])
fi
@@ -1950,13 +1949,17 @@ AC_ARG_WITH(default-cache-subdir,
AC_DEFINE_UNQUOTED(DEFAULT_CACHE_SUBDIR, ["$DEFAULT_CACHE_SUBDIR"],
[Name of default metadata cache subdirectory.])
+# Select default system locking dir, prefer /run/lock over /var/lock
+DEFAULT_SYS_LOCK_DIR="$RUN_DIR/lock"
+test -d "$DEFAULT_SYS_LOCK_DIR" || DEFAULT_SYS_LOCK_DIR="/var/lock"
+
+# Support configurable locking subdir for lvm
AC_ARG_WITH(default-locking-dir,
AC_HELP_STRING([--with-default-locking-dir=DIR],
[default locking directory [autodetect_lock_dir/lvm]]),
DEFAULT_LOCK_DIR=$withval,
[AC_MSG_CHECKING(for default lock directory)
- DEFAULT_LOCK_DIR="$RUN_DIR/lock/lvm"
- test -d "$RUN_DIR/lock" || DEFAULT_LOCK_DIR="/var/lock/lvm"
+ DEFAULT_LOCK_DIR="$DEFAULT_SYS_LOCK_DIR/lvm"
AC_MSG_RESULT($DEFAULT_LOCK_DIR)])
AC_DEFINE_UNQUOTED(DEFAULT_LOCK_DIR, ["$DEFAULT_LOCK_DIR"],
[Name of default locking directory.])
@@ -2051,6 +2054,7 @@ AC_SUBST(DEFAULT_RAID10_SEGTYPE)
AC_SUBST(DEFAULT_RUN_DIR)
AC_SUBST(DEFAULT_SPARSE_SEGTYPE)
AC_SUBST(DEFAULT_SYS_DIR)
+AC_SUBST(DEFAULT_SYS_LOCK_DIR)
AC_SUBST(DEFAULT_USE_BLKID_WIPING)
AC_SUBST(DEFAULT_USE_LVMETAD)
AC_SUBST(DEFAULT_USE_LVMPOLLD)
@@ -2115,8 +2119,10 @@ AC_SUBST(SACKPT_CFLAGS)
AC_SUBST(SACKPT_LIBS)
AC_SUBST(SALCK_CFLAGS)
AC_SUBST(SALCK_LIBS)
+AC_SUBST(SBINDIR)
AC_SUBST(SELINUX_LIBS)
AC_SUBST(SELINUX_PC)
+AC_SUBST(SYSCONFDIR)
AC_SUBST(SYSTEMD_LIBS)
AC_SUBST(SNAPSHOTS)
AC_SUBST(STATICDIR)
@@ -2139,6 +2145,7 @@ AC_SUBST(UDEV_SYSTEMD_BACKGROUND_JOBS)
AC_SUBST(UDEV_RULE_EXEC_DETECTION)
AC_SUBST(UDEV_HAS_BUILTIN_BLKID)
AC_SUBST(USE_TRACKING)
+AC_SUBST(USRSBINDIR)
AC_SUBST(VALGRIND_POOL)
AC_SUBST(WRITE_INSTALL)
AC_SUBST(DMEVENTD_PIDFILE)
6 years, 6 months
master - tests: snapshot conversions
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f32ef63b6c97fbf9556...
Commit: f32ef63b6c97fbf95568fee88aad8ef92e732c5a
Parent: 0a0cc696cafd36ee5cd69e15bb4502eb1be22b86
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 25 21:56:39 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Oct 25 22:02:24 2017 +0200
tests: snapshot conversions
Add missing tests for snapshost conversions.
---
test/shell/lvconvert-snapshot-cache.sh | 78 +++++++++++++++++++++++++++++++
test/shell/lvconvert-snapshot-mirror.sh | 60 +++++++++++++++++++++++
test/shell/lvconvert-snapshot-raid.sh | 62 ++++++++++++++++++++++++
test/shell/lvconvert-snapshot-thin.sh | 73 +++++++++++++++++++++++++++++
4 files changed, 273 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-snapshot-cache.sh b/test/shell/lvconvert-snapshot-cache.sh
new file mode 100644
index 0000000..396f431
--- /dev/null
+++ b/test/shell/lvconvert-snapshot-cache.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Test various supported conversion of snapshot with cache
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+aux have_cache 1 3 0 || skip
+
+aux prepare_vg 1
+
+vgchange -s 16k $vg
+
+lvcreate -L1 -n cow $vg
+
+# Thin and snapshot conversion
+lvcreate -L1 -n ch $vg
+lvcreate -H -L1 -n cpool $vg/ch
+
+# Cannot create snapshot of cpool
+not lvcreate -s -L1 $vg/cpool 2>&1 | tee err
+grep "not supported" err
+
+# Cannot create snapshot of cpool's meta
+not lvcreate -s -L1 $vg/cpool_cmeta 2>&1 | tee err
+grep "not supported" err
+
+# Cannot create snapshot of cpool's data
+not lvcreate -s -L1 $vg/cpool_cdata 2>&1 | tee err
+grep "not supported" err
+
+# Cannot use cache-type as COW
+not lvconvert --yes --type snapshot $vg/cow $vg/ch 2>&1 | tee err
+grep "not accept" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/cpool 2>&1 | tee err
+grep "not accept" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/cpool_cdata 2>&1 | tee err
+grep "lv_is_visible" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/cpool_cmeta 2>&1 | tee err
+grep "lv_is_visible" err
+
+# Cannot use thin-pool, _tdata, _tmeta as origin
+not lvconvert --yes --type snapshot $vg/cpool $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+not lvconvert --yes --type snapshot $vg/cpool_cdata $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+not lvconvert --yes --type snapshot $vg/cpool_cmeta $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+lvconvert --yes -s $vg/ch $vg/cow
+
+check lv_field $vg/ch segtype cache
+check lv_field $vg/cow segtype linear
+check lv_attr_bit type $vg/cow "s"
+check lv_attr_bit type $vg/ch "o"
+
+lvs -a -o+lv_role,lv_layout $vg
+
+vgremove -f $vg
diff --git a/test/shell/lvconvert-snapshot-mirror.sh b/test/shell/lvconvert-snapshot-mirror.sh
new file mode 100644
index 0000000..8af9e25
--- /dev/null
+++ b/test/shell/lvconvert-snapshot-mirror.sh
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Test various supported conversion of snapshot with mirrors
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+aux prepare_vg 3
+
+vgchange -s 16k $vg
+
+lvcreate -L1 -n cow $vg
+
+# Mirror and snapshot conversion
+lvcreate --type mirror -L1 -m1 -n mir $vg
+
+# Cannot create snapshot of mirror leg
+not lvcreate -s -L1 $vg/mir_mimage_0 2>&1 | tee err
+grep "not supported" err
+
+# cannot use 'mirror' as COW
+not lvconvert --yes --type snapshot $vg/cow $vg/mir 2>&1 | tee err
+grep "not accept" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/mir_mimage_0 2>&1 | tee err
+grep "lv_is_visible" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/mir_mlog 2>&1 | tee err
+grep "lv_is_visible" err
+
+# cannot use _mimage
+not lvconvert --yes --type snapshot $vg/mir_mimage_0 $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+# cannot use _mlog
+not lvconvert --yes --type snapshot $vg/mir_mlog $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+lvconvert --yes -s $vg/mir $vg/cow
+
+check lv_field $vg/mir segtype mirror
+check lv_field $vg/cow segtype linear
+check lv_attr_bit type $vg/cow "s"
+check lv_attr_bit type $vg/mir "o"
+
+lvs -a -o+lv_role,lv_layout $vg
+
+vgremove -f $vg
diff --git a/test/shell/lvconvert-snapshot-raid.sh b/test/shell/lvconvert-snapshot-raid.sh
new file mode 100644
index 0000000..91bcd94
--- /dev/null
+++ b/test/shell/lvconvert-snapshot-raid.sh
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Test various supported conversion of snapshot with raid
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+aux have_raid 1 3 0 || skip
+
+aux prepare_vg 3
+
+vgchange -s 16k $vg
+
+lvcreate -L1 -n cow $vg
+
+# Raid and snapshot conversion
+lvcreate --type raid1 -L1 -m1 -n rd $vg
+
+# Cannot create snapshot of raid leg
+not lvcreate -s -L1 $vg/rd_rimage_0 2>&1 | tee err
+grep "not supported" err
+
+# Cannot use raid-type as COW
+not lvconvert --yes --type snapshot $vg/cow $vg/rd 2>&1 | tee err
+grep "not accept" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/rd_rimage_0 2>&1 | tee err
+grep "lv_is_visible" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/rd_rmeta_0 2>&1 | tee err
+grep "lv_is_visible" err
+
+# Cannot use _rimage
+not lvconvert --yes --type snapshot $vg/rd_rimage_0 $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+# Cannot use _rmeta
+not lvconvert --yes --type snapshot $vg/rd_rmeta_0 $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+lvconvert --yes -s $vg/rd $vg/cow
+
+check lv_field $vg/rd segtype raid1
+check lv_field $vg/cow segtype linear
+check lv_attr_bit type $vg/cow "s"
+check lv_attr_bit type $vg/rd "o"
+
+lvs -a -o+lv_role,lv_layout $vg
+
+vgremove -f $vg
diff --git a/test/shell/lvconvert-snapshot-thin.sh b/test/shell/lvconvert-snapshot-thin.sh
new file mode 100644
index 0000000..ef1218b
--- /dev/null
+++ b/test/shell/lvconvert-snapshot-thin.sh
@@ -0,0 +1,73 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Test various supported conversion of snapshot with raid
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+aux have_thin 1 0 0 || skip
+
+aux prepare_vg 1
+
+vgchange -s 16k $vg
+
+lvcreate -L1 -n cow $vg
+
+# Thin and snapshot conversion
+lvcreate -T -L1 -V10 -n th $vg/pool
+
+# Cannot create snapshot of pool's meta
+not lvcreate -s -L1 $vg/pool_tmeta 2>&1 | tee err
+grep "not supported" err
+
+# Cannot create snapshot of pool's data
+not lvcreate -s -L1 $vg/pool_tdata 2>&1 | tee err
+grep "not supported" err
+
+# Cannot use thin-type as COW
+not lvconvert --yes --type snapshot $vg/cow $vg/th 2>&1 | tee err
+grep "not accept" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/pool 2>&1 | tee err
+grep "not accept" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/pool_tdata 2>&1 | tee err
+grep "lv_is_visible" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/pool_tmeta 2>&1 | tee err
+grep "lv_is_visible" err
+
+# Cannot use thin-pool, _tdata, _tmeta as origin
+not lvconvert --yes --type snapshot $vg/pool $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+not lvconvert --yes --type snapshot $vg/pool_tdata $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+not lvconvert --yes --type snapshot $vg/pool_tmeta $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+lvconvert --yes -s $vg/th $vg/cow
+
+check lv_field $vg/th segtype thin
+check lv_field $vg/cow segtype linear
+check lv_attr_bit type $vg/cow "s"
+check lv_attr_bit type $vg/th "o"
+
+lvs -a -o+lv_role,lv_layout $vg
+
+vgremove -f $vg
6 years, 6 months