1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: scripts double quote

This commit is contained in:
Zdenek Kabelac 2017-07-04 11:55:17 +02:00
parent 74ef5f07d0
commit 73bbd5528c
7 changed files with 82 additions and 82 deletions

View File

@ -641,14 +641,14 @@ do
"-e"|"--ext-offline") EXTOFF=1 ;; "-e"|"--ext-offline") EXTOFF=1 ;;
"-y"|"--yes") YES="-y" ;; "-y"|"--yes") YES="-y" ;;
"-l"|"--lvresize") DO_LVRESIZE=1 ;; "-l"|"--lvresize") DO_LVRESIZE=1 ;;
"check") CHECK="$2" ; shift ;; "check") CHECK=$2 ; shift ;;
"resize") RESIZE="$2"; NEWSIZE="$3" ; shift 2 ;; "resize") RESIZE=$2 ; NEWSIZE=$3 ; shift 2 ;;
*) error "Wrong argument \"$1\". (see: $TOOL --help)" *) error "Wrong argument \"$1\". (see: $TOOL --help)"
esac esac
shift shift
done done
test "$YES" = "-y" || YES= test "$YES" = "-y" || YES=""
test "$EXTOFF" -eq 1 || EXTOFF=0 test "$EXTOFF" -eq 1 || EXTOFF=0
if [ -n "$CHECK" ]; then if [ -n "$CHECK" ]; then

View File

@ -52,7 +52,7 @@ function usage
function set_default_use_lvmetad_var function set_default_use_lvmetad_var
{ {
eval "$(lvm dumpconfig --type default global/use_lvmetad 2>/dev/null)" eval "$(lvm dumpconfig --type default global/use_lvmetad 2>/dev/null)"
if [ "$?" != "0" ]; then if [ "$?" != 0 ]; then
USE_LVMETAD=0 USE_LVMETAD=0
else else
USE_LVMETAD=$use_lvmetad USE_LVMETAD=$use_lvmetad
@ -62,7 +62,7 @@ function set_default_use_lvmetad_var
function parse_args function parse_args
{ {
while [ -n "$1" ]; do while [ -n "$1" ]; do
case $1 in case "$1" in
--enable-cluster) --enable-cluster)
LOCKING_TYPE=3 LOCKING_TYPE=3
USE_LVMETAD=0 USE_LVMETAD=0
@ -155,12 +155,12 @@ function validate_args
exit 18 exit 18
fi fi
if [ "$HANDLE_SERVICES" = "0" ]; then if [ "$HANDLE_SERVICES" = 0 ]; then
if [ "$HANDLE_MIRROR_SERVICE" = "1" ]; then if [ "$HANDLE_MIRROR_SERVICE" = 1 ]; then
echo "--mirrorservice may be used only with --services" echo "--mirrorservice may be used only with --services"
exit 19 exit 19
fi fi
if [ "$START_STOP_SERVICES" = "1" ]; then if [ "$START_STOP_SERVICES" = 1 ]; then
echo "--startstopservices may be used only with --services" echo "--startstopservices may be used only with --services"
exit 19 exit 19
fi fi
@ -213,16 +213,16 @@ have_library=1
have_use_lvmetad=1 have_use_lvmetad=1
have_global=1 have_global=1
grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' $CONFIGFILE grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' "$CONFIGFILE"
have_type=$? have_type=$?
grep -q '^[[:blank:]]*library_dir[[:blank:]]*=' $CONFIGFILE grep -q '^[[:blank:]]*library_dir[[:blank:]]*=' "$CONFIGFILE"
have_dir=$? have_dir=$?
grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' $CONFIGFILE grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' "$CONFIGFILE"
have_library=$? have_library=$?
grep -q '^[[:blank:]]*use_lvmetad[[:blank:]]*=' $CONFIGFILE grep -q '^[[:blank:]]*use_lvmetad[[:blank:]]*=' "$CONFIGFILE"
have_use_lvmetad=$? have_use_lvmetad=$?
# Those options are in section "global {" so we must have one if any are present. # Those options are in section "global {" so we must have one if any are present.
@ -233,14 +233,14 @@ then
grep -q '^[[:blank:]]*global[[:blank:]]*{' $CONFIGFILE grep -q '^[[:blank:]]*global[[:blank:]]*{' $CONFIGFILE
have_global=$? have_global=$?
if [ "$have_global" = "1" ] if [ "$have_global" = 1 ]
then then
echo "global keys but no 'global {' found, can't edit file" echo "global keys but no 'global {' found, can't edit file"
exit 13 exit 13
fi fi
fi fi
if [ "$LOCKING_TYPE" = "2" ] && [ -z "$LOCKINGLIBDIR" ] && [ "$have_dir" = "1" ]; then if [ "$LOCKING_TYPE" = 2 ] && [ -z "$LOCKINGLIBDIR" ] && [ "$have_dir" = 1 ]; then
echo "no library_dir specified in $CONFIGFILE" echo "no library_dir specified in $CONFIGFILE"
exit 16 exit 16
fi fi
@ -248,13 +248,13 @@ fi
# So if we don't have "global {" we need to create one and # So if we don't have "global {" we need to create one and
# populate it # populate it
if [ "$have_global" = "1" ] if [ "$have_global" = 1 ]
then then
if [ -z "$LOCKING_TYPE" ]; then if [ -z "$LOCKING_TYPE" ]; then
LOCKING_TYPE=1 LOCKING_TYPE=1
fi fi
if [ "$LOCKING_TYPE" = "3" ] || [ "$LOCKING_TYPE" = "2" ]; then if [ "$LOCKING_TYPE" = 3 ] || [ "$LOCKING_TYPE" = 2 ]; then
cat $CONFIGFILE - <<EOF > $TMPFILE cat "$CONFIGFILE" - <<EOF > "$TMPFILE"
global { global {
# Enable locking for cluster LVM # Enable locking for cluster LVM
locking_type = $LOCKING_TYPE locking_type = $LOCKING_TYPE
@ -268,7 +268,7 @@ EOF
exit 14 exit 14
fi fi
if [ -n "$LOCKINGLIB" ]; then if [ -n "$LOCKINGLIB" ]; then
cat - <<EOF >> $TMPFILE cat - <<EOF >> "$TMPFILE"
locking_library = "$LOCKINGLIB" locking_library = "$LOCKINGLIB"
EOF EOF
if [ $? != 0 ] if [ $? != 0 ]
@ -277,7 +277,7 @@ EOF
exit 16 exit 16
fi fi
fi fi
cat - <<EOF >> $TMPFILE cat - <<EOF >> "$TMPFILE"
} }
EOF EOF
fi # if we aren't setting cluster locking, we don't need to create a global section fi # if we aren't setting cluster locking, we don't need to create a global section
@ -294,7 +294,7 @@ else
# #
if [ -n "$LOCKING_TYPE" ]; then if [ -n "$LOCKING_TYPE" ]; then
if [ "$have_type" = "0" ] if [ "$have_type" = 0 ]
then then
SEDCMD=" s/^[[:blank:]]*locking_type[[:blank:]]*=.*/\ \ \ \ locking_type = $LOCKING_TYPE/g" SEDCMD=" s/^[[:blank:]]*locking_type[[:blank:]]*=.*/\ \ \ \ locking_type = $LOCKING_TYPE/g"
else else
@ -303,7 +303,7 @@ else
fi fi
if [ -n "$LOCKINGLIBDIR" ]; then if [ -n "$LOCKINGLIBDIR" ]; then
if [ "$have_dir" = "0" ] if [ "$have_dir" = 0 ]
then then
SEDCMD="${SEDCMD}\ns'^[[:blank:]]*library_dir[[:blank:]]*=.*'\ \ \ \ library_dir = \"$LOCKINGLIBDIR\"'g" SEDCMD="${SEDCMD}\ns'^[[:blank:]]*library_dir[[:blank:]]*=.*'\ \ \ \ library_dir = \"$LOCKINGLIBDIR\"'g"
else else
@ -312,7 +312,7 @@ else
fi fi
if [ -n "$LOCKINGLIB" ]; then if [ -n "$LOCKINGLIB" ]; then
if [ "$have_library" = "0" ] if [ "$have_library" = 0 ]
then then
SEDCMD="${SEDCMD}\ns/^[[:blank:]]*locking_library[[:blank:]]*=.*/\ \ \ \ locking_library = \"$LOCKINGLIB\"/g" SEDCMD="${SEDCMD}\ns/^[[:blank:]]*locking_library[[:blank:]]*=.*/\ \ \ \ locking_library = \"$LOCKINGLIB\"/g"
else else
@ -320,7 +320,7 @@ else
fi fi
fi fi
if [ "$have_use_lvmetad" = "0" ] if [ "$have_use_lvmetad" = 0 ]
then then
SEDCMD="${SEDCMD}\ns'^[[:blank:]]*use_lvmetad[[:blank:]]*=.*'\ \ \ \ use_lvmetad = $USE_LVMETAD'g" SEDCMD="${SEDCMD}\ns'^[[:blank:]]*use_lvmetad[[:blank:]]*=.*'\ \ \ \ use_lvmetad = $USE_LVMETAD'g"
else else
@ -356,8 +356,8 @@ fi
rm -f "$SCRIPTFILE" "$TMPFILE" rm -f "$SCRIPTFILE" "$TMPFILE"
function set_service { function set_service {
local type="$1" local type=$1
local action="$2" local action=$2
shift 2 shift 2
if [ "$type" = "systemd" ]; then if [ "$type" = "systemd" ]; then
@ -367,7 +367,7 @@ function set_service {
eval "$($SYSTEMCTL_BIN show "$i" -p LoadState 2>/dev/null)" eval "$($SYSTEMCTL_BIN show "$i" -p LoadState 2>/dev/null)"
test "$LoadState" = "loaded" || continue test "$LoadState" = "loaded" || continue
$SYSTEMCTL_BIN enable "$i" $SYSTEMCTL_BIN enable "$i"
if [ "$START_STOP_SERVICES" = "1" ]; then if [ "$START_STOP_SERVICES" = 1 ]; then
$SYSTEMCTL_BIN start "$i" $SYSTEMCTL_BIN start "$i"
fi fi
done done
@ -376,28 +376,28 @@ function set_service {
unset LoadState unset LoadState
eval "$($SYSTEMCTL_BIN show "$i" -p LoadState 2>/dev/null)" eval "$($SYSTEMCTL_BIN show "$i" -p LoadState 2>/dev/null)"
test "$LoadState" = "loaded" || continue test "$LoadState" = "loaded" || continue
$SYSTEMCTL_BIN disable "$i" "$SYSTEMCTL_BIN" disable "$i"
if [ "$START_STOP_SERVICES" = "1" ]; then if [ "$START_STOP_SERVICES" = 1 ]; then
$SYSTEMCTL_BIN stop "$i" "$SYSTEMCTL_BIN" stop "$i"
fi fi
done done
fi fi
elif [ "$type" = "sysv" ]; then elif [ "$type" = "sysv" ]; then
if [ "$action" = "activate" ]; then if [ "$action" = "activate" ]; then
for i in "$@"; do for i in "$@"; do
$CHKCONFIG_BIN --list "$i" > /dev/null || continue "$CHKCONFIG_BIN" --list "$i" > /dev/null || continue
$CHKCONFIG_BIN "$i" on "$CHKCONFIG_BIN" "$i" on
if [ "$START_STOP_SERVICES" = "1" ]; then if [ "$START_STOP_SERVICES" = 1 ]; then
$SERVICE_BIN "$i" start "$SERVICE_BIN" "$i" start
fi fi
done done
elif [ "$action" = "deactivate" ]; then elif [ "$action" = "deactivate" ]; then
for i in "$@"; do for i in "$@"; do
$CHKCONFIG_BIN --list "$i" > /dev/null || continue "$CHKCONFIG_BIN" --list "$i" > /dev/null || continue
if [ "$START_STOP_SERVICES" = "1" ]; then if [ "$START_STOP_SERVICES" = 1 ]; then
$SERVICE_BIN "$i" stop "$SERVICE_BIN" "$i" stop
fi fi
$CHKCONFIG_BIN "$i" off "$CHKCONFIG_BIN" "$i" off
done done
fi fi
fi fi
@ -405,7 +405,7 @@ function set_service {
# Start/stop and enable/disable services if needed. # Start/stop and enable/disable services if needed.
if [ "$HANDLE_SERVICES" == "1" ]; then if [ "$HANDLE_SERVICES" = 1 ]; then
SYSTEMCTL_BIN=$(which systemctl 2>/dev/null) SYSTEMCTL_BIN=$(which systemctl 2>/dev/null)
CHKCONFIG_BIN=$(which chkconfig 2>/dev/null) CHKCONFIG_BIN=$(which chkconfig 2>/dev/null)
@ -413,40 +413,40 @@ if [ "$HANDLE_SERVICES" == "1" ]; then
# Systemd services # Systemd services
if [ -n "$SYSTEMCTL_BIN" ]; then if [ -n "$SYSTEMCTL_BIN" ]; then
if [ "$USE_LVMETAD" = "0" ]; then if [ "$USE_LVMETAD" = 0 ]; then
set_service systemd deactivate lvm2-lvmetad.service lvm2-lvmetad.socket set_service systemd deactivate lvm2-lvmetad.service lvm2-lvmetad.socket
else else
set_service systemd activate lvm2-lvmetad.socket set_service systemd activate lvm2-lvmetad.socket
fi fi
if [ "$LOCKING_TYPE" = "3" ]; then if [ "$LOCKING_TYPE" = 3 ]; then
set_service systemd activate lvm2-cluster-activation.service set_service systemd activate lvm2-cluster-activation.service
if [ "$HANDLE_MIRROR_SERVICE" = "1" ]; then if [ "$HANDLE_MIRROR_SERVICE" = 1 ]; then
set_service activate lvm2-cmirrord.service set_service activate lvm2-cmirrord.service
fi fi
else else
set_service systemd deactivate lvm2-cluster-activation.service set_service systemd deactivate lvm2-cluster-activation.service
if [ "$HANDLE_MIRROR_SERVICE" = "1" ]; then if [ "$HANDLE_MIRROR_SERVICE" = 1 ]; then
set_service systemd deactivate lvm2-cmirrord.service set_service systemd deactivate lvm2-cmirrord.service
fi fi
fi fi
# System V init scripts # System V init scripts
elif [ -n "$SERVICE_BIN" ] && [ -n "$CHKCONFIG_BIN" ]; then elif [ -n "$SERVICE_BIN" ] && [ -n "$CHKCONFIG_BIN" ]; then
if [ "$USE_LVMETAD" = "0" ]; then if [ "$USE_LVMETAD" = 0 ]; then
set_service sysv deactivate lvm2-lvmetad set_service sysv deactivate lvm2-lvmetad
else else
set_service sysv activate lvm2-lvmetad set_service sysv activate lvm2-lvmetad
fi fi
if [ "$LOCKING_TYPE" = "3" ]; then if [ "$LOCKING_TYPE" = 3 ]; then
set_service sysv activate clvmd set_service sysv activate clvmd
if [ "$HANDLE_MIRROR_SERVICE" = "1" ]; then if [ "$HANDLE_MIRROR_SERVICE" = 1 ]; then
set_service sysv activate cmirrord set_service sysv activate cmirrord
fi fi
else else
set_service sysv deactivate clvmd set_service sysv deactivate clvmd
if [ "$HANDLE_MIRROR_SERVICE" = "1" ]; then if [ "$HANDLE_MIRROR_SERVICE" = 1 ]; then
set_service sysv deactivate cmirrord set_service sysv deactivate cmirrord
fi fi
fi fi

View File

@ -100,7 +100,7 @@ done
NOW=$("$DATE" -u +%G%m%d%k%M%S | "$TR" -d ' ') NOW=$("$DATE" -u +%G%m%d%k%M%S | "$TR" -d ' ')
if test -n "$userdir"; then if test -n "$userdir"; then
dir="$userdir" dir=$userdir
else else
dirbase="lvmdump-$HOSTNAME-$NOW" dirbase="lvmdump-$HOSTNAME-$NOW"
dir="$HOME/$dirbase" dir="$HOME/$dirbase"
@ -127,7 +127,7 @@ log() {
} }
warnings() { warnings() {
if test "$UID" != "0" && test "$EUID" != "0"; then if test "$UID" != 0 && test "$EUID" != 0; then
myecho "WARNING! Running as non-privileged user, dump is likely incomplete!" myecho "WARNING! Running as non-privileged user, dump is likely incomplete!"
elif test "$DMSETUP" = ":"; then elif test "$DMSETUP" = ":"; then
myecho "WARNING! Could not run dmsetup, dump is likely incomplete." myecho "WARNING! Could not run dmsetup, dump is likely incomplete."
@ -163,7 +163,7 @@ if (( clustered )); then
{ {
for i in nodes status services; do for i in nodes status services; do
cap_i=$(echo $i|tr a-z A-Z) cap_i=$(echo "$i"|tr a-z A-Z)
echo "$cap_i:" echo "$cap_i:"
echo "----------------------------------" echo "----------------------------------"
log "cman_tool $i 2>> \"$log\"" log "cman_tool $i 2>> \"$log\""

View File

@ -25,7 +25,7 @@ READLINK=readlink
GETOPT=getopt GETOPT=getopt
# user may override lvm location by setting LVM_BINARY # user may override lvm location by setting LVM_BINARY
LVM="${LVM_BINARY:-lvm}" LVM=${LVM_BINARY:-lvm}
die() { die() {
code=$1; shift code=$1; shift
@ -45,7 +45,7 @@ function getvgname {
NEWVG=$3 NEWVG=$3
BNAME="${NEWVG:-${VG}}" BNAME="${NEWVG:-${VG}}"
NAME="${BNAME}" NAME=${BNAME}
I=0 I=0
while [[ "${VGLIST}" =~ :${NAME}: ]] while [[ "${VGLIST}" =~ :${NAME}: ]]
@ -131,7 +131,7 @@ while true
do do
case $1 in case $1 in
-n|--basevgname) -n|--basevgname)
NEWVG="$2"; shift; shift NEWVG=$2; shift; shift
;; ;;
-i|--import) -i|--import)
IMPORT=1; shift IMPORT=1; shift
@ -230,7 +230,7 @@ do
done done
export FILTER="filter=[ ${FILTER} \"r|.*|\" ]" export FILTER="filter=[ ${FILTER} \"r|.*|\" ]"
LVMCONF=${TMP_LVM_SYSTEM_DIR}/lvm.conf LVMCONF="${TMP_LVM_SYSTEM_DIR}/lvm.conf"
CMD_CONFIG_LINE="devices { \ CMD_CONFIG_LINE="devices { \
scan = [ \"${TMP_LVM_SYSTEM_DIR}\" ] \ scan = [ \"${TMP_LVM_SYSTEM_DIR}\" ] \
@ -278,7 +278,7 @@ while read -r VGNAME VGEXPORTED VGMISSINGPVCOUNT; do
fi fi
if [ "$VGEXPORTED" = "1" ]; then if [ "$VGEXPORTED" = "1" ]; then
if [ ${IMPORT} -eq 1 ]; then if [ "${IMPORT}" -eq 1 ]; then
"$LVM" vgimport ${LVM_OPTS} ${TEST_OPT} "${VGNAME}" "$LVM" vgimport ${LVM_OPTS} ${TEST_OPT} "${VGNAME}"
checkvalue $? "Volume Group ${VGNAME} could not be imported" checkvalue $? "Volume Group ${VGNAME} could not be imported"
else else
@ -318,12 +318,12 @@ fi
### update the device cache and make sure all ### update the device cache and make sure all
### the device nodes we need are straight ### the device nodes we need are straight
if [ ${CHANGES_MADE} -eq 1 ] if [ "${CHANGES_MADE}" -eq 1 ]
then then
# get global/use_lvmetad config and if set also notify lvmetad about changes # get global/use_lvmetad config and if set also notify lvmetad about changes
# since we were running LVM commands above with use_lvmetad=0 # since we were running LVM commands above with use_lvmetad=0
eval "$("$LVM" dumpconfig ${LVM_OPTS} global/use_lvmetad)" eval "$("$LVM" dumpconfig ${LVM_OPTS} global/use_lvmetad)"
if [ "$use_lvmetad" = "1" ] if [ "$use_lvmetad" = 1 ]
then then
echo "Notifying lvmetad about changes since it was disabled temporarily." echo "Notifying lvmetad about changes since it was disabled temporarily."
echo "(This resolves any WARNING message about restarting lvmetad that appears above.)" echo "(This resolves any WARNING message about restarting lvmetad that appears above.)"

View File

@ -22,31 +22,31 @@ expect_failure() {
} }
COROSYNC_CONF="/etc/corosync/corosync.conf" COROSYNC_CONF="/etc/corosync/corosync.conf"
COROSYNC_NODE="$(hostname)" COROSYNC_NODE=$(hostname)
create_corosync_conf() { create_corosync_conf() {
if test -a $COROSYNC_CONF; then if test -a "$COROSYNC_CONF"; then
if ! grep "created by lvm test suite" $COROSYNC_CONF; then if ! grep "created by lvm test suite" "$COROSYNC_CONF"; then
rm $COROSYNC_CONF rm "$COROSYNC_CONF"
else else
mv $COROSYNC_CONF $COROSYNC_CONF.prelvmtest mv "$COROSYNC_CONF" "$COROSYNC_CONF.prelvmtest"
fi fi
fi fi
sed -e "s/@LOCAL_NODE@/$COROSYNC_NODE/" lib/test-corosync-conf > $COROSYNC_CONF sed -e "s/@LOCAL_NODE@/$COROSYNC_NODE/" lib/test-corosync-conf > "$COROSYNC_CONF"
echo "created new $COROSYNC_CONF" echo "created new $COROSYNC_CONF"
} }
DLM_CONF="/etc/dlm/dlm.conf" DLM_CONF="/etc/dlm/dlm.conf"
create_dlm_conf() { create_dlm_conf() {
if test -a $DLM_CONF; then if test -a "$DLM_CONF"; then
if ! grep "created by lvm test suite" $DLM_CONF; then if ! grep "created by lvm test suite" "$DLM_CONF"; then
rm $DLM_CONF rm "$DLM_CONF"
else else
mv $DLM_CONF $DLM_CONF.prelvmtest mv "$DLM_CONF" "$DLM_CONF.prelvmtest"
fi fi
fi fi
cp lib/test-dlm-conf $DLM_CONF cp lib/test-dlm-conf "$DLM_CONF"
echo "created new $DLM_CONF" echo "created new $DLM_CONF"
} }
@ -81,15 +81,15 @@ prepare_dlm() {
SANLOCK_CONF="/etc/sanlock/sanlock.conf" SANLOCK_CONF="/etc/sanlock/sanlock.conf"
create_sanlock_conf() { create_sanlock_conf() {
if test -a $SANLOCK_CONF; then if test -a "$SANLOCK_CONF"; then
if ! grep "created by lvm test suite" $SANLOCK_CONF; then if ! grep "created by lvm test suite" "$SANLOCK_CONF"; then
rm $SANLOCK_CONF rm "$SANLOCK_CONF"
else else
mv $SANLOCK_CONF $SANLOCK_CONF.prelvmtest mv "$SANLOCK_CONF" "$SANLOCK_CONF.prelvmtest"
fi fi
fi fi
cp lib/test-sanlock-conf $SANLOCK_CONF cp lib/test-sanlock-conf "$SANLOCK_CONF"
echo "created new $SANLOCK_CONF" echo "created new $SANLOCK_CONF"
} }

View File

@ -40,7 +40,7 @@ lvdevices() {
mirror_images_redundant() { mirror_images_redundant() {
local vg=$1 local vg=$1
local lv=$vg/$2 local lv="$vg/$2"
lvs -a "$vg" -o+devices lvs -a "$vg" -o+devices
for i in $(lvdevices "$lv"); do for i in $(lvdevices "$lv"); do
echo "# $i:" echo "# $i:"
@ -77,7 +77,7 @@ lv_on() {
devs=( $(lvdevices "$1/$2" | sort | uniq ) ) devs=( $(lvdevices "$1/$2" | sort | uniq ) )
lv_on_diff_ devs[@] "${@}" lv_on_diff_ devs[@] "$@"
} }
# list devices for given LV and all its subdevices # list devices for given LV and all its subdevices
@ -87,7 +87,7 @@ lv_tree_on() {
# Get sorted list of devices # Get sorted list of devices
devs=( $(get lv_tree_devices "$1" "$2") ) devs=( $(get lv_tree_devices "$1" "$2") )
lv_on_diff_ devs[@] "${@}" lv_on_diff_ devs[@] "$@"
} }
mirror_images_on() { mirror_images_on() {
@ -112,14 +112,14 @@ mirror_log_on() {
} }
lv_is_contiguous() { lv_is_contiguous() {
local lv=$1/$2 local lv="$1/$2"
test "$(lvl --segments "$lv" | wc -l)" -eq 1 || \ test "$(lvl --segments "$lv" | wc -l)" -eq 1 || \
die "LV $lv expected to be contiguous, but is not:" \ die "LV $lv expected to be contiguous, but is not:" \
"$(lvl --segments "$lv")" "$(lvl --segments "$lv")"
} }
lv_is_clung() { lv_is_clung() {
local lv=$1/$2 local lv="$1/$2"
test "$(lvdevices "$lv" | sort | uniq | wc -l)" -eq 1 || \ test "$(lvdevices "$lv" | sort | uniq | wc -l)" -eq 1 || \
die "LV $lv expected to be clung, but is not:" \ die "LV $lv expected to be clung, but is not:" \
"$(lvdevices "$lv" | sort | uniq)" "$(lvdevices "$lv" | sort | uniq)"
@ -188,7 +188,7 @@ in_sync() {
local type local type
local snap="" local snap=""
local lvm_name="$1/$2" local lvm_name="$1/$2"
local ignore_a="$3" local ignore_a=$3
local dm_name local dm_name
dm_name=$(echo "$lvm_name" | sed s:-:--: | sed s:/:-:) dm_name=$(echo "$lvm_name" | sed s:-:--: | sed s:/:-:)

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2011-2014 Red Hat, Inc. # Copyright (C) 2011-2017 Red Hat, Inc.
# #
# This copyrighted material is made available to anyone wishing to use, # This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions # modify, copy, or redistribute it subject to the terms and conditions
@ -33,9 +33,9 @@ fi
case "$CMD" in case "$CMD" in
lvs|pvs|vgs|vgck|vgscan) lvs|pvs|vgs|vgck|vgscan)
test "${LVM_DEBUG_LEVEL:-0}" -lt 2 && RUN_DBG= ;; test "${LVM_DEBUG_LEVEL:-0}" -lt 2 && RUN_DBG="" ;;
pvcreate|pvremove|lvremove|vgcreate|vgremove) pvcreate|pvremove|lvremove|vgcreate|vgremove)
test "${LVM_DEBUG_LEVEL:-0}" -lt 1 && RUN_DBG= ;; test "${LVM_DEBUG_LEVEL:-0}" -lt 1 && RUN_DBG="" ;;
esac esac
# Capture parallel users of debug.log file # Capture parallel users of debug.log file
@ -48,6 +48,6 @@ esac
if test -n "$abs_top_builddir"; then if test -n "$abs_top_builddir"; then
exec $RUN_DBG "$abs_top_builddir/tools/lvm" $CMD "$@" exec $RUN_DBG "$abs_top_builddir/tools/lvm" $CMD "$@"
else # we are testing the lvm on $PATH else # we are testing the lvm on $PATH
PATH=$(echo "$PATH" | sed -e s,[^:]*lvm2-testsuite[^:]*:,,g) PATH=$(echo "$PATH" | sed -e 's,[^:]*lvm2-testsuite[^:]*:,,g')
exec $RUN_DBG lvm $CMD "$@" exec $RUN_DBG lvm $CMD "$@"
fi fi