mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
Substantial rework of the functional test support code. Some new features:
- somewhat neater, more consistent and more readable output - possible to set any lvm.conf value: aux lvmconf "section/key = value" - LVM_TEST_NODEBUG to suppress the (lengthy) "## DEBUG" output - back-substitution on test output ($TESTDIR/$PREFIX -> @TESTDIR@/@PREFIX@) - support code moved from test/ to test/lib/ --> less clutter
This commit is contained in:
parent
63bd9ec3ff
commit
1b7c4b9bce
@ -34,94 +34,73 @@ RUN_BASE = $(shell echo $(RUN) | xargs -n 1 echo | sed -e s,^$(srcdir)/,,)
|
||||
# Shell quote;
|
||||
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
||||
|
||||
SUPPORT := $(srcdir)/test-utils.sh \
|
||||
$(srcdir)/lvm-utils.sh
|
||||
|
||||
ifeq ("@UDEV_SYNC@", "yes")
|
||||
dm_udev_synchronisation = 1
|
||||
endif
|
||||
|
||||
all check: init.sh
|
||||
all check: .tests-stamp
|
||||
make -C api tests
|
||||
@echo Testing with locking_type 1
|
||||
VERBOSE=$(VERBOSE) ./bin/harness $(RUN_BASE)
|
||||
VERBOSE=$(VERBOSE) ./lib/harness $(RUN_BASE)
|
||||
@echo Testing with locking_type 3
|
||||
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./bin/harness $(RUN_BASE)
|
||||
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./lib/harness $(RUN_BASE)
|
||||
|
||||
check_cluster: init.sh
|
||||
check_cluster: .tests-stamp
|
||||
make -C api tests
|
||||
@echo Testing with locking_type 3
|
||||
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./bin/harness $(RUN_BASE)
|
||||
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./lib/harness $(RUN_BASE)
|
||||
|
||||
check_local: init.sh
|
||||
check_local: .tests-stamp
|
||||
make -C api tests
|
||||
@echo Testing with locking_type 1
|
||||
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=1 ./bin/harness $(RUN_BASE)
|
||||
VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=1 ./lib/harness $(RUN_BASE)
|
||||
|
||||
bin/not: $(srcdir)/not.c .bin-dir-stamp
|
||||
$(CC) -o bin/not $<
|
||||
ln -sf not bin/should
|
||||
lib/should: lib/not
|
||||
ln -sf not lib/should
|
||||
|
||||
bin/harness: $(srcdir)/harness.c .bin-dir-stamp
|
||||
$(CC) -o bin/harness $<
|
||||
lib/%: $(srcdir)/lib/%.c .lib-dir-stamp
|
||||
$(CC) -o $@ $<
|
||||
|
||||
bin/check: $(srcdir)/check.sh .bin-dir-stamp
|
||||
cp $< bin/check
|
||||
chmod +x bin/check
|
||||
lib/%: $(srcdir)/lib/%.sh .lib-dir-stamp
|
||||
cp $< $@
|
||||
chmod +x $@
|
||||
|
||||
init.sh: $(srcdir)/Makefile.in .bin-dir-stamp bin/not bin/check bin/harness $(RUN) $(SUPPORT) $(UNIT)
|
||||
rm -f $@-t $@
|
||||
lib/paths: $(srcdir)/Makefile.in .lib-dir-stamp
|
||||
rm -f $@-t
|
||||
echo 'top_srcdir=$(top_srcdir)' >> $@-t
|
||||
echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t
|
||||
echo 'abs_top_srcdir=$(abs_top_builddir)' >> $@-t
|
||||
echo 'PATH=$$abs_top_builddir/test/bin:$$PATH' >> $@-t
|
||||
LDLPATH="\$$abs_top_builddir/libdm"; \
|
||||
LDLPATH="$$LDLPATH:\$$abs_top_builddir/tools"; \
|
||||
LDLPATH="$$LDLPATH:\$$abs_top_builddir/liblvm"; \
|
||||
LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd"; \
|
||||
LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd/plugins/lvm2"; \
|
||||
LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd/plugins/mirror"; \
|
||||
LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd/plugins/snapshot"; \
|
||||
echo "export LD_LIBRARY_PATH=\"$$LDLPATH\"" >> $@-t
|
||||
echo 'top_srcdir=$(top_srcdir)' >> $@-t
|
||||
echo 'abs_srcdir=$(abs_srcdir)' >> $@-t
|
||||
echo 'abs_builddir=$(abs_builddir)' >> $@-t
|
||||
echo 'export PATH' >> $@-t
|
||||
echo 'export DM_UDEV_SYNCHRONISATION=$(dm_udev_synchronisation)' >> $@-t
|
||||
chmod a-w $@-t
|
||||
mv $@-t $@
|
||||
|
||||
LIB = lib/not lib/should lib/harness \
|
||||
lib/check lib/aux lib/test lib/utils lib/get lib/lvm-wrapper \
|
||||
lib/paths
|
||||
|
||||
.tests-stamp: $(RUN) $(LIB)
|
||||
@if test "$(srcdir)" != . ; then \
|
||||
echo "Copying tests to builddir."; \
|
||||
cp $(SUPPORT) .; \
|
||||
for f in $(RUN); do cp $$f `echo $$f | sed -e s,^$(srcdir)/,,`; done; \
|
||||
fi
|
||||
touch .tests-stamp
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
|
||||
.bin-dir-stamp: lvm-wrapper
|
||||
rm -rf bin
|
||||
mkdir bin
|
||||
.lib-dir-stamp:
|
||||
mkdir -p lib
|
||||
for i in lvm $$(cat ../tools/.commands); do \
|
||||
ln -s ../lvm-wrapper bin/$$i; \
|
||||
ln -fs lvm-wrapper lib/$$i; \
|
||||
done
|
||||
ln -s "$(abs_top_builddir)/tools/dmsetup" bin/dmsetup
|
||||
ln -s "$(abs_top_builddir)/daemons/clvmd/clvmd" bin/clvmd
|
||||
ln -s "$(abs_top_builddir)/daemons/dmeventd/dmeventd" bin/dmeventd
|
||||
ln -s "$(abs_top_builddir)/tools/dmsetup" lib/dmsetup
|
||||
ln -s "$(abs_top_builddir)/daemons/clvmd/clvmd" lib/clvmd
|
||||
ln -s "$(abs_top_builddir)/daemons/dmeventd/dmeventd" lib/dmeventd
|
||||
touch $@
|
||||
|
||||
lvm-wrapper: Makefile
|
||||
rm -f $@-t $@
|
||||
echo '#!/bin/sh' > $@-t
|
||||
echo 'cmd=$$(echo ./$$0|sed "s,.*/,,")' >> $@-t
|
||||
echo 'test "$$cmd" = lvm &&' >> $@-t
|
||||
echo 'exec "$(abs_top_builddir)/tools/lvm" "$$@"' >> $@-t
|
||||
echo 'exec "$(abs_top_builddir)/tools/lvm" "$$cmd" "$$@"' >> $@-t
|
||||
chmod a-w,a+x $@-t
|
||||
mv $@-t $@
|
||||
|
||||
clean:
|
||||
rm -rf init.sh lvm-wrapper bin .bin-dir-stamp
|
||||
rm -rf bin .lib-dir-stamp .test-stamp
|
||||
if test "$(srcdir)" != . ; then rm -f $(subst $(srcdir)/, ,$(RUN)) lvm2app.sh ; fi
|
||||
|
||||
distclean: clean
|
||||
|
@ -11,13 +11,14 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 2
|
||||
vgcreate -c n -s 4k $vg $devs
|
||||
vgcreate -c n -s 4k $vg $(cat DEVICES)
|
||||
lvcreate -n foo $vg -l 5
|
||||
lvcreate -s -n snap $vg/foo -l 2 -c 4k
|
||||
lvcreate -s -n snap2 $vg/foo -l 6 -c 4k
|
||||
dd if=/dev/urandom of=$DM_DEV_DIR/$vg/snap2 count=1 bs=1024
|
||||
lvcreate -m 1 -n mirr $vg -l 1 --mirrorlog core
|
||||
lvs
|
||||
apitest percent $vg
|
||||
aux apitest percent $vg
|
||||
|
@ -12,7 +12,7 @@
|
||||
# tests lvm2app library
|
||||
#
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
aux prepare_devs 2
|
||||
pvcreate $dev1 $dev2
|
||||
apitest vgtest $vg1 $dev1 $dev2
|
||||
aux apitest vgtest $vg1 $dev1 $dev2
|
||||
|
367
test/lib/aux.sh
Normal file
367
test/lib/aux.sh
Normal file
@ -0,0 +1,367 @@
|
||||
# Copyright (C) 2011 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. lib/utils
|
||||
|
||||
prepare_clvmd() {
|
||||
if test -z "$LVM_TEST_LOCKING" || test "$LVM_TEST_LOCKING" -ne 3 ; then
|
||||
return 0 # not needed
|
||||
fi
|
||||
|
||||
if pgrep clvmd ; then
|
||||
echo "Cannot use fake cluster locking with real clvmd ($(pgrep clvmd)) running."
|
||||
touch SKIP_THIS_TEST
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# skip if we don't have our own clvmd...
|
||||
(which clvmd | grep $abs_builddir) || exit 200
|
||||
|
||||
# skip if we singlenode is not compiled in
|
||||
(clvmd --help 2>&1 | grep "Available cluster managers" | grep singlenode) || exit 200
|
||||
|
||||
clvmd -Isinglenode -d 1 &
|
||||
LOCAL_CLVMD="$!"
|
||||
|
||||
# check that it is really running now
|
||||
sleep .1
|
||||
ps $LOCAL_CLVMD || exit 200
|
||||
}
|
||||
|
||||
prepare_dmeventd() {
|
||||
if pgrep dmeventd ; then
|
||||
echo "Cannot test dmeventd with real dmeventd ($(pgrep dmeventd)) running."
|
||||
touch SKIP_THIS_TEST
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# skip if we don't have our own dmeventd...
|
||||
(which dmeventd | grep $abs_builddir) || exit 200
|
||||
|
||||
dmeventd -f &
|
||||
echo "$!" > LOCAL_DMEVENTD
|
||||
}
|
||||
|
||||
teardown_devs() {
|
||||
test -n "$PREFIX" && {
|
||||
rm -rf $TESTDIR/dev/$PREFIX*
|
||||
|
||||
init_udev_transaction
|
||||
while dmsetup table | grep -q ^$PREFIX; do
|
||||
for s in `dmsetup info -c -o name --noheading | grep ^$PREFIX`; do
|
||||
umount -fl $DM_DEV_DIR/mapper/$s >& /dev/null || true
|
||||
dmsetup remove $s >& /dev/null || true
|
||||
done
|
||||
done
|
||||
finish_udev_transaction
|
||||
|
||||
}
|
||||
|
||||
# NOTE: SCSI_DEBUG_DEV test must come before the LOOP test because
|
||||
# prepare_scsi_debug_dev() also sets LOOP to short-circuit prepare_loop()
|
||||
if test -f SCSI_DEBUG_DEV; then
|
||||
modprobe -r scsi_debug
|
||||
else
|
||||
test -f LOOP && losetup -d $(cat LOOP)
|
||||
test -f LOOPFILE && rm -f $(cat LOOPFILE)
|
||||
fi
|
||||
rm -f DEVICES # devs is set in prepare_devs()
|
||||
rm -f LOOP
|
||||
}
|
||||
|
||||
teardown() {
|
||||
echo -n "## teardown..."
|
||||
|
||||
test -n "$LOCAL_CLVMD" && {
|
||||
kill "$LOCAL_CLVMD"
|
||||
sleep .1
|
||||
kill -9 "$LOCAL_CLVMD" || true
|
||||
}
|
||||
|
||||
echo -n .
|
||||
|
||||
test -f LOCAL_DMEVENTD && kill -9 "$(cat LOCAL_DMEVENTD)"
|
||||
|
||||
echo -n .
|
||||
|
||||
teardown_devs
|
||||
|
||||
echo -n .
|
||||
|
||||
test -n "$TESTDIR" && {
|
||||
cd $OLDPWD
|
||||
rm -rf $TESTDIR || echo BLA
|
||||
}
|
||||
|
||||
echo "ok"
|
||||
}
|
||||
|
||||
make_ioerror() {
|
||||
echo 0 10000000 error | dmsetup create ioerror
|
||||
ln -s $DM_DEV_DIR/mapper/ioerror $DM_DEV_DIR/ioerror
|
||||
}
|
||||
|
||||
prepare_loop() {
|
||||
size=$1
|
||||
test -n "$size" || size=32
|
||||
|
||||
echo -n "## preparing loop device..."
|
||||
|
||||
# skip if prepare_scsi_debug_dev() was used
|
||||
if [ -f "SCSI_DEBUG_DEV" -a -f "LOOP" ]; then
|
||||
echo "(skipped)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
test ! -e LOOP
|
||||
test -n "$DM_DEV_DIR"
|
||||
|
||||
for i in 0 1 2 3 4 5 6 7; do
|
||||
test -e $DM_DEV_DIR/loop$i || mknod $DM_DEV_DIR/loop$i b 7 $i
|
||||
done
|
||||
|
||||
echo -n .
|
||||
|
||||
LOOPFILE="$PWD/test.img"
|
||||
dd if=/dev/zero of="$LOOPFILE" bs=$((1024*1024)) count=0 seek=$(($size-1)) 2> /dev/null
|
||||
if LOOP=`losetup -s -f "$LOOPFILE" 2>/dev/null`; then
|
||||
:
|
||||
elif LOOP=`losetup -f` && losetup $LOOP "$LOOPFILE"; then
|
||||
# no -s support
|
||||
:
|
||||
else
|
||||
# no -f support
|
||||
# Iterate through $DM_DEV_DIR/loop{,/}{0,1,2,3,4,5,6,7}
|
||||
for slash in '' /; do
|
||||
for i in 0 1 2 3 4 5 6 7; do
|
||||
local dev=$DM_DEV_DIR/loop$slash$i
|
||||
! losetup $dev >/dev/null 2>&1 || continue
|
||||
# got a free
|
||||
losetup "$dev" "$LOOPFILE"
|
||||
LOOP=$dev
|
||||
break
|
||||
done
|
||||
if [ -n "$LOOP" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
test -n "$LOOP" # confirm or fail
|
||||
echo "$LOOP" > LOOP
|
||||
echo "ok ($LOOP)"
|
||||
}
|
||||
|
||||
# A drop-in replacement for prepare_loop() that uses scsi_debug to create
|
||||
# a ramdisk-based SCSI device upon which all LVM devices will be created
|
||||
# - scripts must take care not to use a DEV_SIZE that will enduce OOM-killer
|
||||
prepare_scsi_debug_dev()
|
||||
{
|
||||
local DEV_SIZE="$1"
|
||||
shift
|
||||
local SCSI_DEBUG_PARAMS="$@"
|
||||
|
||||
test -f "SCSI_DEBUG_DEV" && return 0
|
||||
test -z "$LOOP"
|
||||
test -n "$DM_DEV_DIR"
|
||||
|
||||
# Skip test if awk isn't available (required for get_sd_devs_)
|
||||
which awk || exit 200
|
||||
|
||||
# Skip test if scsi_debug module is unavailable or is already in use
|
||||
modprobe --dry-run scsi_debug || exit 200
|
||||
lsmod | grep -q scsi_debug && exit 200
|
||||
|
||||
# Create the scsi_debug device and determine the new scsi device's name
|
||||
# NOTE: it will _never_ make sense to pass num_tgts param;
|
||||
# last param wins.. so num_tgts=1 is imposed
|
||||
modprobe scsi_debug dev_size_mb=$DEV_SIZE $SCSI_DEBUG_PARAMS num_tgts=1 || exit 200
|
||||
sleep 2 # allow for async Linux SCSI device registration
|
||||
|
||||
local DEBUG_DEV=/dev/$(grep -H scsi_debug /sys/block/*/device/model | cut -f4 -d /)
|
||||
[ -b $DEBUG_DEV ] || exit 1 # should not happen
|
||||
|
||||
# Create symlink to scsi_debug device in $DM_DEV_DIR
|
||||
SCSI_DEBUG_DEV="$DM_DEV_DIR/$(basename $DEBUG_DEV)"
|
||||
echo "$SCSI_DEBUG_DEV" > SCSI_DEBUG_DEV
|
||||
echo "$SCSI_DEBUG_DEV" > LOOP
|
||||
# Setting $LOOP provides means for prepare_devs() override
|
||||
ln -snf $DEBUG_DEV $SCSI_DEBUG_DEV
|
||||
return 0
|
||||
}
|
||||
|
||||
cleanup_scsi_debug_dev()
|
||||
{
|
||||
aux teardown_devs
|
||||
rm -f SCSI_DEBUG_DEV
|
||||
rm -f LOOP
|
||||
}
|
||||
|
||||
prepare_devs() {
|
||||
local n="$1"
|
||||
test -z "$n" && n=3
|
||||
local devsize="$2"
|
||||
test -z "$devsize" && devsize=34
|
||||
local pvname="$3"
|
||||
test -z "$pvname" && pvname="pv"
|
||||
|
||||
prepare_loop $(($n*$devsize))
|
||||
echo -n "## preparing $n devices..."
|
||||
|
||||
if ! loopsz=`blockdev --getsz $LOOP 2>/dev/null`; then
|
||||
loopsz=`blockdev --getsize $LOOP 2>/dev/null`
|
||||
fi
|
||||
|
||||
local size=$(($loopsz/$n))
|
||||
|
||||
init_udev_transaction
|
||||
for i in `seq 1 $n`; do
|
||||
local name="${PREFIX}$pvname$i"
|
||||
local dev="$DM_DEV_DIR/mapper/$name"
|
||||
devs="$devs $dev"
|
||||
echo 0 $size linear $LOOP $((($i-1)*$size)) > $name.table
|
||||
dmsetup create $name $name.table
|
||||
done
|
||||
finish_udev_transaction
|
||||
|
||||
#for i in `seq 1 $n`; do
|
||||
# local name="${PREFIX}$pvname$i"
|
||||
# dmsetup info -c $name
|
||||
#done
|
||||
#for i in `seq 1 $n`; do
|
||||
# local name="${PREFIX}$pvname$i"
|
||||
# dmsetup table $name
|
||||
#done
|
||||
|
||||
echo $devs > DEVICES
|
||||
echo "ok"
|
||||
}
|
||||
|
||||
disable_dev() {
|
||||
|
||||
init_udev_transaction
|
||||
for dev in "$@"; do
|
||||
# first we make the device inaccessible
|
||||
echo 0 10000000 error | dmsetup load $dev
|
||||
dmsetup resume $dev
|
||||
# now let's try to get rid of it if it's unused
|
||||
#dmsetup remove $dev
|
||||
done
|
||||
finish_udev_transaction
|
||||
|
||||
}
|
||||
|
||||
enable_dev() {
|
||||
|
||||
init_udev_transaction
|
||||
for dev in "$@"; do
|
||||
local name=`echo "$dev" | sed -e 's,.*/,,'`
|
||||
dmsetup create $name $name.table || dmsetup load $name $name.table
|
||||
dmsetup resume $dev
|
||||
done
|
||||
finish_udev_transaction
|
||||
}
|
||||
|
||||
backup_dev() {
|
||||
for dev in "$@"; do
|
||||
dd if=$dev of=$dev.backup bs=1024
|
||||
done
|
||||
}
|
||||
|
||||
restore_dev() {
|
||||
for dev in "$@"; do
|
||||
test -e $dev.backup || {
|
||||
echo "Internal error: $dev not backed up, can't restore!"
|
||||
exit 1
|
||||
}
|
||||
dd of=$dev if=$dev.backup bs=1024
|
||||
done
|
||||
}
|
||||
|
||||
prepare_pvs() {
|
||||
prepare_devs "$@"
|
||||
pvcreate -ff $devs
|
||||
}
|
||||
|
||||
prepare_vg() {
|
||||
vgremove -ff $vg >& /dev/null || true
|
||||
teardown_devs
|
||||
|
||||
prepare_pvs "$@"
|
||||
vgcreate -c n $vg $devs
|
||||
#pvs -v
|
||||
}
|
||||
|
||||
lvmconf() {
|
||||
if test -z "$LVM_TEST_LOCKING"; then LVM_TEST_LOCKING=1; fi
|
||||
test -f CONFIG_VALUES || {
|
||||
cat > CONFIG_VALUES <<-EOF
|
||||
devices/dir = "$DM_DEV_DIR"
|
||||
devices/scan = "$DM_DEV_DIR"
|
||||
devices/filter = [ "a/dev\/mirror/", "a/dev\/mapper\/.*pv[0-9_]*$/", "r/.*/" ]
|
||||
devices/cache_dir = "$TESTDIR/etc"
|
||||
devices/sysfs_scan = 0
|
||||
devices/default_data_alignment = 1
|
||||
log/syslog = 0
|
||||
log/indent = 1
|
||||
log/level = 9
|
||||
log/file = "$TESTDIR/debug.log"
|
||||
log/overwrite = 1
|
||||
log/activation = 1
|
||||
backup/backup = 0
|
||||
backup/archive = 0
|
||||
global/abort_on_internal_errors = 1
|
||||
global/library_dir = "$TESTDIR/lib"
|
||||
global/locking_dir = "$TESTDIR/var/lock/lvm"
|
||||
global/locking_type=$LVM_TEST_LOCKING
|
||||
global/si_unit_consistency = 1
|
||||
global/fallback_to_local_locking = 0
|
||||
activation/udev_sync = 1
|
||||
activation/udev_rules = 1
|
||||
activation/polling_interval = 0
|
||||
activation/snapshot_autoextend_percent = 50
|
||||
activation/snapshot_autoextend_threshold = 50
|
||||
EOF
|
||||
}
|
||||
|
||||
for v in "$@"; do
|
||||
echo "$v" >> CONFIG_VALUES
|
||||
done
|
||||
|
||||
rm -f CONFIG
|
||||
for s in `cat CONFIG_VALUES | cut -f1 -d/ | sort | uniq`; do
|
||||
echo "$s {" >> CONFIG
|
||||
for k in `grep ^$s/ CONFIG_VALUES | cut -f1 -d= | sed -e 's, *$,,' | sort | uniq`; do
|
||||
grep "^$k" CONFIG_VALUES | tail -n 1 | sed -e "s,^$s/, ," >> CONFIG
|
||||
done
|
||||
echo "}" >> CONFIG
|
||||
echo >> CONFIG
|
||||
done
|
||||
mv -f CONFIG $TESTDIR/etc/lvm.conf
|
||||
}
|
||||
|
||||
apitest() {
|
||||
t=$1
|
||||
shift
|
||||
test -x $abs_top_builddir/test/api/$t.t || {
|
||||
touch SKIP_THIS_TEST
|
||||
exit 200
|
||||
}
|
||||
$abs_top_builddir/test/api/$t.t "$@"
|
||||
}
|
||||
|
||||
api() {
|
||||
test -x $abs_top_builddir/test/api/wrapper || exit 200
|
||||
$abs_top_builddir/test/api/wrapper "$@"
|
||||
}
|
||||
|
||||
test -f DEVICES && devs=$(cat DEVICES)
|
||||
test -f LOOP && LOOP=$(cat LOOP)
|
||||
|
||||
"$@"
|
@ -25,6 +25,14 @@
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
trim()
|
||||
{
|
||||
trimmed=${1%% }
|
||||
trimmed=${trimmed## }
|
||||
|
||||
echo "$trimmed"
|
||||
}
|
||||
|
||||
lvl() {
|
||||
lvs -a --noheadings "$@"
|
||||
}
|
||||
@ -195,4 +203,79 @@ inactive() {
|
||||
}
|
||||
}
|
||||
|
||||
pv_field()
|
||||
{
|
||||
actual=$(trim $(pvs --noheadings $4 -o $2 $1))
|
||||
|
||||
test "$actual" = "$3" || {
|
||||
echo "pv_field: PV=$1, field=$2, actual=$actual, expected=$3"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
vg_field()
|
||||
{
|
||||
actual=$(trim $(vgs --noheadings $4 -o $2 $1))
|
||||
test "$actual" = "$3" || {
|
||||
echo "vg_field: vg=$1, field=$2, actual=$actual, expected=$3"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
lv_field()
|
||||
{
|
||||
actual=$(trim $(lvs --noheadings $4 -o $2 $1))
|
||||
test "$actual" = "$3" || {
|
||||
echo "lv_field: lv=$1, field=$2, actual=$actual, expected=$3"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
compare_fields()
|
||||
{
|
||||
local cmd1=$1;
|
||||
local obj1=$2;
|
||||
local field1=$3;
|
||||
local cmd2=$4;
|
||||
local obj2=$5;
|
||||
local field2=$6;
|
||||
local val1;
|
||||
local val2;
|
||||
|
||||
val1=$($cmd1 --noheadings -o $field1 $obj1)
|
||||
val2=$($cmd2 --noheadings -o $field2 $obj2)
|
||||
test "$val1" = "$val2" || {
|
||||
echo "compare_fields $obj1($field1): $val1 $obj2($field2): $val2"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
compare_vg_field()
|
||||
{
|
||||
local vg1=$1;
|
||||
local vg2=$2;
|
||||
local field=$3;
|
||||
|
||||
val1=$(vgs --noheadings -o $field $vg1)
|
||||
val2=$(vgs --noheadings -o $field $vg2)
|
||||
test "$val1" = "$val2" || {
|
||||
echo "compare_vg_field: $vg1: $val1, $vg2: $val2"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
pvlv_counts()
|
||||
{
|
||||
local local_vg=$1
|
||||
local num_pvs=$2
|
||||
local num_lvs=$3
|
||||
local num_snaps=$4
|
||||
|
||||
lvs -a -o+devices $local_vg
|
||||
|
||||
vg_field $local_vg pv_count $num_pvs
|
||||
vg_field $local_vg lv_count $num_lvs
|
||||
vg_field $local_vg snap_count $num_snaps
|
||||
}
|
||||
|
||||
"$@"
|
23
test/lib/get.sh
Normal file
23
test/lib/get.sh
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (C) 2011 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
pv_field() {
|
||||
pvs --noheading -o $2 $1 | sed 's/^ *//'
|
||||
}
|
||||
|
||||
vg_field() {
|
||||
vgs --noheading -o $2 $1 | sed 's/^ *//'
|
||||
}
|
||||
|
||||
lv_field() {
|
||||
lvs --noheading -o $2 $1 | sed 's/^ *//'
|
||||
}
|
||||
|
||||
"$@"
|
@ -40,6 +40,17 @@ int readbuf_sz = 0, readbuf_used = 0;
|
||||
|
||||
int die = 0;
|
||||
int verbose = 0;
|
||||
int verbose_off = 0;
|
||||
|
||||
struct subst {
|
||||
char *key;
|
||||
char *value;
|
||||
};
|
||||
|
||||
struct subst subst[2];
|
||||
|
||||
char *TESTDIR = NULL;
|
||||
char *PREFIX = NULL;
|
||||
|
||||
#define PASSED 0
|
||||
#define SKIPPED 1
|
||||
@ -52,8 +63,60 @@ void handler( int s ) {
|
||||
die = s;
|
||||
}
|
||||
|
||||
int outline(char *buf, int start, int force) {
|
||||
char *from = buf + start;
|
||||
char *next = strchr(buf + start, '\n');
|
||||
|
||||
if (!next && !force) /* not a complete line yet... */
|
||||
return start;
|
||||
|
||||
if (!next)
|
||||
next = from + strlen(from);
|
||||
else
|
||||
++next;
|
||||
|
||||
if (!strncmp(from, "@TESTDIR=", 9)) {
|
||||
subst[0].key = "@TESTDIR@";
|
||||
subst[0].value = strndup(from + 9, next - from - 9 - 1);
|
||||
} else if (!strncmp(from, "@PREFIX=", 8)) {
|
||||
subst[1].key = "@PREFIX@";
|
||||
subst[1].value = strndup(from + 8, next - from - 8 - 1);
|
||||
} else {
|
||||
char *line = strndup(from, next - from);
|
||||
char *a = line, *b;
|
||||
do {
|
||||
b = line + strlen(line);
|
||||
int idx = -1;
|
||||
int i;
|
||||
for ( i = 0; i < 2; ++i ) {
|
||||
if (subst[i].key) {
|
||||
// printf("trying: %s -> %s\n", subst[i].value, subst[i].key);
|
||||
char *stop = strstr(a, subst[i].value);
|
||||
if (stop && stop < b) {
|
||||
idx = i;
|
||||
b = stop;
|
||||
}
|
||||
}
|
||||
}
|
||||
fwrite(a, 1, b - a, stdout);
|
||||
a = b;
|
||||
|
||||
if ( idx >= 0 ) {
|
||||
fprintf(stdout, "%s", subst[idx].key);
|
||||
a += strlen(subst[idx].value);
|
||||
}
|
||||
} while (b < line + strlen(line));
|
||||
free(line);
|
||||
}
|
||||
|
||||
return next - buf + (force ? 0 : 1);
|
||||
}
|
||||
|
||||
void dump() {
|
||||
fwrite(readbuf, 1, readbuf_used, stdout);
|
||||
int counter = 0;
|
||||
|
||||
while ( counter < readbuf_used )
|
||||
counter = outline( readbuf, counter, 1 );
|
||||
}
|
||||
|
||||
void clear() {
|
||||
@ -63,8 +126,10 @@ void clear() {
|
||||
void drain() {
|
||||
int sz;
|
||||
char buf[2048];
|
||||
memset(buf, 0, 2048);
|
||||
|
||||
while (1) {
|
||||
sz = read(fds[1], buf, 2048);
|
||||
sz = read(fds[1], buf, 2047);
|
||||
if (verbose)
|
||||
write(1, buf, sz);
|
||||
if (sz <= 0)
|
||||
@ -121,6 +186,8 @@ void run(int i, char *f) {
|
||||
close(0);
|
||||
dup2(fds[0], 1);
|
||||
dup2(fds[0], 2);
|
||||
close(fds[0]);
|
||||
close(fds[1]);
|
||||
execlp("bash", "bash", f, NULL);
|
||||
perror("execlp");
|
||||
fflush(stderr);
|
||||
@ -166,13 +233,9 @@ int main(int argc, char **argv) {
|
||||
|
||||
s.nwarned = s.nfailed = s.npassed = s.nskipped = 0;
|
||||
|
||||
char *config = getenv("LVM_TEST_CONFIG"),
|
||||
*config_debug,
|
||||
*be_verbose = getenv("VERBOSE");
|
||||
char *be_verbose = getenv("VERBOSE");
|
||||
if (be_verbose && atoi(be_verbose))
|
||||
verbose = 1; // XXX
|
||||
config = config ? config : "";
|
||||
asprintf(&config_debug, "%s\n%s\n", config, "log { verbose=4 }");
|
||||
|
||||
if (socketpair(PF_UNIX, SOCK_STREAM, 0, fds)) {
|
||||
perror("socketpair");
|
7
test/lib/lvm-wrapper.sh
Normal file
7
test/lib/lvm-wrapper.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
. lib/paths
|
||||
cmd=$(echo ./$0|sed "s,.*/,,")
|
||||
|
||||
test "$cmd" = lvm && exec "$abs_top_builddir/tools/lvm" "$@"
|
||||
exec "$abs_top_builddir/tools/lvm" "$cmd" "$@"
|
55
test/lib/test.sh
Normal file
55
test/lib/test.sh
Normal file
@ -0,0 +1,55 @@
|
||||
# Copyright (C) 2011 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# sanitize the environment
|
||||
LANG=C
|
||||
LC_ALL=C
|
||||
TZ=UTC
|
||||
|
||||
unset CDPATH
|
||||
|
||||
# grab some common utilities
|
||||
. lib/utils
|
||||
|
||||
OLDPWD="`pwd`"
|
||||
PREFIX="LVMTEST$$"
|
||||
|
||||
TESTDIR=$($abs_srcdir/mkdtemp ${LVM_TEST_DIR-$(pwd)} $PREFIX.XXXXXXXXXX) \
|
||||
|| { echo "failed to create temporary directory in ${LVM_TEST_DIR-$(pwd)}"; exit 1; }
|
||||
|
||||
export PREFIX
|
||||
export TESTDIR
|
||||
|
||||
trap 'set +vx; STACKTRACE; set -vx' ERR
|
||||
trap 'aux teardown' EXIT # don't forget to clean up
|
||||
|
||||
export LVM_SYSTEM_DIR=$TESTDIR/etc
|
||||
export DM_DEV_DIR=$TESTDIR/dev
|
||||
mkdir $LVM_SYSTEM_DIR $DM_DEV_DIR $DM_DEV_DIR/mapper $TESTDIR/lib
|
||||
|
||||
cd $TESTDIR
|
||||
|
||||
for i in `find $abs_top_builddir/daemons/dmeventd/plugins/ -name \*.so`; do
|
||||
#echo Setting up symlink from $i to $TESTDIR/lib
|
||||
ln -s $i $TESTDIR/lib
|
||||
done
|
||||
|
||||
ln -s $abs_top_builddir/test/lib/* $TESTDIR/lib
|
||||
|
||||
# re-do the utils now that we have TESTDIR/PREFIX/...
|
||||
. lib/utils
|
||||
|
||||
set -eE -o pipefail
|
||||
aux lvmconf
|
||||
aux prepare_clvmd
|
||||
echo "@TESTDIR=$TESTDIR"
|
||||
echo "@PREFIX=$PREFIX"
|
||||
|
||||
set -vx
|
80
test/lib/utils.sh
Normal file
80
test/lib/utils.sh
Normal file
@ -0,0 +1,80 @@
|
||||
# Copyright (C) 2011 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
set -e
|
||||
|
||||
STACKTRACE() {
|
||||
trap - ERR;
|
||||
i=0;
|
||||
|
||||
while FUNC=${FUNCNAME[$i]}; test "$FUNC" != "main"; do
|
||||
echo "## $i ${FUNC}() called from ${BASH_SOURCE[$i]}:${BASH_LINENO[$i]}"
|
||||
i=$(($i + 1));
|
||||
done
|
||||
|
||||
# Get backtraces from coredumps
|
||||
if which gdb >& /dev/null; then
|
||||
echo bt full > gdb_commands.txt
|
||||
echo l >> gdb_commands.txt
|
||||
echo quit >> gdb_commands.txt
|
||||
for core in `ls core* 2>/dev/null`; do
|
||||
bin=$(gdb -batch -c $core 2>&1 | grep "generated by" | \
|
||||
sed -e "s,.*generated by \`\([^ ']*\).*,\1,")
|
||||
gdb -batch -c $core -x gdb_commands.txt `which $bin`
|
||||
done
|
||||
fi
|
||||
|
||||
test -z "$LVM_TEST_NODEBUG" && test -f debug.log && {
|
||||
sed -e "s,^,## DEBUG: ,;s,$top_srcdir/\?,," < debug.log
|
||||
}
|
||||
|
||||
test -f SKIP_THIS_TEST && exit 200
|
||||
}
|
||||
|
||||
init_udev_transaction() {
|
||||
if test "$DM_UDEV_SYNCHRONISATION" = 1; then
|
||||
COOKIE=$(dmsetup udevcreatecookie)
|
||||
# Cookie is not generated if udev is not running!
|
||||
if test -n "$COOKIE"; then
|
||||
export DM_UDEV_COOKIE=$COOKIE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
finish_udev_transaction() {
|
||||
if test "$DM_UDEV_SYNCHRONISATION" = 1 -a -n "$DM_UDEV_COOKIE"; then
|
||||
dmsetup udevreleasecookie
|
||||
unset DM_UDEV_COOKIE
|
||||
fi
|
||||
}
|
||||
|
||||
. lib/paths || { echo >&2 you must run make first; exit 1; }
|
||||
|
||||
PATH=$abs_top_builddir/test/lib:$PATH
|
||||
LIBDIRS="libdm tools liblvm daemons/dmeventd daemons/dmeventd/plugins/lvm2 \
|
||||
daemons/dmeventd/plugins/mirror daemons/dmeventd/plugins/snapshot"
|
||||
|
||||
for d in $LIBDIRS; do
|
||||
LD_LIBRARY_PATH=$abs_top_builddir/$d:$LD_LIBRARY_PATH
|
||||
done
|
||||
export LD_LIBRARY_PATH
|
||||
|
||||
if test -n "$PREFIX"; then
|
||||
vg=${PREFIX}vg
|
||||
lv=LV
|
||||
|
||||
for i in `seq 1 16`; do
|
||||
name="${PREFIX}pv$i"
|
||||
dev="$DM_DEV_DIR/mapper/$name"
|
||||
eval "dev$i=$dev"
|
||||
eval "lv$i=LV$i"
|
||||
eval "vg$i=${PREFIX}vg$i"
|
||||
done
|
||||
fi
|
@ -8,7 +8,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
lvm version
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
||||
# instead lvconvert --repair them?)
|
||||
# - linear LVs with bits missing are not activated
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
prepare_vg 4
|
||||
aux prepare_vg 4
|
||||
|
||||
lvcreate -l1 -n linear1 $vg $dev1
|
||||
lvcreate -l1 -n linear2 $vg $dev2
|
||||
@ -32,7 +32,7 @@ lvcreate -l1 -m1 -n mirror12 --mirrorlog core $vg $dev1 $dev2
|
||||
lvcreate -l1 -m1 -n mirror123 $vg $dev1 $dev2 $dev3
|
||||
|
||||
vgchange -a n $vg
|
||||
disable_dev $dev1
|
||||
aux disable_dev $dev1
|
||||
not vgchange -a y $vg
|
||||
not vgck $vg
|
||||
|
||||
@ -45,8 +45,8 @@ check inactive $vg mirror12
|
||||
check inactive $vg mirror123
|
||||
|
||||
vgchange -a n $vg
|
||||
enable_dev $dev1
|
||||
disable_dev $dev2
|
||||
aux enable_dev $dev1
|
||||
aux disable_dev $dev2
|
||||
not vgchange -a y $vg
|
||||
not vgck $vg
|
||||
|
||||
@ -59,8 +59,8 @@ check inactive $vg mirror12
|
||||
check inactive $vg mirror123
|
||||
|
||||
vgchange -a n $vg
|
||||
enable_dev $dev2
|
||||
disable_dev $dev3
|
||||
aux enable_dev $dev2
|
||||
aux disable_dev $dev3
|
||||
not vgchange -a y $vg
|
||||
not vgck $vg
|
||||
|
||||
@ -73,8 +73,8 @@ check inactive $vg mirror123
|
||||
check active $vg mirror12
|
||||
|
||||
vgchange -a n $vg
|
||||
enable_dev $dev3
|
||||
disable_dev $dev4
|
||||
aux enable_dev $dev3
|
||||
aux disable_dev $dev4
|
||||
vgchange -a y $vg
|
||||
not vgck $vg
|
||||
|
||||
|
@ -8,13 +8,13 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_vg 3
|
||||
|
||||
lvcreate -m 1 -l 1 -n mirror $vg
|
||||
lvchange -a n $vg/mirror
|
||||
disable_dev $dev1
|
||||
aux disable_dev $dev1
|
||||
|
||||
not vgreduce --removemissing $vg
|
||||
not lvchange -v -a y $vg/mirror
|
||||
|
@ -12,7 +12,7 @@
|
||||
# tests basic functionality of read-ahead and ra regressions
|
||||
#
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
TEST_UUID="aaaaaa-aaaa-aaaa-aaaa-aaaa-aaaa-aaaaaa"
|
||||
|
||||
@ -31,7 +31,7 @@ pvcreate --metadatacopies 0 $dev2
|
||||
pvcreate --metadatacopies 0 $dev3
|
||||
pvcreate $dev4
|
||||
pvcreate --norestorefile -u $TEST_UUID --metadatacopies 0 $dev5
|
||||
vgcreate -c n $vg $devs
|
||||
vgcreate -c n $vg $(cat DEVICES)
|
||||
lvcreate -n $lv -l 5 -i5 -I256 $vg
|
||||
|
||||
# test *scan and *display tools
|
||||
|
@ -9,10 +9,10 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
prepare_vg 5
|
||||
prepare_dmeventd
|
||||
aux prepare_vg 5
|
||||
aux prepare_dmeventd
|
||||
|
||||
which mkfs.ext2 || exit 200
|
||||
|
||||
@ -22,7 +22,7 @@ lvcreate -m 2 --ig -L 1 -n 3way $vg
|
||||
lvchange --monitor y $vg/3way
|
||||
|
||||
dmeventd -R -f &
|
||||
LOCAL_DMEVENTD="$!"
|
||||
echo "$!" > LOCAL_DMEVENTD
|
||||
|
||||
sleep 1 # wait a bit, so we talk to the new dmeventd later
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
test_description='Exercise fsadm filesystem resize'
|
||||
exit 200
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_vg 1 100
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_vg 3
|
||||
|
||||
@ -17,14 +17,14 @@ lvcreate -m 1 -l 1 -n mirror $vg
|
||||
lvcreate -l 1 -n resized $vg
|
||||
lvchange -a n $vg/mirror
|
||||
|
||||
backup_dev $devs
|
||||
aux backup_dev $(cat DEVICES)
|
||||
|
||||
init() {
|
||||
restore_dev $devs
|
||||
aux restore_dev $(cat DEVICES)
|
||||
lvs -o lv_name,lv_size --units k $vg | tee lvs.out
|
||||
grep resized lvs.out | not grep 8192
|
||||
lvresize -L 8192K $vg/resized
|
||||
restore_dev $dev1
|
||||
aux restore_dev $dev1
|
||||
}
|
||||
|
||||
check() {
|
||||
@ -66,10 +66,10 @@ check
|
||||
|
||||
echo Check auto-repair of failed vgextend - metadata written to original pv but not new pv
|
||||
vgremove -f $vg
|
||||
pvremove -ff $devs
|
||||
pvcreate $devs
|
||||
backup_dev $dev2
|
||||
pvremove -ff $(cat DEVICES)
|
||||
pvcreate $(cat DEVICES)
|
||||
aux backup_dev $dev2
|
||||
vgcreate $vg $dev1
|
||||
vgextend $vg $dev2
|
||||
restore_dev $dev2
|
||||
should compare_two_fields_ vgs $vg vg_mda_count pvs $dev2 vg_mda_count
|
||||
aux restore_dev $dev2
|
||||
should check compare_fields vgs $vg vg_mda_count pvs $dev2 vg_mda_count
|
||||
|
@ -12,7 +12,7 @@
|
||||
# tests functionality of lvs, pvs, vgs, *display tools
|
||||
#
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
get_lvs_()
|
||||
{
|
||||
@ -38,16 +38,16 @@ test $(wc -l <out) -eq 5
|
||||
pvs --noheadings -o seg_all,pv_all,lv_all,vg_all | tee out
|
||||
test $(wc -l <out) -eq 5
|
||||
|
||||
vgcreate -c n $vg $devs
|
||||
vgcreate -c n $vg $(cat DEVICES)
|
||||
|
||||
#COMM pvs and vgs report mda_count, mda_free (bz202886, bz247444)
|
||||
pvs -o +pv_mda_count,pv_mda_free $devs
|
||||
pvs -o +pv_mda_count,pv_mda_free $(cat DEVICES)
|
||||
for I in $dev2 $dev3 $dev5; do
|
||||
aux check_pv_field_ $I pv_mda_count 0
|
||||
aux check_pv_field_ $I pv_mda_free 0
|
||||
check pv_field $I pv_mda_count 0
|
||||
check pv_field $I pv_mda_free 0
|
||||
done
|
||||
vgs -o +vg_mda_count,vg_mda_free $vg
|
||||
aux check_vg_field_ $vg vg_mda_count 2
|
||||
check vg_field $vg vg_mda_count 2
|
||||
|
||||
#COMM pvs doesn't display --metadatacopies 0 PVs as orphans (bz409061)
|
||||
pvdisplay $dev2|grep "VG Name.*$vg"
|
||||
@ -77,7 +77,7 @@ vgs -o pv_name,vg_name $vg
|
||||
# would complain if not
|
||||
|
||||
#COMM pvdisplay --maps feature (bz149814)
|
||||
pvdisplay $devs >out
|
||||
pvdisplay --maps $devs >out2
|
||||
pvdisplay $(cat DEVICES) >out
|
||||
pvdisplay --maps $(cat DEVICES) >out2
|
||||
not diff out out2
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
test_description='test some blocking / non-blocking multi-vg operations'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 3
|
||||
test -n "$LOCAL_CLVMD" && exit 200
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
aux prepare_vg 3
|
||||
|
||||
# force resync 2-way active mirror
|
||||
|
@ -8,7 +8,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
log_name_to_count()
|
||||
{
|
||||
@ -83,7 +83,7 @@ test_lvconvert()
|
||||
max_log_count=$start_log_count
|
||||
fi
|
||||
|
||||
prepare_vg 5
|
||||
aux prepare_vg 5
|
||||
|
||||
if [ $start_count -gt 0 ]; then
|
||||
# Are there extra devices for the log or do we overlap
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
# convert from linear to 2-way mirror
|
||||
aux prepare_vg 5
|
||||
|
@ -9,18 +9,18 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
prepare_vg 5
|
||||
prepare_dmeventd
|
||||
aux prepare_vg 5
|
||||
aux prepare_dmeventd
|
||||
|
||||
which mkfs.ext2 || exit 200
|
||||
|
||||
lvcreate -m 3 --ig -L 1 -n 4way $vg
|
||||
lvchange --monitor y $vg/4way
|
||||
disable_dev $dev2 $dev4
|
||||
aux disable_dev $dev2 $dev4
|
||||
mkfs.ext2 $DM_DEV_DIR/$vg/4way
|
||||
sleep 10 # FIXME: need a "poll" utility, akin to "check"
|
||||
enable_dev $dev2 $dev4
|
||||
aux enable_dev $dev2 $dev4
|
||||
check mirror $vg 4way
|
||||
check mirror_legs $vg 4way 2
|
||||
|
@ -9,16 +9,16 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
prepare_vg 4
|
||||
aux prepare_vg 4
|
||||
|
||||
# Clean-up and create a 2-way mirror, where the the
|
||||
# leg devices are always on $dev[12] and the log
|
||||
# is always on $dev3. ($dev4 behaves as a spare)
|
||||
cleanup() {
|
||||
vgreduce --removemissing $vg
|
||||
for d in "$@"; do enable_dev $d; done
|
||||
for d in "$@"; do aux enable_dev $d; done
|
||||
for d in "$@"; do vgextend $vg $d; done
|
||||
lvremove -ff $vg/mirror
|
||||
lvcreate -m 1 --ig -l 2 -n mirror $vg $dev1 $dev2 $dev3:0
|
||||
@ -36,7 +36,7 @@ aux disable_dev $dev1
|
||||
lvchange --partial -a y $vg/mirror
|
||||
repair 'activation { mirror_image_fault_policy = "remove" }'
|
||||
check linear $vg mirror
|
||||
aux cleanup $dev1
|
||||
cleanup $dev1
|
||||
|
||||
# Fail a leg of a mirror.
|
||||
# Expected result: Mirror (leg replaced)
|
||||
@ -44,7 +44,7 @@ aux disable_dev $dev1
|
||||
repair 'activation { mirror_image_fault_policy = "replace" }'
|
||||
check mirror $vg mirror
|
||||
lvs | grep mirror_mlog
|
||||
aux cleanup $dev1
|
||||
cleanup $dev1
|
||||
|
||||
# Fail a leg of a mirror (use old name for policy specification)
|
||||
# Expected result: Mirror (leg replaced)
|
||||
@ -52,7 +52,7 @@ aux disable_dev $dev1
|
||||
repair 'activation { mirror_device_fault_policy = "replace" }'
|
||||
check mirror $vg mirror
|
||||
lvs | grep mirror_mlog
|
||||
aux cleanup $dev1
|
||||
cleanup $dev1
|
||||
|
||||
# Fail a leg of a mirror w/ no available spare
|
||||
# Expected result: 2-way with corelog
|
||||
@ -60,7 +60,7 @@ aux disable_dev $dev2 $dev4
|
||||
repair 'activation { mirror_image_fault_policy = "replace" }'
|
||||
check mirror $vg mirror
|
||||
lvs | not grep mirror_mlog
|
||||
aux cleanup $dev2 $dev4
|
||||
cleanup $dev2 $dev4
|
||||
|
||||
# Fail the log device of a mirror w/ no available spare
|
||||
# Expected result: mirror w/ corelog
|
||||
@ -68,7 +68,7 @@ aux disable_dev $dev3 $dev4
|
||||
repair 'activation { mirror_image_fault_policy = "replace" }' $vg/mirror
|
||||
check mirror $vg mirror
|
||||
lvs | not grep mirror_mlog
|
||||
aux cleanup $dev3 $dev4
|
||||
cleanup $dev3 $dev4
|
||||
|
||||
# Fail the log device with a remove policy
|
||||
# Expected result: mirror w/ corelog
|
||||
|
@ -9,43 +9,43 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
prepare_vg 6
|
||||
aux prepare_vg 6
|
||||
|
||||
# multiple failures, full replace
|
||||
lvcreate --mirrorlog disk -m 2 --ig -L 1 -n 3way $vg $dev1 $dev2 $dev3 $dev4:0-1
|
||||
disable_dev $dev1 $dev2
|
||||
aux disable_dev $dev1 $dev2
|
||||
echo y | lvconvert --repair $vg/3way 2>&1 | tee 3way.out
|
||||
lvs -a -o +devices | not grep unknown
|
||||
not grep "WARNING: Failed" 3way.out
|
||||
vgreduce --removemissing $vg
|
||||
check mirror $vg 3way
|
||||
enable_dev $dev1 $dev2
|
||||
aux enable_dev $dev1 $dev2
|
||||
|
||||
vgremove -ff $vg; vgcreate -c n $vg $dev1 $dev2 $dev3 $dev4 $dev5
|
||||
|
||||
# multiple failures, partial replace
|
||||
lvcreate --mirrorlog disk -m 2 --ig -L 1 -n 3way $vg $dev1 $dev2 $dev3 $dev4
|
||||
disable_dev $dev1 $dev2
|
||||
aux disable_dev $dev1 $dev2
|
||||
echo y | lvconvert --repair $vg/3way 2>&1 | tee 3way.out
|
||||
grep "WARNING: Failed" 3way.out
|
||||
lvs -a -o +devices | not grep unknown
|
||||
vgreduce --removemissing $vg
|
||||
check mirror $vg 3way
|
||||
enable_dev $dev1 $dev2
|
||||
aux enable_dev $dev1 $dev2
|
||||
lvchange -a n $vg/3way
|
||||
|
||||
vgremove -ff $vg; vgcreate -c n $vg $dev1 $dev2 $dev3
|
||||
|
||||
lvcreate --mirrorlog disk -m 1 --ig -L 1 -n 2way $vg $dev1 $dev2 $dev3
|
||||
disable_dev $dev1
|
||||
aux disable_dev $dev1
|
||||
echo y | lvconvert --repair $vg/2way 2>&1 | tee 2way.out
|
||||
grep "WARNING: Failed" 2way.out
|
||||
lvs -a -o +devices | not grep unknown
|
||||
vgreduce --removemissing $vg
|
||||
check mirror $vg 2way
|
||||
enable_dev $dev1 $dev2
|
||||
aux enable_dev $dev1 $dev2
|
||||
lvchange -a n $vg/2way
|
||||
|
||||
vgremove -ff $vg; vgcreate -c n $vg $dev1 $dev2 $dev3 $dev4
|
||||
|
@ -9,18 +9,18 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
|
||||
prepare_vg 5
|
||||
. lib/test
|
||||
|
||||
exit 200 # this breaks upstream .33 and RHEL6 kernel :(
|
||||
|
||||
aux prepare_vg 5
|
||||
|
||||
# fail multiple devices
|
||||
|
||||
lvcreate -m 3 --ig -L 1 -n 4way $vg
|
||||
disable_dev $dev2 $dev4
|
||||
aux disable_dev $dev2 $dev4
|
||||
mkfs.ext3 $DM_DEV_DIR/$vg/4way
|
||||
enable_dev $dev2 $dev4
|
||||
aux enable_dev $dev2 $dev4
|
||||
echo n | lvconvert --repair $vg/4way 2>&1 | tee 4way.out
|
||||
lvs -a -o +devices | not grep unknown
|
||||
vgreduce --removemissing $vg
|
||||
|
@ -9,54 +9,54 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
|
||||
# fail multiple devices
|
||||
|
||||
aux prepare_vg 5
|
||||
lvcreate -m 3 --ig -L 1 -n 4way $vg $dev1 $dev2 $dev3 $dev4 $dev5:0
|
||||
disable_dev $dev2 $dev4
|
||||
aux disable_dev $dev2 $dev4
|
||||
echo n | lvconvert --repair $vg/4way 2>&1 | tee 4way.out
|
||||
lvs -a -o +devices | not grep unknown
|
||||
vgreduce --removemissing $vg
|
||||
enable_dev $dev2 $dev4
|
||||
aux enable_dev $dev2 $dev4
|
||||
check mirror $vg 4way $dev5
|
||||
|
||||
aux prepare_vg 5
|
||||
lvcreate -m 2 --ig -L 1 -n 3way $vg
|
||||
disable_dev $dev1 $dev2
|
||||
aux disable_dev $dev1 $dev2
|
||||
echo n | lvconvert --repair $vg/3way
|
||||
check linear $vg 3way
|
||||
lvs -a -o +devices | not grep unknown
|
||||
lvs -a -o +devices | not grep mlog
|
||||
dmsetup ls | grep $PREFIX | not grep mlog
|
||||
vgreduce --removemissing $vg
|
||||
enable_dev $dev1 $dev2
|
||||
aux enable_dev $dev1 $dev2
|
||||
check linear $vg 3way
|
||||
|
||||
# fail just log and get it removed
|
||||
|
||||
aux prepare_vg 5
|
||||
lvcreate -m 2 --ig -L 1 -n 3way $vg $dev1 $dev2 $dev3 $dev4:0
|
||||
disable_dev $dev4
|
||||
aux disable_dev $dev4
|
||||
echo n | lvconvert --repair $vg/3way
|
||||
check mirror $vg 3way core
|
||||
lvs -a -o +devices | not grep unknown
|
||||
lvs -a -o +devices | not grep mlog
|
||||
dmsetup ls | grep $PREFIX | not grep mlog
|
||||
vgreduce --removemissing $vg
|
||||
enable_dev $dev4
|
||||
aux enable_dev $dev4
|
||||
|
||||
aux prepare_vg 5
|
||||
lvcreate -m 1 --ig -L 1 -n 2way $vg $dev1 $dev2 $dev3:0
|
||||
disable_dev $dev3
|
||||
aux disable_dev $dev3
|
||||
echo n | lvconvert --repair $vg/2way
|
||||
check mirror $vg 2way core
|
||||
lvs -a -o +devices | not grep unknown
|
||||
lvs -a -o +devices | not grep mlog
|
||||
vgreduce --removemissing $vg
|
||||
enable_dev $dev3
|
||||
aux enable_dev $dev3
|
||||
|
||||
# fail single devices
|
||||
|
||||
@ -66,24 +66,24 @@ vgreduce $vg $dev4
|
||||
lvcreate -m 1 --ig -L 1 -n mirror $vg
|
||||
lvchange -a n $vg/mirror
|
||||
vgextend $vg $dev4
|
||||
disable_dev $dev1
|
||||
aux disable_dev $dev1
|
||||
lvchange --partial -a y $vg/mirror
|
||||
|
||||
not vgreduce -v --removemissing $vg
|
||||
lvconvert -y --repair $vg/mirror
|
||||
vgreduce --removemissing $vg
|
||||
|
||||
enable_dev $dev1
|
||||
aux enable_dev $dev1
|
||||
vgextend $vg $dev1
|
||||
disable_dev $dev2
|
||||
aux disable_dev $dev2
|
||||
lvconvert -y --repair $vg/mirror
|
||||
vgreduce --removemissing $vg
|
||||
|
||||
enable_dev $dev2
|
||||
aux enable_dev $dev2
|
||||
vgextend $vg $dev2
|
||||
disable_dev $dev3
|
||||
aux disable_dev $dev3
|
||||
lvconvert -y --repair $vg/mirror
|
||||
vgreduce --removemissing $vg
|
||||
enable_dev $dev3
|
||||
aux enable_dev $dev3
|
||||
vgextend $vg $dev3
|
||||
lvremove -ff $vg
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_vg 4
|
||||
lvcreate -m 1 --mirrorlog disk --ig -L 1 -n mirror $vg
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
aux prepare_vg 5 80
|
||||
|
||||
# 2-way mirror with corelog, 2 PVs
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
# 'Exercise some lvcreate diagnostics'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
cleanup_lvs() {
|
||||
lvremove -ff $vg
|
||||
@ -21,9 +21,9 @@ cleanup_lvs() {
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_pvs 2
|
||||
aux prepare_pvs 2
|
||||
aux pvcreate --metadatacopies 0 $dev1
|
||||
aux vgcreate -c n $vg $devs
|
||||
aux vgcreate -c n $vg $(cat DEVICES)
|
||||
|
||||
# ---
|
||||
# Create snapshots of LVs on --metadatacopies 0 PV (bz450651)
|
||||
|
@ -8,14 +8,14 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_pvs 3
|
||||
# not required, just testing
|
||||
aux pvcreate --metadatacopies 0 $dev1
|
||||
|
||||
vgcreate -c n $vg $devs
|
||||
pvchange --addtag fast $devs
|
||||
vgcreate -c n $vg $(cat DEVICES)
|
||||
pvchange --addtag fast $(cat DEVICES)
|
||||
|
||||
# 3 stripes with 3 PVs (selected by tag, @fast) is fine
|
||||
lvcreate -l3 -i3 $vg @fast
|
||||
|
@ -9,11 +9,11 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_pvs 3
|
||||
|
||||
vgcreate -c n -s 1k $vg $devs
|
||||
vgcreate -c n -s 1k $vg $(cat DEVICES)
|
||||
|
||||
lvcreate -n one -l 10 $vg
|
||||
lvcreate -s -l 8 -n snapA $vg/one
|
||||
|
@ -11,11 +11,11 @@
|
||||
|
||||
# 'Exercise some lvcreate diagnostics'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_pvs 4
|
||||
aux pvcreate --metadatacopies 0 $dev1
|
||||
vgcreate -cn $vg $devs
|
||||
vgcreate -cn $vg $(cat DEVICES)
|
||||
|
||||
# "lvcreate rejects repeated invocation (run 2 times) (bz178216)"
|
||||
lvcreate -n $lv -l 4 $vg
|
||||
@ -42,7 +42,7 @@ lvremove -ff $vg
|
||||
lvcreate -L 64m -n $lv -i2 $vg > out
|
||||
grep "^ Using default stripesize" out
|
||||
lvdisplay $vg
|
||||
check_lv_field_ $vg/$lv stripesize "64.00k"
|
||||
check lv_field $vg/$lv stripesize "64.00k"
|
||||
lvremove -ff $vg
|
||||
|
||||
# 'lvcreate rejects an invalid number of stripes'
|
||||
@ -89,16 +89,16 @@ vgchange -l 0 $vg
|
||||
# lvcreate rejects invalid chunksize, accepts between 4K and 512K
|
||||
# validate origin_size
|
||||
vgremove -ff $vg
|
||||
vgcreate -cn $vg $devs
|
||||
vgcreate -cn $vg $(cat DEVICES)
|
||||
lvcreate -L 32m -n $lv1 $vg
|
||||
not lvcreate -L 8m -n $lv2 -s --chunksize 3k $vg/$lv1
|
||||
not lvcreate -L 8m -n $lv2 -s --chunksize 1024k $vg/$lv1
|
||||
lvcreate -L 8m -n $lv2 -s --chunksize 4k $vg/$lv1
|
||||
check_lv_field_ $vg/$lv2 chunk_size 4.00k
|
||||
check_lv_field_ $vg/$lv2 origin_size 32.00m
|
||||
check lv_field $vg/$lv2 chunk_size 4.00k
|
||||
check lv_field $vg/$lv2 origin_size 32.00m
|
||||
lvcreate -L 8m -n $lv3 -s --chunksize 512k $vg/$lv1
|
||||
check_lv_field_ $vg/$lv3 chunk_size 512.00k
|
||||
check_lv_field_ $vg/$lv3 origin_size 32.00m
|
||||
check lv_field $vg/$lv3 chunk_size 512.00k
|
||||
check lv_field $vg/$lv3 origin_size 32.00m
|
||||
lvremove -ff $vg
|
||||
vgchange -l 0 $vg
|
||||
|
||||
@ -111,10 +111,10 @@ grep "Non-zero region size must be supplied." err
|
||||
not lvcreate -L 32m -n $lv -R 11k $vg
|
||||
not lvcreate -L 32m -n $lv -R 1k $vg
|
||||
lvcreate -L 32m -n $lv --regionsize 128m -m 1 $vg
|
||||
check_lv_field_ $vg/$lv regionsize "32.00m"
|
||||
check lv_field $vg/$lv regionsize "32.00m"
|
||||
lvremove -ff $vg
|
||||
lvcreate -L 32m -n $lv --regionsize 4m -m 1 $vg
|
||||
check_lv_field_ $vg/$lv regionsize "4.00m"
|
||||
check lv_field $vg/$lv regionsize "4.00m"
|
||||
lvremove -ff $vg
|
||||
|
||||
# snapshot with virtual origin works
|
||||
@ -127,15 +127,15 @@ lvremove -ff $vg
|
||||
|
||||
# readahead default (auto), none, #, auto
|
||||
lvcreate -L 32m -n $lv $vg
|
||||
check_lv_field_ $vg/$lv lv_read_ahead "auto"
|
||||
check lv_field $vg/$lv lv_read_ahead "auto"
|
||||
lvremove -ff $vg
|
||||
lvcreate -L 32m -n $lv --readahead none $vg
|
||||
check_lv_field_ $vg/$lv lv_read_ahead "0"
|
||||
check lv_field $vg/$lv lv_read_ahead "0"
|
||||
lvremove -ff $vg
|
||||
lvcreate -L 32m -n $lv --readahead 8k $vg
|
||||
check_lv_field_ $vg/$lv lv_read_ahead "8.00k"
|
||||
check lv_field $vg/$lv lv_read_ahead "8.00k"
|
||||
lvremove -ff $vg
|
||||
lvcreate -L 32m -n $lv --readahead auto $vg
|
||||
check_lv_field_ $vg/$lv lv_read_ahead "auto"
|
||||
check lv_field $vg/$lv lv_read_ahead "auto"
|
||||
lvremove -ff $vg
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
# 'Check extents percentage arguments'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_vg 2 128
|
||||
|
||||
@ -28,7 +28,7 @@ grep "^ Please specify either size or extents but not both.\$" err
|
||||
# 'lvextend accepts no size or extents but one PV - bz154691'
|
||||
lvextend $vg/$lv $dev1 >out
|
||||
grep "^ Logical volume $lv successfully resized\$" out
|
||||
check_pv_field_ $dev1 pv_free "0"
|
||||
check pv_field $dev1 pv_free "0"
|
||||
|
||||
lvremove -f $vg/$lv
|
||||
|
||||
@ -45,8 +45,8 @@ lvcreate -L 64m -n $lv $vg
|
||||
# 'lvextend accepts no size but extents 100%PVS and two PVs - bz154691'
|
||||
lvextend -l +100%PVS $vg/$lv $dev1 $dev2 >out
|
||||
grep "^ Logical volume $lv successfully resized\$" out
|
||||
check_pv_field_ $dev1 pv_free "0"
|
||||
check_pv_field_ $dev2 pv_free "0"
|
||||
check pv_field $dev1 pv_free "0"
|
||||
check pv_field $dev2 pv_free "0"
|
||||
|
||||
# Exercise the range overlap code. Allocate every 2 extents.
|
||||
#
|
||||
@ -72,13 +72,13 @@ check_pv_field_ $dev2 pv_free "0"
|
||||
create_pvs=`for i in $(seq 0 4 20); do echo -n "\$dev1:$i-$(($i + 1)) "; done`
|
||||
lvremove -f $vg/$lv
|
||||
lvcreate -l 12 -n $lv $vg $create_pvs
|
||||
check_lv_field_ $vg/$lv lv_size "48.00m"
|
||||
check lv_field $vg/$lv lv_size "48.00m"
|
||||
|
||||
# 'lvextend with partially allocated PVs and extents 100%PVS with PE ranges'
|
||||
extend_pvs=`for i in $(seq 0 6 18); do echo -n "\$dev1:$i-$(($i + 2)) "; done`
|
||||
lvextend -l +100%PVS $vg/$lv $extend_pvs >out
|
||||
grep "^ Logical volume $lv successfully resized\$" out
|
||||
check_lv_field_ $vg/$lv lv_size "72.00m"
|
||||
check lv_field $vg/$lv lv_size "72.00m"
|
||||
|
||||
# Simple seg_count validation; initially create the LV with half the # of
|
||||
# extents (should be 1 lv segment), extend it (should go to 2 segments),
|
||||
@ -90,12 +90,12 @@ pe1=$(( $pe_count / 2 ))
|
||||
lvcreate -l $pe1 -n $lv $vg
|
||||
pesize=$(lvs -ovg_extent_size --units b --nosuffix --noheadings $vg/$lv)
|
||||
segsize=$(( $pe1 * $pesize / 1024 / 1024 ))m
|
||||
check_lv_field_ $vg/$lv seg_count 1
|
||||
check_lv_field_ $vg/$lv seg_start 0
|
||||
check_lv_field_ $vg/$lv seg_start_pe 0
|
||||
#check_lv_field_ $vg/$lv seg_size $segsize
|
||||
check lv_field $vg/$lv seg_count 1
|
||||
check lv_field $vg/$lv seg_start 0
|
||||
check lv_field $vg/$lv seg_start_pe 0
|
||||
#check lv_field $vg/$lv seg_size $segsize
|
||||
lvextend -l +$(( $pe_count * 1 )) $vg/$lv
|
||||
check_lv_field_ $vg/$lv seg_count 2
|
||||
check lv_field $vg/$lv seg_count 2
|
||||
lvreduce -f -l -$(( $pe_count * 1 )) $vg/$lv
|
||||
check_lv_field_ $vg/$lv seg_count 1
|
||||
check lv_field $vg/$lv seg_count 1
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
extend() {
|
||||
lvextend --use-policies --config "activation { snapshot_extend_threshold = $1 }" $vg/snap
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
extend() {
|
||||
lvextend --use-policies --config "activation { snapshot_extend_threshold = $1 }" $vg/snap
|
||||
|
@ -12,7 +12,7 @@
|
||||
# tests lvm initialization, and especially negative tests of error paths
|
||||
#
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 5
|
||||
|
||||
|
@ -8,16 +8,16 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_pvs 5
|
||||
|
||||
vgcreate $vg1 $dev1
|
||||
vgcreate $vg2 $dev3
|
||||
|
||||
disable_dev $dev1
|
||||
aux disable_dev $dev1
|
||||
pvscan
|
||||
vgcreate $vg1 $dev2
|
||||
enable_dev $dev1
|
||||
aux enable_dev $dev1
|
||||
pvs
|
||||
pvs
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
aux prepare_vg 5 80
|
||||
|
||||
# extend 2-way mirror
|
||||
|
@ -8,7 +8,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_vg 2
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
# 'Test for proper escaping of strings in metadata (bz431474)'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 1
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 6
|
||||
|
||||
@ -21,22 +21,22 @@ for mdacp in 1 2; do
|
||||
vgcreate -c n "$vg" $dev1 $dev2 $dev3
|
||||
fi
|
||||
pvchange --metadataignore y $dev1
|
||||
check_pv_field_ $dev1 pv_mda_count $mdacp
|
||||
check_pv_field_ $dev1 pv_mda_used_count 0
|
||||
check_pv_field_ $dev2 pv_mda_count $mdacp
|
||||
check_pv_field_ $dev2 pv_mda_used_count $mdacp
|
||||
check pv_field $dev1 pv_mda_count $mdacp
|
||||
check pv_field $dev1 pv_mda_used_count 0
|
||||
check pv_field $dev2 pv_mda_count $mdacp
|
||||
check pv_field $dev2 pv_mda_used_count $mdacp
|
||||
if [ $pv_in_vg = 1 ]; then
|
||||
check_vg_field_ $vg vg_mda_count $(($mdacp * 2))
|
||||
check_vg_field_ $vg vg_mda_used_count $mdacp
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_count $(($mdacp * 2))
|
||||
check vg_field $vg vg_mda_used_count $mdacp
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
fi
|
||||
pvchange --metadataignore n $dev1
|
||||
check_pv_field_ $dev1 pv_mda_count $mdacp
|
||||
check_pv_field_ $dev1 pv_mda_used_count $mdacp
|
||||
check pv_field $dev1 pv_mda_count $mdacp
|
||||
check pv_field $dev1 pv_mda_used_count $mdacp
|
||||
if [ $pv_in_vg = 1 ]; then
|
||||
check_vg_field_ $vg vg_mda_count $(($mdacp * 2))
|
||||
check_vg_field_ $vg vg_mda_used_count $(($mdacp * 2))
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_count $(($mdacp * 2))
|
||||
check vg_field $vg vg_mda_used_count $(($mdacp * 2))
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
vgremove -f $vg
|
||||
fi
|
||||
done
|
||||
@ -44,7 +44,7 @@ done
|
||||
|
||||
# Check if a PV has unignored (used) mdas, and if so, ignore
|
||||
pvignore_ () {
|
||||
pv_mda_used_count=$(get_pv_field "$1" pv_mda_used_count)
|
||||
pv_mda_used_count=$(get pv_field "$1" pv_mda_used_count)
|
||||
if [ $pv_mda_used_count -ne 0 ]; then
|
||||
pvchange --metadataignore y $1
|
||||
fi
|
||||
@ -52,8 +52,8 @@ pvignore_ () {
|
||||
|
||||
# Check if a PV has ignored mdas, and if so, unignore (make used)
|
||||
pvunignore_ () {
|
||||
pv_mda_count=$(get_pv_field "$1" pv_mda_count)
|
||||
pv_mda_used_count=$(get_pv_field "$1" pv_mda_used_count)
|
||||
pv_mda_count=$(get pv_field "$1" pv_mda_count)
|
||||
pv_mda_used_count=$(get pv_field "$1" pv_mda_used_count)
|
||||
if [ $pv_mda_count -gt $pv_mda_used_count ]; then
|
||||
pvchange --metadataignore n $1
|
||||
fi
|
||||
@ -62,51 +62,51 @@ pvunignore_ () {
|
||||
echo Test of vgmetadatacopies with vgcreate and vgchange
|
||||
for mdacp in 1 2; do
|
||||
pvcreate --metadatacopies $mdacp $dev1 $dev2 $dev4 $dev5
|
||||
check_pv_field_ $dev1 pv_mda_used_count $mdacp
|
||||
check_pv_field_ $dev2 pv_mda_used_count $mdacp
|
||||
check_pv_field_ $dev4 pv_mda_used_count $mdacp
|
||||
check_pv_field_ $dev5 pv_mda_used_count $mdacp
|
||||
check pv_field $dev1 pv_mda_used_count $mdacp
|
||||
check pv_field $dev2 pv_mda_used_count $mdacp
|
||||
check pv_field $dev4 pv_mda_used_count $mdacp
|
||||
check pv_field $dev5 pv_mda_used_count $mdacp
|
||||
pvcreate --metadatacopies 0 $dev3
|
||||
vgcreate -c n "$vg" $dev1 $dev2 $dev3
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
echo ensure both --vgmetadatacopies and --metadatacopies accepted
|
||||
vgchange --metadatacopies $(($mdacp * 1)) $vg
|
||||
echo --vgmetadatacopies is persistent on disk
|
||||
echo --vgmetadatacopies affects underlying pv mda ignore
|
||||
check_vg_field_ $vg vg_mda_copies $(($mdacp * 1))
|
||||
check_vg_field_ $vg vg_mda_used_count $(($mdacp * 1))
|
||||
check vg_field $vg vg_mda_copies $(($mdacp * 1))
|
||||
check vg_field $vg vg_mda_used_count $(($mdacp * 1))
|
||||
vgchange --vgmetadatacopies $(($mdacp * 2)) $vg
|
||||
check_vg_field_ $vg vg_mda_copies $(($mdacp * 2))
|
||||
check_vg_field_ $vg vg_mda_used_count $(($mdacp * 2))
|
||||
check vg_field $vg vg_mda_copies $(($mdacp * 2))
|
||||
check vg_field $vg vg_mda_used_count $(($mdacp * 2))
|
||||
echo allow setting metadatacopies larger than number of PVs
|
||||
vgchange --vgmetadatacopies $(($mdacp * 5)) $vg
|
||||
check_vg_field_ $vg vg_mda_copies $(($mdacp * 5))
|
||||
check_vg_field_ $vg vg_mda_used_count $(($mdacp * 2))
|
||||
check vg_field $vg vg_mda_copies $(($mdacp * 5))
|
||||
check vg_field $vg vg_mda_used_count $(($mdacp * 2))
|
||||
echo setting to 0 disables automatic balancing
|
||||
vgchange --vgmetadatacopies unmanaged $vg
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
vgremove -f $vg
|
||||
echo vgcreate succeeds even when creating a VG w/all ignored mdas
|
||||
pvchange --metadataignore y $dev1 $dev2
|
||||
check_pv_field_ $dev1 pv_mda_count $mdacp
|
||||
check_pv_field_ $dev2 pv_mda_used_count 0
|
||||
check pv_field $dev1 pv_mda_count $mdacp
|
||||
check pv_field $dev2 pv_mda_used_count 0
|
||||
vgcreate -c n "$vg" $dev1 $dev2
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
vgremove -f $vg
|
||||
echo vgcreate succeeds with a specific number of metadata copies
|
||||
vgcreate -c n --vgmetadatacopies $(($mdacp * 2)) "$vg" $dev1 $dev2
|
||||
check_vg_field_ $vg vg_mda_copies $(($mdacp * 2))
|
||||
check vg_field $vg vg_mda_copies $(($mdacp * 2))
|
||||
vgremove -f $vg
|
||||
vgcreate -c n --vgmetadatacopies $(($mdacp * 1)) "$vg" $dev1 $dev2
|
||||
check_vg_field_ $vg vg_mda_copies $(($mdacp * 1))
|
||||
check vg_field $vg vg_mda_copies $(($mdacp * 1))
|
||||
vgremove -f $vg
|
||||
echo vgcreate succeeds with a larger value than total metadatacopies
|
||||
vgcreate -c n --vgmetadatacopies $(($mdacp * 5)) "$vg" $dev1 $dev2
|
||||
check_vg_field_ $vg vg_mda_copies $(($mdacp * 5))
|
||||
check vg_field $vg vg_mda_copies $(($mdacp * 5))
|
||||
vgremove -f $vg
|
||||
echo vgcreate succeeds with --vgmetadatacopies unmanaged
|
||||
vgcreate -c n --vgmetadatacopies unmanaged "$vg" $dev1 $dev2
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
vgremove -f $vg
|
||||
pvunignore_ $dev1
|
||||
pvunignore_ $dev2
|
||||
@ -114,24 +114,24 @@ for mdacp in 1 2; do
|
||||
pvunignore_ $dev5
|
||||
echo vgcreate succeds with small value of --metadatacopies, ignores mdas
|
||||
vgcreate -c n --vgmetadatacopies 1 "$vg" $dev1 $dev2 $dev4 $dev5
|
||||
check_vg_field_ $vg vg_mda_copies 1
|
||||
check_vg_field_ $vg vg_mda_count $(($mdacp * 4))
|
||||
check_vg_field_ $vg vg_mda_used_count 1
|
||||
check vg_field $vg vg_mda_copies 1
|
||||
check vg_field $vg vg_mda_count $(($mdacp * 4))
|
||||
check vg_field $vg vg_mda_used_count 1
|
||||
echo Setting a larger value should trigger non-ignore of mdas
|
||||
vgchange --metadatacopies 3 $vg
|
||||
check_vg_field_ $vg vg_mda_copies 3
|
||||
check_vg_field_ $vg vg_mda_used_count 3
|
||||
check vg_field $vg vg_mda_copies 3
|
||||
check vg_field $vg vg_mda_used_count 3
|
||||
echo Setting all should trigger unignore of all mdas
|
||||
vgchange --vgmetadatacopies all $vg
|
||||
check_vg_field_ $vg vg_mda_count $(($mdacp * 4))
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check_vg_field_ $vg vg_mda_used_count $(($mdacp * 4))
|
||||
check vg_field $vg vg_mda_count $(($mdacp * 4))
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_used_count $(($mdacp * 4))
|
||||
echo --vgmetadatacopies 0 should be unmanaged for vgchange and vgcreate
|
||||
vgchange --vgmetadatacopies 0 $vg
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
vgremove -f $vg
|
||||
vgcreate -c n --vgmetadatacopies 0 "$vg" $dev1 $dev2 $dev4 $dev5
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
vgremove -f $vg
|
||||
done
|
||||
|
||||
@ -141,43 +141,43 @@ for mdacp in 1 2; do
|
||||
pvcreate --metadatacopies 0 $dev3
|
||||
echo Set a large value of vgmetadatacopies
|
||||
vgcreate -c n --vgmetadatacopies $(($mdacp * 5)) "$vg" $dev1 $dev2 $dev3
|
||||
check_vg_field_ $vg vg_mda_copies $(($mdacp * 5))
|
||||
check vg_field $vg vg_mda_copies $(($mdacp * 5))
|
||||
echo Ignore mdas on devices to be used for vgextend
|
||||
echo Large value of vgetadatacopies should automatically un-ignore mdas
|
||||
pvchange --metadataignore y $dev4 $dev5
|
||||
check_pv_field_ $dev4 pv_mda_used_count 0
|
||||
check pv_field $dev4 pv_mda_used_count 0
|
||||
vgextend $vg $dev4 $dev5
|
||||
check_pv_field_ $dev4 pv_mda_used_count $mdacp
|
||||
check_pv_field_ $dev5 pv_mda_used_count $mdacp
|
||||
check pv_field $dev4 pv_mda_used_count $mdacp
|
||||
check pv_field $dev5 pv_mda_used_count $mdacp
|
||||
vgremove -f $vg
|
||||
echo Set a small value of vgmetadatacopies
|
||||
vgcreate -c n --vgmetadatacopies $(($mdacp * 1)) "$vg" $dev1 $dev2 $dev3
|
||||
check_vg_field_ $vg vg_mda_copies $(($mdacp * 1))
|
||||
check vg_field $vg vg_mda_copies $(($mdacp * 1))
|
||||
echo Ignore mdas on devices to be used for vgextend
|
||||
echo Small value of vgetadatacopies should leave mdas as ignored
|
||||
pvchange --metadataignore y $dev4 $dev5
|
||||
check_pv_field_ $dev4 pv_mda_used_count 0
|
||||
check pv_field $dev4 pv_mda_used_count 0
|
||||
vgextend $vg $dev4 $dev5
|
||||
check_pv_field_ $dev4 pv_mda_used_count 0
|
||||
check_pv_field_ $dev5 pv_mda_used_count 0
|
||||
check pv_field $dev4 pv_mda_used_count 0
|
||||
check pv_field $dev5 pv_mda_used_count 0
|
||||
echo vgreduce of ignored pv w/mda should not trigger any change to ignore bits
|
||||
vgreduce $vg $dev4
|
||||
check_pv_field_ $dev4 pv_mda_used_count 0
|
||||
check_pv_field_ $dev5 pv_mda_used_count 0
|
||||
check pv_field $dev4 pv_mda_used_count 0
|
||||
check pv_field $dev5 pv_mda_used_count 0
|
||||
echo vgreduce of un-ignored pv w/mda should trigger un-ignore on an mda
|
||||
vgreduce $vg $dev1 $dev2 $dev3
|
||||
check_pv_field_ $dev5 pv_mda_used_count $mdacp
|
||||
check_vg_field_ $vg vg_mda_copies $(($mdacp * 1))
|
||||
check pv_field $dev5 pv_mda_used_count $mdacp
|
||||
check vg_field $vg vg_mda_copies $(($mdacp * 1))
|
||||
pvunignore_ $dev1
|
||||
pvunignore_ $dev2
|
||||
echo setting vgmetadatacopies to unmanaged should allow vgextend to add w/out balancing
|
||||
vgchange --vgmetadatacopies unmanaged $vg
|
||||
vgextend $vg $dev1 $dev2
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check_vg_field_ $vg vg_mda_count $(($mdacp * 3))
|
||||
check_vg_field_ $vg vg_mda_used_count $((mdacp * 3))
|
||||
check_pv_field_ $dev1 pv_mda_used_count $mdacp
|
||||
check_pv_field_ $dev2 pv_mda_used_count $mdacp
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_count $(($mdacp * 3))
|
||||
check vg_field $vg vg_mda_used_count $((mdacp * 3))
|
||||
check pv_field $dev1 pv_mda_used_count $mdacp
|
||||
check pv_field $dev2 pv_mda_used_count $mdacp
|
||||
vgremove -f $vg
|
||||
done
|
||||
|
||||
@ -187,16 +187,16 @@ for mdacp in 1 2; do
|
||||
vgcreate -c n --vgmetadatacopies 2 $vg1 $dev1 $dev2 $dev3
|
||||
vgcreate -c n --vgmetadatacopies $(($mdacp * 1)) $vg2 $dev4 $dev5
|
||||
echo vgsplit/vgmerge preserves value of metadata copies
|
||||
check_vg_field_ $vg1 vg_mda_copies 2
|
||||
check_vg_field_ $vg2 vg_mda_copies $(($mdacp * 1))
|
||||
check vg_field $vg1 vg_mda_copies 2
|
||||
check vg_field $vg2 vg_mda_copies $(($mdacp * 1))
|
||||
vgsplit $vg1 $vg2 $dev1
|
||||
check_vg_field_ $vg2 vg_mda_copies $(($mdacp * 1))
|
||||
check vg_field $vg2 vg_mda_copies $(($mdacp * 1))
|
||||
vgmerge $vg1 $vg2
|
||||
check_vg_field_ $vg1 vg_mda_copies 2
|
||||
check_vg_field_ $vg1 vg_mda_count $(($mdacp * 5))
|
||||
check vg_field $vg1 vg_mda_copies 2
|
||||
check vg_field $vg1 vg_mda_count $(($mdacp * 5))
|
||||
echo vgsplit into new vg sets proper value of vgmetadatacopies
|
||||
vgsplit --vgmetadatacopies $(($mdacp * 2)) $vg1 $vg2 $dev1 $dev2
|
||||
check_vg_field_ $vg2 vg_mda_copies $(($mdacp * 2))
|
||||
check vg_field $vg2 vg_mda_copies $(($mdacp * 2))
|
||||
echo vgchange fails if given both vgmetadatacopies and metadatacopies
|
||||
not vgchange --vgmetadatacopies 5 --metadatacopies 7 $vg2
|
||||
vgremove -f $vg1
|
||||
@ -207,26 +207,26 @@ echo Test combination of --vgmetadatacopies and pvchange --metadataignore
|
||||
for mdacp in 1 2; do
|
||||
pvcreate --metadatacopies $mdacp $dev1 $dev2 $dev3 $dev4 $dev5
|
||||
vgcreate -c n --vgmetadatacopies $(($mdacp * 1)) $vg1 $dev1 $dev2
|
||||
check_vg_field_ $vg1 vg_mda_copies $(($mdacp * 1))
|
||||
check_vg_field_ $vg1 vg_mda_used_count $(($mdacp * 1))
|
||||
check vg_field $vg1 vg_mda_copies $(($mdacp * 1))
|
||||
check vg_field $vg1 vg_mda_used_count $(($mdacp * 1))
|
||||
pvignore_ $dev3
|
||||
echo Ensure vgextend of PVs with ignored MDAs does not add to vg_mda_used_count
|
||||
vgextend $vg1 $dev3
|
||||
check_vg_field_ $vg1 vg_mda_used_count $(($mdacp * 1))
|
||||
check vg_field $vg1 vg_mda_used_count $(($mdacp * 1))
|
||||
echo Using pvchange to unignore should update vg_mda_used_count
|
||||
pvchange -f --metadataignore n $dev3
|
||||
check_pv_field_ $dev3 pv_mda_used_count $mdacp
|
||||
check_vg_field_ $vg1 vg_mda_used_count $(($mdacp * 2))
|
||||
check pv_field $dev3 pv_mda_used_count $mdacp
|
||||
check vg_field $vg1 vg_mda_used_count $(($mdacp * 2))
|
||||
echo Set unmanaged on the vg should keep ignore bits the same during vgextend
|
||||
vgchange --vgmetadatacopies unmanaged $vg1
|
||||
check_vg_field_ $vg1 vg_mda_used_count $(($mdacp * 2))
|
||||
check vg_field $vg1 vg_mda_used_count $(($mdacp * 2))
|
||||
pvunignore_ $dev4
|
||||
vgextend $vg1 $dev4
|
||||
check_pv_field_ $dev4 pv_mda_used_count $mdacp
|
||||
check_vg_field_ $vg1 vg_mda_used_count $(($mdacp * 3))
|
||||
check pv_field $dev4 pv_mda_used_count $mdacp
|
||||
check vg_field $vg1 vg_mda_used_count $(($mdacp * 3))
|
||||
echo Using pvchange to ignore should update vg_mda_used_count
|
||||
pvchange -f --metadataignore y $dev4
|
||||
check_pv_field_ $dev4 pv_mda_used_count 0
|
||||
check_vg_field_ $vg1 vg_mda_used_count $(($mdacp * 2))
|
||||
check pv_field $dev4 pv_mda_used_count 0
|
||||
check vg_field $vg1 vg_mda_used_count $(($mdacp * 2))
|
||||
vgremove -f $vg1
|
||||
done
|
||||
|
@ -8,7 +8,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 5
|
||||
|
||||
@ -18,7 +18,7 @@ pvcreate --metadatacopies 0 $dev3
|
||||
pvcreate $dev4
|
||||
pvcreate --metadatacopies 0 $dev5
|
||||
|
||||
vgcreate -c n "$vg" $devs
|
||||
vgcreate -c n "$vg" $(cat DEVICES)
|
||||
lvcreate -n $lv -l 1 -i5 -I256 $vg
|
||||
|
||||
pvchange -x n $dev1
|
||||
@ -30,9 +30,9 @@ vgremove -f $vg
|
||||
|
||||
# check that PVs without metadata don't cause too many full device rescans (bz452606)
|
||||
for mdacp in 1 0; do
|
||||
pvcreate --metadatacopies $mdacp $devs
|
||||
pvcreate --metadatacopies $mdacp $(cat DEVICES)
|
||||
pvcreate $dev1
|
||||
vgcreate -c n $vg $devs
|
||||
vgcreate -c n $vg $(cat DEVICES)
|
||||
lvcreate -n $lv1 -l 2 -i5 -I256 $vg
|
||||
lvcreate -n $lv2 -m2 -l 2 $vg
|
||||
#lvchange -an $vg
|
||||
@ -55,9 +55,9 @@ pvchange --uuid $dev1
|
||||
|
||||
# verify pe_start of all M1 PVs
|
||||
pv_align="128.00k"
|
||||
check_pv_field_ $dev1 pe_start $pv_align
|
||||
check_pv_field_ $dev2 pe_start $pv_align
|
||||
check_pv_field_ $dev3 pe_start $pv_align
|
||||
check pv_field $dev1 pe_start $pv_align
|
||||
check pv_field $dev2 pe_start $pv_align
|
||||
check pv_field $dev3 pe_start $pv_align
|
||||
|
||||
pvs --units k -o name,pe_start,vg_mda_size,vg_name
|
||||
|
||||
@ -65,9 +65,9 @@ pvs --units k -o name,pe_start,vg_mda_size,vg_name
|
||||
vgconvert -M2 $vg
|
||||
|
||||
# verify pe_start of all M2 PVs
|
||||
check_pv_field_ $dev1 pe_start $pv_align
|
||||
check_pv_field_ $dev2 pe_start $pv_align
|
||||
check_pv_field_ $dev3 pe_start $pv_align
|
||||
check pv_field $dev1 pe_start $pv_align
|
||||
check pv_field $dev2 pe_start $pv_align
|
||||
check pv_field $dev3 pe_start $pv_align
|
||||
|
||||
pvs --units k -o name,pe_start,vg_mda_size,vg_name
|
||||
|
||||
@ -77,4 +77,4 @@ pvcreate -ff -y --restorefile $TESTDIR/bak-$vg --uuid $pv3_uuid $dev3
|
||||
vgcfgrestore -f $TESTDIR/bak-$vg $vg
|
||||
|
||||
# verify pe_start of $dev3
|
||||
check_pv_field_ $dev3 pe_start $pv_align
|
||||
check pv_field $dev3 pe_start $pv_align
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
test_description="check namings of mirrored LV"
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Utilities
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
test_description="ensure that 'vgreduce --removemissing' works on mirrored LV"
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
lv_is_on_ ()
|
||||
{
|
||||
@ -86,7 +86,7 @@ rest_pvs_()
|
||||
# ---------------------------------------------------------------------
|
||||
# Initialize PVs and VGs
|
||||
|
||||
prepare_vg 5
|
||||
aux prepare_vg 5
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Common environment setup/cleanup for each sub testcases
|
||||
@ -113,7 +113,7 @@ check_and_cleanup_lvs_()
|
||||
|
||||
recover_vg_()
|
||||
{
|
||||
enable_dev $*
|
||||
aux enable_dev $*
|
||||
pvcreate -ff $*
|
||||
vgextend $vg $*
|
||||
check_and_cleanup_lvs_
|
||||
@ -130,9 +130,9 @@ check_and_cleanup_lvs_
|
||||
prepare_lvs_
|
||||
lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0
|
||||
lvchange -an $vg/$lv1
|
||||
aux mimages_are_on_ $lv1 $dev1 $dev2
|
||||
mimages_are_on_ $lv1 $dev1 $dev2
|
||||
mirrorlog_is_on_ $lv1 $dev3
|
||||
disable_dev $dev2
|
||||
aux disable_dev $dev2
|
||||
vgreduce --removemissing --force $vg
|
||||
lv_is_linear_ $lv1
|
||||
lv_is_on_ $lv1 $dev1
|
||||
@ -151,9 +151,9 @@ test_3way_mirror_fail_1_()
|
||||
|
||||
lvcreate -l2 -m2 -n $lv1 $vg $dev1 $dev2 $dev3 $dev4:0
|
||||
lvchange -an $vg/$lv1
|
||||
aux mimages_are_on_ $lv1 $dev1 $dev2 $dev3
|
||||
mimages_are_on_ $lv1 $dev1 $dev2 $dev3
|
||||
mirrorlog_is_on_ $lv1 $dev4
|
||||
eval disable_dev \$dev$index
|
||||
eval aux disable_dev \$dev$index
|
||||
vgreduce --removemissing --force $vg
|
||||
lvs -a -o+devices $vg
|
||||
mimages_are_on_ $lv1 $(rest_pvs_ $index 3)
|
||||
@ -181,10 +181,10 @@ test_3way_mirror_fail_2_()
|
||||
mimages_are_on_ $lv1 $dev1 $dev2 $dev3
|
||||
mirrorlog_is_on_ $lv1 $dev4
|
||||
rest_pvs_ $index 3
|
||||
disable_dev $(rest_pvs_ $index 3)
|
||||
aux disable_dev $(rest_pvs_ $index 3)
|
||||
vgreduce --force --removemissing $vg
|
||||
lvs -a -o+devices $vg
|
||||
aux lv_is_linear_ $lv1
|
||||
lv_is_linear_ $lv1
|
||||
eval lv_is_on_ $lv1 \$dev$n
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ test_3way_mirror_plus_1_fail_1_()
|
||||
lvconvert -m+1 $vg/$lv1 $dev4
|
||||
mimages_are_on_ $lv1 $dev1 $dev2 $dev3 $dev4
|
||||
mirrorlog_is_on_ $lv1 $dev5
|
||||
eval disable_dev \$dev$n
|
||||
eval aux disable_dev \$dev$n
|
||||
vgreduce --removemissing --force $vg
|
||||
lvs -a -o+devices $vg
|
||||
mimages_are_on_ $lv1 $(rest_pvs_ $index 4)
|
||||
@ -237,7 +237,7 @@ test_3way_mirror_plus_1_fail_3_()
|
||||
lvconvert -m+1 $vg/$lv1 $dev4
|
||||
mimages_are_on_ $lv1 $dev1 $dev2 $dev3 $dev4
|
||||
mirrorlog_is_on_ $lv1 $dev5
|
||||
disable_dev $(rest_pvs_ $index 4)
|
||||
aux disable_dev $(rest_pvs_ $index 4)
|
||||
vgreduce --removemissing --force $vg
|
||||
lvs -a -o+devices $vg
|
||||
eval local dev=\$dev$n
|
||||
@ -266,7 +266,7 @@ test_2way_mirror_plus_2_fail_1_()
|
||||
lvconvert -m+2 $vg/$lv1 $dev3 $dev4
|
||||
mimages_are_on_ $lv1 $dev1 $dev2 $dev3 $dev4
|
||||
mirrorlog_is_on_ $lv1 $dev5
|
||||
eval disable_dev \$dev$n
|
||||
eval aux disable_dev \$dev$n
|
||||
vgreduce --removemissing --force $vg
|
||||
lvs -a -o+devices $vg
|
||||
mimages_are_on_ $lv1 $(rest_pvs_ $index 4)
|
||||
@ -294,7 +294,7 @@ test_2way_mirror_plus_2_fail_3_()
|
||||
lvconvert -m+2 $vg/$lv1 $dev3 $dev4
|
||||
mimages_are_on_ $lv1 $dev1 $dev2 $dev3 $dev4
|
||||
mirrorlog_is_on_ $lv1 $dev5
|
||||
disable_dev $(rest_pvs_ $index 4)
|
||||
aux disable_dev $(rest_pvs_ $index 4)
|
||||
vgreduce --removemissing --force $vg
|
||||
lvs -a -o+devices $vg
|
||||
eval local dev=\$dev$n
|
||||
@ -318,7 +318,7 @@ lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev5:0
|
||||
lvchange -an $vg/$lv1
|
||||
mimages_are_on_ $lv1 $dev1 $dev2
|
||||
mirrorlog_is_on_ $lv1 $dev5
|
||||
disable_dev $dev5
|
||||
aux disable_dev $dev5
|
||||
vgreduce --removemissing --force $vg
|
||||
mimages_are_on_ $lv1 $dev1 $dev2
|
||||
not mirrorlog_is_on_ $lv1 $dev5
|
||||
@ -331,7 +331,7 @@ lvchange -an $vg/$lv1
|
||||
lvconvert -m+1 $vg/$lv1 $dev3
|
||||
mimages_are_on_ $lv1 $dev1 $dev2 $dev3
|
||||
mirrorlog_is_on_ $lv1 $dev5
|
||||
disable_dev $dev5
|
||||
aux disable_dev $dev5
|
||||
vgreduce --removemissing --force $vg
|
||||
mimages_are_on_ $lv1 $dev1 $dev2 $dev3
|
||||
not mirrorlog_is_on_ $lv1 $dev5
|
||||
@ -346,7 +346,7 @@ lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev5:0
|
||||
lvchange -an $vg/$lv1
|
||||
mimages_are_on_ $lv1 $dev1 $dev2
|
||||
mirrorlog_is_on_ $lv1 $dev5
|
||||
disable_dev $dev1 $dev2
|
||||
aux disable_dev $dev1 $dev2
|
||||
vgreduce --removemissing --force $vg
|
||||
not lvs $vg/$lv1
|
||||
recover_vg_ $dev1 $dev2
|
||||
@ -358,7 +358,7 @@ lvchange -an $vg/$lv1
|
||||
lvconvert -m+1 $vg/$lv1 $dev3
|
||||
mimages_are_on_ $lv1 $dev1 $dev2 $dev3
|
||||
mirrorlog_is_on_ $lv1 $dev5
|
||||
disable_dev $dev1 $dev2 $dev3
|
||||
aux disable_dev $dev1 $dev2 $dev3
|
||||
vgreduce --removemissing --force $vg
|
||||
not lvs $vg/$lv1
|
||||
recover_vg_ $dev1 $dev2 $dev3
|
||||
@ -376,7 +376,7 @@ mimages_are_on_ $lv1 $dev1 $dev2
|
||||
mimages_are_on_ $lv2 $dev3 $dev4
|
||||
mirrorlog_is_on_ $lv1 $dev5
|
||||
mirrorlog_is_on_ $lv2 $dev5
|
||||
disable_dev $dev2
|
||||
aux disable_dev $dev2
|
||||
vgreduce --removemissing --force $vg
|
||||
mimages_are_on_ $lv2 $dev3 $dev4
|
||||
mirrorlog_is_on_ $lv2 $dev5
|
||||
@ -394,8 +394,8 @@ mimages_are_on_ $lv1 $dev1 $dev2
|
||||
mimages_are_on_ $lv2 $dev3 $dev4
|
||||
mirrorlog_is_on_ $lv1 $dev5
|
||||
mirrorlog_is_on_ $lv2 $dev5
|
||||
disable_dev $dev2
|
||||
disable_dev $dev4
|
||||
aux disable_dev $dev2
|
||||
aux disable_dev $dev4
|
||||
vgreduce --removemissing --force $vg
|
||||
lv_is_linear_ $lv1
|
||||
lv_is_on_ $lv1 $dev1
|
||||
|
@ -10,9 +10,9 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
prepare_devs 4
|
||||
aux prepare_devs 4
|
||||
pvcreate $dev1 $dev2
|
||||
pvcreate --metadatacopies 0 $dev3 $dev4
|
||||
vgcreate -c n $vg $dev1 $dev2 $dev3 $dev4
|
||||
@ -28,7 +28,7 @@ lvcreate -l1 -m1 -n mirror12 --mirrorlog core $vg $dev1 $dev2
|
||||
lvcreate -l1 -m1 -n mirror123 $vg $dev1 $dev2 $dev3
|
||||
|
||||
vgchange -a n $vg
|
||||
disable_dev $dev1
|
||||
aux disable_dev $dev1
|
||||
not vgchange -a y $vg
|
||||
not vgck $vg
|
||||
|
||||
@ -41,8 +41,8 @@ check inactive $vg mirror12
|
||||
check inactive $vg mirror123
|
||||
|
||||
vgchange -a n $vg
|
||||
enable_dev $dev1
|
||||
disable_dev $dev2
|
||||
aux enable_dev $dev1
|
||||
aux disable_dev $dev2
|
||||
not vgchange -a y $vg
|
||||
not vgck $vg
|
||||
|
||||
@ -55,8 +55,8 @@ check inactive $vg mirror12
|
||||
check inactive $vg mirror123
|
||||
|
||||
vgchange -a n $vg
|
||||
enable_dev $dev2
|
||||
disable_dev $dev3
|
||||
aux enable_dev $dev2
|
||||
aux disable_dev $dev3
|
||||
not vgchange -a y $vg
|
||||
not vgck $vg
|
||||
|
||||
@ -69,8 +69,8 @@ check inactive $vg mirror123
|
||||
check active $vg mirror12
|
||||
|
||||
vgchange -a n $vg
|
||||
enable_dev $dev3
|
||||
disable_dev $dev4
|
||||
aux enable_dev $dev3
|
||||
aux disable_dev $dev4
|
||||
vgchange -a y $vg
|
||||
not vgck $vg
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
# create the old GFS pool labeled linear devices
|
||||
create_pool_label_()
|
||||
@ -32,7 +32,7 @@ not pvcreate "$dev1"
|
||||
|
||||
# check that vgdisplay and pvcreate -ff works with the pool device
|
||||
vgdisplay --config 'global { locking_type = 0 }'
|
||||
disable_dev "$dev2"
|
||||
aux disable_dev "$dev2"
|
||||
# FIXME! since pool1 cannot be opened, vgdisplay gives error... should we say
|
||||
# "not" there instead, checking that it indeed does fail?
|
||||
vgdisplay --config 'global { locking_type = 0 }' || true
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
# 'Ensure that pvmove diagnoses PE-range values 2^32 and larger.'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_vg 2
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
# 'Test pvchange option values'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 4
|
||||
|
||||
@ -24,15 +24,15 @@ do
|
||||
|
||||
# "pvchange adds/dels tag to pvs with metadatacopies = $mda "
|
||||
pvchange $dev1 --addtag test$mda
|
||||
check_pv_field_ $dev1 pv_tags test$mda
|
||||
check pv_field $dev1 pv_tags test$mda
|
||||
pvchange $dev1 --deltag test$mda
|
||||
check_pv_field_ $dev1 pv_tags ""
|
||||
check pv_field $dev1 pv_tags ""
|
||||
|
||||
# "vgchange disable/enable allocation for pvs with metadatacopies = $mda (bz452982)"
|
||||
pvchange $dev1 -x n
|
||||
check_pv_field_ $dev1 pv_attr --
|
||||
check pv_field $dev1 pv_attr --
|
||||
pvchange $dev1 -x y
|
||||
check_pv_field_ $dev1 pv_attr a-
|
||||
check pv_field $dev1 pv_attr a-
|
||||
|
||||
# 'remove pv'
|
||||
vgremove $vg1
|
||||
@ -45,13 +45,13 @@ pvcreate --metadatacopies 2 $dev2
|
||||
vgcreate $vg1 $dev1 $dev2
|
||||
pvchange -u $dev1
|
||||
pvchange -u $dev2
|
||||
vg_validate_pvlv_counts_ $vg1 2 0 0
|
||||
check pvlv_counts $vg1 2 0 0
|
||||
pvchange -u --all
|
||||
vg_validate_pvlv_counts_ $vg1 2 0 0
|
||||
check pvlv_counts $vg1 2 0 0
|
||||
|
||||
# "pvchange rejects uuid change under an active lv"
|
||||
lvcreate -l 16 -i 2 -n $lv --alloc anywhere $vg1
|
||||
vg_validate_pvlv_counts_ $vg1 2 1 0
|
||||
check pvlv_counts $vg1 2 1 0
|
||||
not pvchange -u $dev1
|
||||
lvchange -an "$vg1"/"$lv"
|
||||
pvchange -u $dev1
|
||||
|
@ -15,7 +15,7 @@
|
||||
#
|
||||
# 'Test pvcreate without metadata on all pvs'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 2 128
|
||||
|
||||
|
@ -18,9 +18,9 @@ which cut || exit 200
|
||||
test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \
|
||||
modprobe raid0 || exit 200
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
prepare_lvmconf '[ "a|/dev/md.*|", "a/dev\/mapper\/.*$/", "r/.*/" ]'
|
||||
prepare_lvmconf 'devices/filter = [ "a|/dev/md.*|", "a/dev\/mapper\/.*$/", "r/.*/" ]'
|
||||
aux prepare_devs 2
|
||||
|
||||
# Have MD use a non-standard name to avoid colliding with an existing MD device
|
||||
@ -60,14 +60,14 @@ pv_align="1.00m"
|
||||
pvcreate --metadatasize 128k \
|
||||
--config 'devices {md_chunk_alignment=0 data_alignment_detection=0 data_alignment_offset_detection=0}' \
|
||||
$mddev
|
||||
check_pv_field_ $mddev pe_start $pv_align
|
||||
check pv_field $mddev pe_start $pv_align
|
||||
|
||||
# Test md_chunk_alignment independent of topology-aware detection
|
||||
pv_align="1.00m"
|
||||
pvcreate --metadatasize 128k \
|
||||
--config 'devices {data_alignment_detection=0 data_alignment_offset_detection=0}' \
|
||||
$mddev
|
||||
check_pv_field_ $mddev pe_start $pv_align
|
||||
check pv_field $mddev pe_start $pv_align
|
||||
|
||||
# Get linux minor version
|
||||
linux_minor=$(echo `uname -r` | cut -d'.' -f3 | cut -d'-' -f1)
|
||||
@ -79,7 +79,7 @@ if [ $linux_minor -ge 33 ]; then
|
||||
# optimal_io_size=131072, minimum_io_size=65536
|
||||
pvcreate --metadatasize 128k \
|
||||
--config 'devices { md_chunk_alignment=0 }' $mddev
|
||||
check_pv_field_ $mddev pe_start $pv_align
|
||||
check pv_field $mddev pe_start $pv_align
|
||||
fi
|
||||
|
||||
# partition MD array directly, depends on blkext in Linux >= 2.6.28
|
||||
@ -113,7 +113,7 @@ EOF
|
||||
# default alignment is 1M, add alignment_offset
|
||||
pv_align=$((1048576+$alignment_offset))B
|
||||
pvcreate --metadatasize 128k $mddev_p
|
||||
check_pv_field_ $mddev_p pe_start $pv_align "--units b"
|
||||
check pv_field $mddev_p pe_start $pv_align "--units b"
|
||||
pvremove $mddev_p
|
||||
fi
|
||||
fi
|
||||
@ -133,11 +133,11 @@ if [ $linux_minor -ge 33 ]; then
|
||||
pv_align="2.00m"
|
||||
pvcreate --metadatasize 128k \
|
||||
--config 'devices { md_chunk_alignment=0 }' $mddev
|
||||
check_pv_field_ $mddev pe_start $pv_align
|
||||
check pv_field $mddev pe_start $pv_align
|
||||
|
||||
# now verify pe_start alignment override using --dataalignment
|
||||
pv_align="192.00k"
|
||||
pvcreate --dataalignment 64k --metadatasize 128k \
|
||||
--config 'devices { md_chunk_alignment=0 }' $mddev
|
||||
check_pv_field_ $mddev pe_start $pv_align
|
||||
check pv_field $mddev pe_start $pv_align
|
||||
fi
|
||||
|
@ -8,7 +8,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 4
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
test_description='Test pvcreate option values'
|
||||
PAGESIZE=$(getconf PAGESIZE)
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 4
|
||||
|
||||
@ -25,7 +25,7 @@ not pvcreate --metadatasize -1024 $dev1
|
||||
# x. metadatasize 0, defaults to 255
|
||||
# FIXME: unable to check default value, not in reporting cmds
|
||||
# should default to 255 according to code
|
||||
# check_pv_field_ pv_mda_size 255
|
||||
# check pv_field pv_mda_size 255
|
||||
#COMM 'pvcreate accepts metadatasize 0'
|
||||
pvcreate --metadatasize 0 $dev1
|
||||
pvremove $dev1
|
||||
@ -34,7 +34,7 @@ pvremove $dev1
|
||||
pvcreate --metadatasize 512k $dev1
|
||||
pvcreate --metadatasize 96k $dev2
|
||||
vgcreate $vg $dev1 $dev2
|
||||
compare_two_fields_ vgs $vg vg_mda_size pvs $dev2 pv_mda_size
|
||||
check compare_fields vgs $vg vg_mda_size pvs $dev2 pv_mda_size
|
||||
vgremove -ff $vg
|
||||
|
||||
# x. metadatasize too large
|
||||
@ -51,9 +51,9 @@ do
|
||||
pvcreate --$j 0 $dev1
|
||||
pvcreate --$j 1 $dev2
|
||||
pvcreate --$j 2 $dev3
|
||||
check_pv_field_ $dev1 pv_mda_count 0
|
||||
check_pv_field_ $dev2 pv_mda_count 1
|
||||
check_pv_field_ $dev3 pv_mda_count 2
|
||||
check pv_field $dev1 pv_mda_count 0
|
||||
check pv_field $dev2 pv_mda_count 1
|
||||
check pv_field $dev3 pv_mda_count 2
|
||||
pvremove $dev1
|
||||
pvremove $dev2
|
||||
pvremove $dev3
|
||||
@ -89,21 +89,21 @@ not pvcreate --dataalignment 1e $dev1
|
||||
#COMM 'pvcreate always rounded up to page size for start of device'
|
||||
#pvcreate --metadatacopies 0 --dataalignment 1 $dev1
|
||||
# amuse shell experts
|
||||
#check_pv_field_ $dev1 pe_start $(($(getconf PAGESIZE)/1024))".00k"
|
||||
#check pv_field $dev1 pe_start $(($(getconf PAGESIZE)/1024))".00k"
|
||||
|
||||
#COMM 'pvcreate sets data offset directly'
|
||||
pvcreate --dataalignment 512k $dev1
|
||||
check_pv_field_ $dev1 pe_start 512.00k
|
||||
check pv_field $dev1 pe_start 512.00k
|
||||
|
||||
#COMM 'vgcreate/vgremove do not modify data offset of existing PV'
|
||||
vgcreate $vg $dev1 --config 'devices { data_alignment = 1024 }'
|
||||
check_pv_field_ $dev1 pe_start 512.00k
|
||||
check pv_field $dev1 pe_start 512.00k
|
||||
vgremove $vg --config 'devices { data_alignment = 1024 }'
|
||||
check_pv_field_ $dev1 pe_start 512.00k
|
||||
check pv_field $dev1 pe_start 512.00k
|
||||
|
||||
#COMM 'pvcreate sets data offset next to mda area'
|
||||
pvcreate --metadatasize 100k --dataalignment 100k $dev1
|
||||
check_pv_field_ $dev1 pe_start 200.00k
|
||||
check pv_field $dev1 pe_start 200.00k
|
||||
|
||||
# metadata area start is aligned according to pagesize
|
||||
# pagesize should be 64k or 4k ...
|
||||
@ -114,21 +114,21 @@ else
|
||||
fi
|
||||
|
||||
pvcreate --metadatasize 128k --dataalignment 3.5k $dev1
|
||||
check_pv_field_ $dev1 pe_start $pv_align
|
||||
check pv_field $dev1 pe_start $pv_align
|
||||
|
||||
pvcreate --metadatasize 128k --metadatacopies 2 --dataalignment 3.5k $dev1
|
||||
check_pv_field_ $dev1 pe_start $pv_align
|
||||
check pv_field $dev1 pe_start $pv_align
|
||||
|
||||
# data area is aligned to 1M by default,
|
||||
# data area start is shifted by the specified alignment_offset
|
||||
pv_align="1052160B" # 1048576 + (7*512)
|
||||
pvcreate --metadatasize 128k --dataalignmentoffset 7s $dev1
|
||||
check_pv_field_ $dev1 pe_start $pv_align "--units b"
|
||||
check pv_field $dev1 pe_start $pv_align "--units b"
|
||||
|
||||
# 2nd metadata area is created without problems when
|
||||
# data area start is shifted by the specified alignment_offset
|
||||
pvcreate --metadatasize 128k --metadatacopies 2 --dataalignmentoffset 7s $dev1
|
||||
check_pv_field_ $dev1 pv_mda_count 2
|
||||
check pv_field $dev1 pv_mda_count 2
|
||||
# FIXME: compare start of 2nd mda with and without --dataalignmentoffset
|
||||
|
||||
#COMM 'pv with LVM1 compatible data alignment can be convereted'
|
||||
@ -137,7 +137,7 @@ pvcreate --dataalignment 256k $dev1
|
||||
vgcreate -s 1m $vg $dev1
|
||||
vgconvert -M1 $vg
|
||||
vgconvert -M2 $vg
|
||||
check_pv_field_ $dev1 pe_start 256.00k
|
||||
check pv_field $dev1 pe_start 256.00k
|
||||
vgremove $vg
|
||||
|
||||
#COMM 'pv with LVM1 incompatible data alignment cannot be convereted'
|
||||
@ -155,8 +155,8 @@ vgcreate $vg $dev1 $dev2
|
||||
vgcfgbackup -f "$(pwd)/backup.$$" $vg
|
||||
sed 's/pe_start = [0-9]*/pe_start = 0/' "$(pwd)/backup.$$" > "$(pwd)/backup.$$1"
|
||||
vgcfgrestore -f "$(pwd)/backup.$$1" $vg
|
||||
check_pv_field_ $dev1 pe_start 0
|
||||
check_pv_field_ $dev2 pe_start 0
|
||||
check pv_field $dev1 pe_start 0
|
||||
check pv_field $dev2 pe_start 0
|
||||
vgremove $vg
|
||||
|
||||
echo test pvcreate --metadataignore
|
||||
@ -165,25 +165,25 @@ for mdacp in 1 2; do
|
||||
for ignore in y n; do
|
||||
echo pvcreate --metadataignore has proper mda_count and mda_used_count
|
||||
pvcreate --metadatacopies $mdacp --metadataignore $ignore $dev1 $dev2
|
||||
check_pv_field_ $dev1 pv_mda_count $mdacp
|
||||
check_pv_field_ $dev2 pv_mda_count $mdacp
|
||||
check pv_field $dev1 pv_mda_count $mdacp
|
||||
check pv_field $dev2 pv_mda_count $mdacp
|
||||
if [ $ignore = y ]; then
|
||||
check_pv_field_ $dev1 pv_mda_used_count 0
|
||||
check_pv_field_ $dev2 pv_mda_used_count 0
|
||||
check pv_field $dev1 pv_mda_used_count 0
|
||||
check pv_field $dev2 pv_mda_used_count 0
|
||||
else
|
||||
check_pv_field_ $dev1 pv_mda_used_count $mdacp
|
||||
check_pv_field_ $dev2 pv_mda_used_count $mdacp
|
||||
check pv_field $dev1 pv_mda_used_count $mdacp
|
||||
check pv_field $dev2 pv_mda_used_count $mdacp
|
||||
fi
|
||||
echo vgcreate has proper vg_mda_count and vg_mda_used_count
|
||||
if [ $pv_in_vg = 1 ]; then
|
||||
vgcreate -c n "$vg" $dev1 $dev2
|
||||
check_vg_field_ $vg vg_mda_count $(($mdacp * 2))
|
||||
check vg_field $vg vg_mda_count $(($mdacp * 2))
|
||||
if [ $ignore = y ]; then
|
||||
check_vg_field_ $vg vg_mda_used_count 1
|
||||
check vg_field $vg vg_mda_used_count 1
|
||||
else
|
||||
check_vg_field_ $vg vg_mda_used_count $(($mdacp * 2))
|
||||
check vg_field $vg vg_mda_used_count $(($mdacp * 2))
|
||||
fi
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
vgremove $vg
|
||||
fi
|
||||
done
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
test_description="ensure that pvmove works with basic options"
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Utilities
|
||||
@ -361,9 +361,9 @@ check_and_cleanup_lvs_
|
||||
|
||||
#COMM "pvmove out of --metadatacopies 0 PV (bz252150)"
|
||||
vgremove -ff $vg
|
||||
pvcreate $devs
|
||||
pvcreate $(cat DEVICES)
|
||||
pvcreate --metadatacopies 0 $dev1 $dev2
|
||||
vgcreate -c n $vg $devs
|
||||
vgcreate -c n $vg $(cat DEVICES)
|
||||
lvcreate -l4 -n $lv1 $vg $dev1
|
||||
pvmove $dev1
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 3
|
||||
pvcreate $dev1
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
test_description='Test read-ahead functionality'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
|
||||
get_lvs_() {
|
||||
@ -53,10 +53,10 @@ lvremove -ff $vg
|
||||
# Check default, active/inactive values for read_ahead / kernel_read_ahead
|
||||
lvcreate -n $lv -l 50%FREE $vg
|
||||
lvchange -an $vg/$lv
|
||||
check_lv_field_ $vg/$lv lv_read_ahead auto
|
||||
check_lv_field_ $vg/$lv lv_kernel_read_ahead -1
|
||||
check lv_field $vg/$lv lv_read_ahead auto
|
||||
check lv_field $vg/$lv lv_kernel_read_ahead -1
|
||||
lvchange -r 512 $vg/$lv
|
||||
lvchange -ay $vg/$lv
|
||||
check_lv_field_ $vg/$lv lv_read_ahead 256.00k
|
||||
check_lv_field_ $vg/$lv lv_kernel_read_ahead 256.00k
|
||||
check lv_field $vg/$lv lv_read_ahead 256.00k
|
||||
check lv_field $vg/$lv lv_kernel_read_ahead 256.00k
|
||||
lvremove -ff $vg
|
||||
|
@ -10,15 +10,13 @@
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# no automatic extensions please
|
||||
LVM_TEST_CONFIG_SNAPSHOT_AUTOEXTEND="
|
||||
snapshot_autoextend_percent = 0
|
||||
snapshot_autoextend_threshold = 100"
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
which mkfs.ext2 || exit 200
|
||||
|
||||
prepare_lvmconf
|
||||
aux lvmconf "activation/snapshot_autoextend_percent = 0" \
|
||||
"activation/snapshot_autoextend_threshold = 100"
|
||||
|
||||
aux prepare_vg 2
|
||||
aux prepare_dmeventd
|
||||
|
@ -12,7 +12,7 @@ set -xv
|
||||
|
||||
which mkfs.ext3 || exit 200
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
lvdev_()
|
||||
{
|
||||
|
@ -8,9 +8,9 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
prepare_vg 4
|
||||
aux prepare_vg 4
|
||||
|
||||
# Create snapshot of a mirror origin
|
||||
lvcreate -m 1 -L 10M -n lv $vg
|
||||
|
@ -8,15 +8,15 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_pvs 5
|
||||
|
||||
# vgcreate with --addtag
|
||||
vgcreate -c n --addtag firstvg $vg1 $dev1 $dev2
|
||||
vgcreate -c n --addtag secondvg $vg2 $dev3 $dev4
|
||||
check_vg_field_ $vg1 tags firstvg
|
||||
check_vg_field_ $vg2 tags secondvg
|
||||
check vg_field $vg1 tags firstvg
|
||||
check vg_field $vg2 tags secondvg
|
||||
vgremove -ff $vg1
|
||||
vgremove -ff $vg2
|
||||
|
||||
@ -31,10 +31,10 @@ vgchange --addtag firstvgtag3 $vg1
|
||||
vgchange --addtag secondvgtag1 $vg2
|
||||
vgchange --addtag secondvgtag2 $vg2
|
||||
vgchange --addtag secondvgtag3 $vg2
|
||||
check_vg_field_ @firstvgtag2 tags "firstvgtag1,firstvgtag2,firstvgtag3"
|
||||
check_vg_field_ @secondvgtag1 tags "secondvgtag1,secondvgtag2,secondvgtag3"
|
||||
check vg_field @firstvgtag2 tags "firstvgtag1,firstvgtag2,firstvgtag3"
|
||||
check vg_field @secondvgtag1 tags "secondvgtag1,secondvgtag2,secondvgtag3"
|
||||
vgchange --deltag firstvgtag2 $vg1
|
||||
check_vg_field_ @firstvgtag1 tags "firstvgtag1,firstvgtag3"
|
||||
check vg_field @firstvgtag1 tags "firstvgtag1,firstvgtag3"
|
||||
# deleting a tag multiple times is not an error
|
||||
vgchange --deltag firstvgtag2 $vg1
|
||||
vgchange --deltag firstvgtag1 $vg2
|
||||
@ -45,10 +45,10 @@ vgremove -ff $vg2
|
||||
vgcreate -c n $vg1 $dev1 $dev2
|
||||
lvcreate --addtag firstlvtag1 -l 4 -n $lv1 $vg1
|
||||
lvcreate --addtag secondlvtag1 -l 4 -n $lv2 $vg1
|
||||
check_lv_field_ @firstlvtag1 tags "firstlvtag1"
|
||||
not check_lv_field_ @secondlvtag1 tags "firstlvtag1"
|
||||
check_lv_field_ $vg1/$lv2 tags "secondlvtag1"
|
||||
not check_lv_field_ $vg1/$lv1 tags "secondlvtag1"
|
||||
check lv_field @firstlvtag1 tags "firstlvtag1"
|
||||
not check lv_field @secondlvtag1 tags "firstlvtag1"
|
||||
check lv_field $vg1/$lv2 tags "secondlvtag1"
|
||||
not check lv_field $vg1/$lv1 tags "secondlvtag1"
|
||||
vgremove -ff $vg1
|
||||
|
||||
# lvchange with --addtag and --deltag
|
||||
@ -63,12 +63,12 @@ lvchange --addtag firstlvtag3 $vg1/$lv1
|
||||
lvchange --addtag secondlvtag1 $vg1/$lv2
|
||||
lvchange --addtag secondlvtag2 $vg1/$lv2
|
||||
lvchange --addtag secondlvtag3 $vg1/$lv2
|
||||
check_lv_field_ $vg1/$lv1 tags "firstlvtag1,firstlvtag2,firstlvtag3"
|
||||
not $(check_lv_field_ $vg1/$lv1 tags "secondlvtag1")
|
||||
check_lv_field_ $vg1/$lv2 tags "secondlvtag1,secondlvtag2,secondlvtag3"
|
||||
not $(check_lv_field_ $vg1/$lv1 tags "secondlvtag1")
|
||||
check lv_field $vg1/$lv1 tags "firstlvtag1,firstlvtag2,firstlvtag3"
|
||||
not $(check lv_field $vg1/$lv1 tags "secondlvtag1")
|
||||
check lv_field $vg1/$lv2 tags "secondlvtag1,secondlvtag2,secondlvtag3"
|
||||
not $(check lv_field $vg1/$lv1 tags "secondlvtag1")
|
||||
# deleting a tag multiple times is not an error
|
||||
lvchange --deltag firstlvtag2 $vg1/$lv1
|
||||
lvchange --deltag firstlvtag2 $vg1/$lv1
|
||||
check_lv_field_ $vg1/$lv1 tags "firstlvtag1,firstlvtag3"
|
||||
check_lv_field_ $vg1/$lv2 tags "secondlvtag1,secondlvtag2,secondlvtag3"
|
||||
check lv_field $vg1/$lv1 tags "firstlvtag1,firstlvtag3"
|
||||
check lv_field $vg1/$lv2 tags "secondlvtag1,secondlvtag2,secondlvtag3"
|
||||
|
@ -18,7 +18,7 @@ which sfdisk || exit 200
|
||||
|
||||
LVM_TEST_CONFIG_DEVICES="types = [\"device-mapper\", 142]"
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_pvs 1 30
|
||||
|
||||
|
@ -15,7 +15,7 @@ linux_minor=$(echo `uname -r` | cut -d'.' -f3 | cut -d'-' -f1)
|
||||
|
||||
test $linux_minor -ge 31 || exit 200
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
check_logical_block_size()
|
||||
{
|
||||
@ -64,41 +64,41 @@ DEV_SIZE=$(($NUM_DEVS*$PER_DEV_SIZE))
|
||||
# Create "desktop-class" 4K drive
|
||||
# (logical_block_size=512, physical_block_size=4096, alignment_offset=0):
|
||||
LOGICAL_BLOCK_SIZE=512
|
||||
prepare_scsi_debug_dev $DEV_SIZE \
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3
|
||||
check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE
|
||||
|
||||
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
||||
vgcreate -c n $vg $devs
|
||||
vgcreate -c n $vg $(cat DEVICES)
|
||||
test_snapshot_mount
|
||||
vgremove $vg
|
||||
|
||||
cleanup_scsi_debug_dev
|
||||
aux cleanup_scsi_debug_dev
|
||||
|
||||
# ---------------------------------------------
|
||||
# Create "desktop-class" 4K drive w/ 63-sector DOS partition compensation
|
||||
# (logical_block_size=512, physical_block_size=4096, alignment_offset=3584):
|
||||
LOGICAL_BLOCK_SIZE=512
|
||||
prepare_scsi_debug_dev $DEV_SIZE \
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3 lowest_aligned=7
|
||||
check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE
|
||||
|
||||
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
||||
vgcreate -c n $vg $devs
|
||||
vgcreate -c n $vg $(cat DEVICES)
|
||||
test_snapshot_mount
|
||||
vgremove $vg
|
||||
|
||||
cleanup_scsi_debug_dev
|
||||
aux cleanup_scsi_debug_dev
|
||||
|
||||
# ---------------------------------------------
|
||||
# Create "enterprise-class" 4K drive
|
||||
# (logical_block_size=4096, physical_block_size=4096, alignment_offset=0):
|
||||
LOGICAL_BLOCK_SIZE=4096
|
||||
prepare_scsi_debug_dev $DEV_SIZE \
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE
|
||||
check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE
|
||||
|
||||
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
||||
vgcreate -c n $vg $devs
|
||||
vgcreate -c n $vg $(cat DEVICES)
|
||||
test_snapshot_mount
|
||||
vgremove $vg
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_vg 4
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_vg 3
|
||||
|
||||
@ -24,15 +24,15 @@ not grep "Inconsistent metadata found for VG $vg" vgscan.out
|
||||
}
|
||||
|
||||
# try orphaning a missing PV (bz45867)
|
||||
disable_dev $dev1
|
||||
aux disable_dev $dev1
|
||||
vgreduce --removemissing --force $vg
|
||||
enable_dev $dev1
|
||||
aux enable_dev $dev1
|
||||
check
|
||||
|
||||
# try to just change metadata; we expect the new version (with MISSING_PV set
|
||||
# on the reappeared volume) to be written out to the previously missing PV
|
||||
vgextend $vg $dev1
|
||||
disable_dev $dev1
|
||||
aux disable_dev $dev1
|
||||
lvremove $vg/mirror
|
||||
enable_dev $dev1
|
||||
aux enable_dev $dev1
|
||||
check
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_pvs 4
|
||||
|
||||
@ -28,7 +28,7 @@ vgremove -ff $vg2
|
||||
# and vgcfgrestore able to restore them when device reappears
|
||||
pv1_uuid=$(pvs --noheadings -o pv_uuid $dev1)
|
||||
pv2_uuid=$(pvs --noheadings -o pv_uuid $dev2)
|
||||
vgcreate $vg $devs
|
||||
vgcreate $vg $(cat DEVICES)
|
||||
lvcreate -l1 -n $lv1 $vg $dev1
|
||||
lvcreate -l1 -n $lv2 $vg $dev2
|
||||
lvcreate -l1 -n $lv3 $vg $dev3
|
||||
@ -46,8 +46,8 @@ vgremove -ff $vg
|
||||
# FIXME: clvmd seems to have problem with metadata format change here
|
||||
# fix it and remove this vgscan
|
||||
vgscan
|
||||
pvcreate -M1 $devs
|
||||
vgcreate -M1 -c n $vg $devs
|
||||
pvcreate -M1 $(cat DEVICES)
|
||||
vgcreate -M1 -c n $vg $(cat DEVICES)
|
||||
lvcreate -l1 -n $lv1 $vg $dev1
|
||||
pvremove -ff -y $dev2
|
||||
not lvcreate -l1 -n $lv1 $vg $dev3
|
||||
|
@ -9,9 +9,9 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
prepare_dmeventd
|
||||
aux prepare_dmeventd
|
||||
aux prepare_pvs 3
|
||||
|
||||
vgcreate -c n -l 2 $vg $dev1 $dev2 $dev3
|
||||
|
@ -11,34 +11,34 @@
|
||||
|
||||
test_description='Exercise some vgchange diagnostics'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_pvs 3
|
||||
pvcreate --metadatacopies 0 $dev1
|
||||
vgcreate $vg $devs
|
||||
vgcreate $vg $(cat DEVICES)
|
||||
|
||||
vgdisplay $vg
|
||||
|
||||
# vgchange -p MaxPhysicalVolumes (bz202232)
|
||||
aux check_vg_field_ $vg max_pv 0
|
||||
aux check vg_field $vg max_pv 0
|
||||
vgchange -p 128 $vg
|
||||
aux check_vg_field_ $vg max_pv 128
|
||||
aux check vg_field $vg max_pv 128
|
||||
|
||||
pv_count=$(get_vg_field $vg pv_count)
|
||||
pv_count=$(get vg_field $vg pv_count)
|
||||
not vgchange -p 2 $vg 2>err
|
||||
grep "MaxPhysicalVolumes is less than the current number $pv_count of PVs for" err
|
||||
aux check_vg_field_ $vg max_pv 128
|
||||
aux check vg_field $vg max_pv 128
|
||||
|
||||
# vgchange -l MaxLogicalVolumes
|
||||
aux check_vg_field_ $vg max_lv 0
|
||||
aux check vg_field $vg max_lv 0
|
||||
vgchange -l 128 $vg
|
||||
aux check_vg_field_ $vg max_lv 128
|
||||
aux check vg_field $vg max_lv 128
|
||||
|
||||
lvcreate -l4 -n$lv1 $vg
|
||||
lvcreate -l4 -n$lv2 $vg
|
||||
|
||||
lv_count=$(get_vg_field $vg lv_count)
|
||||
lv_count=$(get vg_field $vg lv_count)
|
||||
not vgchange -l 1 $vg 2>err
|
||||
grep "MaxLogicalVolume is less than the current number $lv_count of LVs for" err
|
||||
aux check_vg_field_ $vg max_lv 128
|
||||
aux check vg_field $vg max_lv 128
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
test_description='Exercise some vgcreate diagnostics'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 3
|
||||
pvcreate $dev1 $dev2
|
||||
@ -21,7 +21,7 @@ vg=${PREFIX}vg
|
||||
|
||||
#COMM 'vgcreate accepts 8.00m physicalextentsize for VG'
|
||||
vgcreate -c n $vg --physicalextentsize 8.00m $dev1 $dev2
|
||||
check_vg_field_ $vg vg_extent_size 8.00m
|
||||
check vg_field $vg vg_extent_size 8.00m
|
||||
vgremove $vg
|
||||
# try vgck and to remove it again - should fail (but not segfault)
|
||||
not vgremove $vg
|
||||
@ -29,12 +29,12 @@ not vgck $vg
|
||||
|
||||
#COMM 'vgcreate accepts smaller (128) maxlogicalvolumes for VG'
|
||||
vgcreate -c n $vg --maxlogicalvolumes 128 $dev1 $dev2
|
||||
check_vg_field_ $vg max_lv 128
|
||||
check vg_field $vg max_lv 128
|
||||
vgremove $vg
|
||||
|
||||
#COMM 'vgcreate accepts smaller (128) maxphysicalvolumes for VG'
|
||||
vgcreate -c n $vg --maxphysicalvolumes 128 $dev1 $dev2
|
||||
check_vg_field_ $vg max_pv 128
|
||||
check vg_field $vg max_pv 128
|
||||
vgremove $vg
|
||||
|
||||
#COMM 'vgcreate rejects a zero physical extent size'
|
||||
@ -75,7 +75,7 @@ not vgcreate -c n $vg $dev3
|
||||
# Test default (4MB) vg_extent_size as well as limits of extent_size
|
||||
not vgcreate -c n --physicalextentsize 0k $vg $dev1 $dev2
|
||||
vgcreate -c n --physicalextentsize 1k $vg $dev1 $dev2
|
||||
check_vg_field_ $vg vg_extent_size 1.00k
|
||||
check vg_field $vg vg_extent_size 1.00k
|
||||
vgremove -ff $vg
|
||||
not vgcreate -c n --physicalextentsize 3K $vg $dev1 $dev2
|
||||
not vgcreate -c n --physicalextentsize 1024t $vg $dev1 $dev2
|
||||
@ -84,10 +84,10 @@ not vgcreate -c n --physicalextentsize 1024t $vg $dev1 $dev2
|
||||
|
||||
# Test default max_lv, max_pv, extent_size, alloc_policy, clustered
|
||||
vgcreate -c n $vg $dev1 $dev2
|
||||
check_vg_field_ $vg vg_extent_size 4.00m
|
||||
check_vg_field_ $vg max_lv 0
|
||||
check_vg_field_ $vg max_pv 0
|
||||
check_vg_field_ $vg vg_attr "wz--n-"
|
||||
check vg_field $vg vg_extent_size 4.00m
|
||||
check vg_field $vg max_lv 0
|
||||
check vg_field $vg max_pv 0
|
||||
check vg_field $vg vg_attr "wz--n-"
|
||||
vgremove -ff $vg
|
||||
|
||||
# Implicit pvcreate tests, test pvcreate options on vgcreate
|
||||
@ -111,22 +111,22 @@ done
|
||||
for i in 1 2
|
||||
do
|
||||
vgcreate -c n --pvmetadatacopies $i $vg $dev1
|
||||
check_pv_field_ $dev1 pv_mda_count $i
|
||||
check pv_field $dev1 pv_mda_count $i
|
||||
vgremove -f $vg
|
||||
pvremove -f $dev1
|
||||
done
|
||||
not vgcreate -c n --pvmetadatacopies 0 $vg $dev1
|
||||
pvcreate --metadatacopies 1 $dev2
|
||||
vgcreate -c n --pvmetadatacopies 0 $vg $dev1 $dev2
|
||||
check_pv_field_ $dev1 pv_mda_count 0
|
||||
check_pv_field_ $dev2 pv_mda_count 1
|
||||
check pv_field $dev1 pv_mda_count 0
|
||||
check pv_field $dev2 pv_mda_count 1
|
||||
vgremove -f $vg
|
||||
pvremove -f $dev1
|
||||
|
||||
# metadatasize, dataalignment, dataalignmentoffset
|
||||
#COMM 'pvcreate sets data offset next to mda area'
|
||||
vgcreate -c n --metadatasize 100k --dataalignment 100k $vg $dev1
|
||||
check_pv_field_ $dev1 pe_start 200.00k
|
||||
check pv_field $dev1 pe_start 200.00k
|
||||
vgremove -f $vg
|
||||
pvremove -f $dev1
|
||||
|
||||
@ -134,7 +134,7 @@ pvremove -f $dev1
|
||||
# data area start is shifted by the specified alignment_offset
|
||||
pv_align="1052160B" # 1048576 + (7*512)
|
||||
vgcreate -c n --metadatasize 128k --dataalignmentoffset 7s $vg $dev1
|
||||
check_pv_field_ $dev1 pe_start $pv_align "--units b"
|
||||
check pv_field $dev1 pe_start $pv_align "--units b"
|
||||
vgremove -f $vg
|
||||
pvremove -f $dev1
|
||||
|
||||
@ -142,7 +142,7 @@ pvremove -f $dev1
|
||||
for i in 1 2
|
||||
do
|
||||
vgcreate -c n -M $i $vg $dev1
|
||||
check_vg_field_ $vg vg_fmt lvm$i
|
||||
check vg_field $vg vg_fmt lvm$i
|
||||
vgremove -f $vg
|
||||
pvremove -f $dev1
|
||||
done
|
||||
@ -156,8 +156,8 @@ pvremove -f $dev1 $dev2
|
||||
# all PVs exist in the VG after created
|
||||
pvcreate $dev1
|
||||
vgcreate -c n $vg1 $dev1 $dev2 $dev3
|
||||
check_pv_field_ $dev1 vg_name $vg1
|
||||
check_pv_field_ $dev2 vg_name $vg1
|
||||
check_pv_field_ $dev3 vg_name $vg1
|
||||
check pv_field $dev1 vg_name $vg1
|
||||
check pv_field $dev2 vg_name $vg1
|
||||
check pv_field $dev3 vg_name $vg1
|
||||
vgremove -f $vg1
|
||||
pvremove -f $dev1 $dev2 $dev3
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
|
||||
aux prepare_vg 3
|
||||
@ -19,9 +19,9 @@ lvcreate -l 1 -n lv1 $vg $dev1
|
||||
|
||||
# try to just change metadata; we expect the new version (with MISSING_PV set
|
||||
# on the reappeared volume) to be written out to the previously missing PV
|
||||
disable_dev $dev1
|
||||
aux disable_dev $dev1
|
||||
lvremove $vg/mirror
|
||||
enable_dev $dev1
|
||||
aux enable_dev $dev1
|
||||
not vgck $vg 2>&1 | tee log
|
||||
grep "missing 1 physical volume" log
|
||||
not lvcreate -m 1 -l 1 -n mirror $vg # write operations fail
|
||||
|
@ -12,7 +12,7 @@
|
||||
# Exercise various vgextend commands
|
||||
#
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 5
|
||||
|
||||
@ -55,7 +55,7 @@ done
|
||||
for i in 0 1 2
|
||||
do
|
||||
vgextend --pvmetadatacopies $i $vg $dev1
|
||||
check_pv_field_ $dev1 pv_mda_count $i
|
||||
check pv_field $dev1 pv_mda_count $i
|
||||
vgreduce $vg $dev1
|
||||
pvremove -f $dev1
|
||||
done
|
||||
@ -63,7 +63,7 @@ done
|
||||
# metadatasize, dataalignment, dataalignmentoffset
|
||||
#COMM 'pvcreate sets data offset next to mda area'
|
||||
vgextend --metadatasize 100k --dataalignment 100k $vg $dev1
|
||||
check_pv_field_ $dev1 pe_start 200.00k
|
||||
check pv_field $dev1 pe_start 200.00k
|
||||
vgreduce $vg $dev1
|
||||
pvremove -f $dev1
|
||||
|
||||
@ -71,7 +71,7 @@ pvremove -f $dev1
|
||||
# data area start is shifted by the specified alignment_offset
|
||||
pv_align="1052160B" # 1048576 + (7*512)
|
||||
vgextend --metadatasize 128k --dataalignmentoffset 7s $vg $dev1
|
||||
check_pv_field_ $dev1 pe_start $pv_align "--units b"
|
||||
check pv_field $dev1 pe_start $pv_align "--units b"
|
||||
vgremove -f $vg
|
||||
pvremove -f $dev1
|
||||
|
||||
@ -94,9 +94,9 @@ pvremove -f $dev1 $dev2
|
||||
pvcreate $dev1
|
||||
vgcreate $vg1 $dev2
|
||||
vgextend $vg1 $dev1 $dev3
|
||||
check_pv_field_ $dev1 vg_name $vg1
|
||||
check_pv_field_ $dev2 vg_name $vg1
|
||||
check_pv_field_ $dev3 vg_name $vg1
|
||||
check pv_field $dev1 vg_name $vg1
|
||||
check pv_field $dev2 vg_name $vg1
|
||||
check pv_field $dev3 vg_name $vg1
|
||||
vgremove -f $vg1
|
||||
pvremove -f $dev1 $dev2 $dev3
|
||||
|
||||
@ -106,23 +106,23 @@ for ignore in y n; do
|
||||
echo vgextend --metadataignore has proper mda_count and mda_used_count
|
||||
vgcreate $vg $dev3
|
||||
vgextend --metadataignore $ignore --pvmetadatacopies $mdacp $vg $dev1 $dev2
|
||||
check_pv_field_ $dev1 pv_mda_count $mdacp
|
||||
check_pv_field_ $dev2 pv_mda_count $mdacp
|
||||
check pv_field $dev1 pv_mda_count $mdacp
|
||||
check pv_field $dev2 pv_mda_count $mdacp
|
||||
if [ $ignore = y ]; then
|
||||
check_pv_field_ $dev1 pv_mda_used_count 0
|
||||
check_pv_field_ $dev2 pv_mda_used_count 0
|
||||
check pv_field $dev1 pv_mda_used_count 0
|
||||
check pv_field $dev2 pv_mda_used_count 0
|
||||
else
|
||||
check_pv_field_ $dev1 pv_mda_used_count $mdacp
|
||||
check_pv_field_ $dev2 pv_mda_used_count $mdacp
|
||||
check pv_field $dev1 pv_mda_used_count $mdacp
|
||||
check pv_field $dev2 pv_mda_used_count $mdacp
|
||||
fi
|
||||
echo vg has proper vg_mda_count and vg_mda_used_count
|
||||
check_vg_field_ $vg vg_mda_count $(($mdacp * 2 + 1))
|
||||
check vg_field $vg vg_mda_count $(($mdacp * 2 + 1))
|
||||
if [ $ignore = y ]; then
|
||||
check_vg_field_ $vg vg_mda_used_count 1
|
||||
check vg_field $vg vg_mda_used_count 1
|
||||
else
|
||||
check_vg_field_ $vg vg_mda_used_count $(($mdacp * 2 + 1))
|
||||
check vg_field $vg vg_mda_used_count $(($mdacp * 2 + 1))
|
||||
fi
|
||||
check_vg_field_ $vg vg_mda_copies unmanaged
|
||||
check vg_field $vg vg_mda_copies unmanaged
|
||||
vgremove $vg
|
||||
pvremove -ff $dev1 $dev2 $dev3
|
||||
done
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
test_description='Test vgmerge operation'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_pvs 4 64
|
||||
|
||||
@ -20,10 +20,10 @@ vgcreate -c n $vg1 $dev1 $dev2
|
||||
vgcreate -c n $vg2 $dev3 $dev4
|
||||
lvcreate -l 4 -n $lv1 $vg1 $dev1
|
||||
vgchange -an $vg1
|
||||
vg_validate_pvlv_counts_ $vg1 2 1 0
|
||||
vg_validate_pvlv_counts_ $vg2 2 0 0
|
||||
check pvlv_counts $vg1 2 1 0
|
||||
check pvlv_counts $vg2 2 0 0
|
||||
vgmerge $vg2 $vg1
|
||||
vg_validate_pvlv_counts_ $vg2 4 1 0
|
||||
check pvlv_counts $vg2 4 1 0
|
||||
vgremove -f $vg2
|
||||
|
||||
# 'vgmerge succeeds with single linear LV in source and destination VG'
|
||||
@ -33,10 +33,10 @@ lvcreate -l 4 -n $lv1 $vg1
|
||||
lvcreate -l 4 -n $lv2 $vg2
|
||||
vgchange -an $vg1
|
||||
vgchange -an $vg2
|
||||
vg_validate_pvlv_counts_ $vg1 2 1 0
|
||||
vg_validate_pvlv_counts_ $vg2 2 1 0
|
||||
check pvlv_counts $vg1 2 1 0
|
||||
check pvlv_counts $vg2 2 1 0
|
||||
vgmerge $vg2 $vg1
|
||||
vg_validate_pvlv_counts_ $vg2 4 2 0
|
||||
check pvlv_counts $vg2 4 2 0
|
||||
vgremove -f $vg2
|
||||
|
||||
# 'vgmerge succeeds with linear LV + snapshots in source VG'
|
||||
@ -45,10 +45,10 @@ vgcreate -c n $vg2 $dev3 $dev4
|
||||
lvcreate -l 16 -n $lv1 $vg1
|
||||
lvcreate -l 4 -s -n $lv2 $vg1/$lv1
|
||||
vgchange -an $vg1
|
||||
vg_validate_pvlv_counts_ $vg1 2 2 1
|
||||
vg_validate_pvlv_counts_ $vg2 2 0 0
|
||||
check pvlv_counts $vg1 2 2 1
|
||||
check pvlv_counts $vg2 2 0 0
|
||||
vgmerge $vg2 $vg1
|
||||
vg_validate_pvlv_counts_ $vg2 4 2 1
|
||||
check pvlv_counts $vg2 4 2 1
|
||||
lvremove -f $vg2/$lv2
|
||||
vgremove -f $vg2
|
||||
|
||||
@ -57,10 +57,10 @@ vgcreate -c n $vg1 $dev1 $dev2 $dev3
|
||||
vgcreate -c n $vg2 $dev4
|
||||
lvcreate -l 4 -n $lv1 -m1 $vg1
|
||||
vgchange -an $vg1
|
||||
vg_validate_pvlv_counts_ $vg1 3 1 0
|
||||
vg_validate_pvlv_counts_ $vg2 1 0 0
|
||||
check pvlv_counts $vg1 3 1 0
|
||||
check pvlv_counts $vg2 1 0 0
|
||||
vgmerge $vg2 $vg1
|
||||
vg_validate_pvlv_counts_ $vg2 4 1 0
|
||||
check pvlv_counts $vg2 4 1 0
|
||||
lvremove -f $vg2/$lv1
|
||||
vgremove -f $vg2
|
||||
|
||||
@ -70,12 +70,12 @@ vgcreate -c n $vg2 $dev3 $dev4
|
||||
lvcreate -l 4 -n $lv1 $vg1
|
||||
lvcreate -l 4 -n $lv1 $vg2
|
||||
vgchange -an $vg1
|
||||
aux vg_validate_pvlv_counts_ $vg1 2 1 0
|
||||
aux vg_validate_pvlv_counts_ $vg2 2 1 0
|
||||
check pvlv_counts $vg1 2 1 0
|
||||
check pvlv_counts $vg2 2 1 0
|
||||
not vgmerge $vg2 $vg1 2>err
|
||||
grep "Duplicate logical volume name \"$lv1\" in \"$vg2\" and \"$vg1" err
|
||||
aux vg_validate_pvlv_counts_ $vg1 2 1 0
|
||||
aux vg_validate_pvlv_counts_ $vg2 2 1 0
|
||||
check pvlv_counts $vg1 2 1 0
|
||||
check pvlv_counts $vg2 2 1 0
|
||||
vgremove -f $vg1
|
||||
vgremove -f $vg2
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
# 'Test vgmerge command options for validity'
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_pvs 4
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 4
|
||||
|
||||
@ -21,7 +21,7 @@ do
|
||||
# (lvm$mdatype) vgreduce removes only the specified pv from vg (bz427382)" '
|
||||
vgcreate -c n -M$mdatype $vg1 $dev1 $dev2
|
||||
vgreduce $vg1 $dev1
|
||||
check_pv_field_ $dev2 vg_name $vg1
|
||||
check pv_field $dev2 vg_name $vg1
|
||||
vgremove -f $vg1
|
||||
|
||||
# (lvm$mdatype) vgreduce rejects removing the last pv (--all)
|
||||
@ -58,15 +58,15 @@ vgchange -an $vg1
|
||||
aux disable_dev $dev1
|
||||
# (lvm$mdatype) vgreduce --removemissing --force repares to linear
|
||||
vgreduce --removemissing --force $vg1
|
||||
check_lv_field_ $vg1/$lv1 segtype linear
|
||||
vg_validate_pvlv_counts_ $vg1 2 3 0
|
||||
check lv_field $vg1/$lv1 segtype linear
|
||||
check pvlv_counts $vg1 2 3 0
|
||||
# cleanup
|
||||
aux enable_dev $dev1
|
||||
vgremove -ff $vg1
|
||||
|
||||
#COMM "vgreduce rejects --removemissing --mirrorsonly --force when nonmirror lv lost too"
|
||||
# (lvm$mdatype) setup: create mirror + linear lvs
|
||||
vgcreate -c n -M$mdatype $vg1 $devs
|
||||
vgcreate -c n -M$mdatype $vg1 $(cat DEVICES)
|
||||
lvcreate -n $lv2 -l 4 $vg1
|
||||
lvcreate -m1 -n $lv1 -l 4 $vg1 $dev1 $dev2 $dev3
|
||||
lvcreate -n $lv3 -l 4 $vg1 $dev3
|
||||
|
@ -8,7 +8,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 4
|
||||
pvcreate $dev1 $dev2
|
||||
@ -19,17 +19,17 @@ pvcreate --metadatacopies 0 $dev3 $dev4
|
||||
# ensure name ordering does not matter
|
||||
vgcreate $vg1 $dev1 $dev2
|
||||
vgrename $vg1 $vg2
|
||||
check_vg_field_ $vg2 vg_name $vg2
|
||||
check vg_field $vg2 vg_name $vg2
|
||||
vgrename $vg2 $vg1
|
||||
check_vg_field_ $vg1 vg_name $vg1
|
||||
check vg_field $vg1 vg_name $vg1
|
||||
vgremove $vg1
|
||||
|
||||
# vgrename by uuid (bz231187)
|
||||
vgcreate $vg1 $dev1 $dev3
|
||||
UUID=$(vgs --noheading -o vg_uuid $vg1)
|
||||
check_vg_field_ $vg1 vg_uuid $UUID
|
||||
check vg_field $vg1 vg_uuid $UUID
|
||||
vgrename $UUID $vg2
|
||||
check_vg_field_ $vg2 vg_name $vg2
|
||||
check vg_field $vg2 vg_name $vg2
|
||||
vgremove $vg2
|
||||
|
||||
# vgrename fails - new vg already exists
|
||||
|
@ -11,13 +11,13 @@
|
||||
|
||||
# Test vgsplit operation, including different LV types
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
COMM() {
|
||||
LAST_TEST="$@"
|
||||
}
|
||||
|
||||
prepare_pvs 5 258
|
||||
aux prepare_pvs 5 258
|
||||
# FIXME: paramaterize lvm1 vs lvm2 metadata; most of these tests should run
|
||||
# fine with lvm1 metadata as well; for now, just add disks 5 and 6 as lvm1
|
||||
# metadata
|
||||
@ -44,11 +44,11 @@ COMM "vgsplit correctly splits single linear LV into $i VG ($j args)"
|
||||
else
|
||||
vgsplit -n $lv1 $vg1 $vg2
|
||||
fi
|
||||
vg_validate_pvlv_counts_ $vg1 1 0 0
|
||||
check pvlv_counts $vg1 1 0 0
|
||||
if [ $i = existing ]; then
|
||||
aux vg_validate_pvlv_counts_ $vg2 3 1 0
|
||||
check pvlv_counts $vg2 3 1 0
|
||||
else
|
||||
aux vg_validate_pvlv_counts_ $vg2 1 1 0
|
||||
check pvlv_counts $vg2 1 1 0
|
||||
fi
|
||||
lvremove -f $vg2/$lv1
|
||||
vgremove -f $vg2
|
||||
@ -67,9 +67,9 @@ COMM "vgsplit correctly splits single striped LV into $i VG ($j args)"
|
||||
vgsplit -n $lv1 $vg1 $vg2
|
||||
fi
|
||||
if [ $i = existing ]; then
|
||||
aux vg_validate_pvlv_counts_ $vg2 4 1 0
|
||||
check pvlv_counts $vg2 4 1 0
|
||||
else
|
||||
aux vg_validate_pvlv_counts_ $vg2 2 1 0
|
||||
check pvlv_counts $vg2 2 1 0
|
||||
fi
|
||||
lvremove -f $vg2/$lv1
|
||||
vgremove -f $vg2
|
||||
@ -87,9 +87,9 @@ COMM "vgsplit correctly splits mirror LV into $i VG ($j args)"
|
||||
vgsplit -n $lv1 $vg1 $vg2
|
||||
fi
|
||||
if [ $i = existing ]; then
|
||||
aux vg_validate_pvlv_counts_ $vg2 4 1 0
|
||||
check pvlv_counts $vg2 4 1 0
|
||||
else
|
||||
aux vg_validate_pvlv_counts_ $vg2 3 1 0
|
||||
check pvlv_counts $vg2 3 1 0
|
||||
fi
|
||||
lvremove -f $vg2/$lv1
|
||||
vgremove -f $vg2
|
||||
@ -108,9 +108,9 @@ COMM "vgsplit correctly splits origin and snapshot LV into $i VG ($j args)"
|
||||
vgsplit -n $lv1 $vg1 $vg2
|
||||
fi
|
||||
if [ $i = existing ]; then
|
||||
aux vg_validate_pvlv_counts_ $vg2 4 2 1
|
||||
check pvlv_counts $vg2 4 2 1
|
||||
else
|
||||
aux vg_validate_pvlv_counts_ $vg2 2 2 1
|
||||
check pvlv_counts $vg2 2 2 1
|
||||
fi
|
||||
lvremove -f $vg2/$lv2
|
||||
lvremove -f $vg2/$lv1
|
||||
@ -132,11 +132,11 @@ COMM "vgsplit correctly splits linear LV but not snap+origin LV into $i VG ($j a
|
||||
vgsplit -n $lv3 $vg1 $vg2
|
||||
fi
|
||||
if [ $i = existing ]; then
|
||||
aux vg_validate_pvlv_counts_ $vg2 2 1 0
|
||||
aux vg_validate_pvlv_counts_ $vg1 2 2 1
|
||||
check pvlv_counts $vg2 2 1 0
|
||||
check pvlv_counts $vg1 2 2 1
|
||||
else
|
||||
aux vg_validate_pvlv_counts_ $vg2 1 1 0
|
||||
aux vg_validate_pvlv_counts_ $vg1 2 2 1
|
||||
check pvlv_counts $vg2 1 1 0
|
||||
check pvlv_counts $vg1 2 2 1
|
||||
fi
|
||||
lvremove -f $vg1/$lv2
|
||||
lvremove -f $vg1/$lv1
|
||||
@ -162,14 +162,14 @@ COMM "vgsplit correctly splits linear LV but not mirror LV into $i VG ($j args)"
|
||||
vgsplit -n $lv2 $vg1 $vg2
|
||||
fi
|
||||
if [ $i = existing ]; then
|
||||
aux vg_validate_pvlv_counts_ $vg1 3 1 0
|
||||
aux vg_validate_pvlv_counts_ $vg2 2 1 0
|
||||
check pvlv_counts $vg1 3 1 0
|
||||
check pvlv_counts $vg2 2 1 0
|
||||
else
|
||||
vgs
|
||||
lvs
|
||||
pvs
|
||||
aux vg_validate_pvlv_counts_ $vg1 3 1 0
|
||||
aux vg_validate_pvlv_counts_ $vg2 1 1 0
|
||||
check pvlv_counts $vg1 3 1 0
|
||||
check pvlv_counts $vg2 1 1 0
|
||||
fi
|
||||
lvremove -f $vg1/$lv1
|
||||
lvremove -f $vg2/$lv2
|
||||
@ -197,7 +197,7 @@ vgcreate -c n $vg1 $dev1 $dev2 $dev3 $dev4
|
||||
lvcreate -l 16 -n $lv1 $vg1 $dev1 $dev2
|
||||
lvcreate -l 4 -n $lv2 -s $vg1/$lv1 $dev3
|
||||
lvcreate -l 4 -n $lv3 -s $vg1/$lv1 $dev4
|
||||
vg_validate_pvlv_counts_ $vg1 4 3 2
|
||||
check pvlv_counts $vg1 4 3 2
|
||||
vgchange -an $vg1
|
||||
not vgsplit -n $lv1 $vg1 $vg2;
|
||||
lvremove -f $vg1/$lv2
|
||||
@ -210,7 +210,7 @@ vgcreate -c n $vg1 $dev1 $dev2 $dev3 $dev4
|
||||
lvcreate -l 16 -n $lv1 $vg1 $dev1 $dev2
|
||||
lvcreate -l 4 -n $lv2 -s $vg1/$lv1 $dev3
|
||||
lvcreate -l 4 -n $lv3 -s $vg1/$lv1 $dev4
|
||||
vg_validate_pvlv_counts_ $vg1 4 3 2
|
||||
check pvlv_counts $vg1 4 3 2
|
||||
vgchange -an $vg1
|
||||
not vgsplit -n $lv2 $vg1 $vg2
|
||||
lvremove -f $vg1/$lv2
|
||||
@ -221,7 +221,7 @@ vgremove -ff $vg1
|
||||
COMM "vgsplit fails splitting one mirror LV, only one PV specified"
|
||||
vgcreate -c n $vg1 $dev1 $dev2 $dev3 $dev4
|
||||
lvcreate -l 16 -n $lv1 -m1 $vg1 $dev1 $dev2 $dev3
|
||||
vg_validate_pvlv_counts_ $vg1 4 1 0
|
||||
check pvlv_counts $vg1 4 1 0
|
||||
vgchange -an $vg1
|
||||
not vgsplit $vg1 $vg2 $dev2
|
||||
vgremove -ff $vg1
|
||||
@ -230,7 +230,7 @@ COMM "vgsplit fails splitting 1 mirror + 1 striped LV, only striped LV specified
|
||||
vgcreate -c n $vg1 $dev1 $dev2 $dev3 $dev4
|
||||
lvcreate -l 16 -n $lv1 -m1 $vg1 $dev1 $dev2 $dev3
|
||||
lvcreate -l 16 -n $lv2 -i 2 $vg1 $dev3 $dev4
|
||||
vg_validate_pvlv_counts_ $vg1 4 2 0
|
||||
check pvlv_counts $vg1 4 2 0
|
||||
vgchange -an $vg1
|
||||
not vgsplit -n $lv2 $vg1 $vg2 2>err
|
||||
vgremove -ff $vg1
|
||||
@ -243,9 +243,9 @@ vgcreate -c n $vg1 $dev1 $dev2 $dev3 $dev4
|
||||
lvcreate -l 16 -n $lv1 -m1 $vg1 $dev1 $dev2 $dev3
|
||||
lvcreate -l 16 -n $lv2 $vg1 $dev4
|
||||
lvchange -an $vg1/$lv2
|
||||
vg_validate_pvlv_counts_ $vg1 4 2 0
|
||||
check pvlv_counts $vg1 4 2 0
|
||||
not vgsplit -n $lv1 $vg1 $vg2;
|
||||
vg_validate_pvlv_counts_ $vg1 4 2 0
|
||||
check pvlv_counts $vg1 4 2 0
|
||||
vgremove -ff $vg1
|
||||
|
||||
COMM "vgsplit succeeds, active mirror not involved in split"
|
||||
@ -253,10 +253,10 @@ vgcreate -c n $vg1 $dev1 $dev2 $dev3 $dev4
|
||||
lvcreate -l 16 -n $lv1 -m1 $vg1 $dev1 $dev2 $dev3
|
||||
lvcreate -l 16 -n $lv2 $vg1 $dev4
|
||||
lvchange -an $vg1/$lv2
|
||||
vg_validate_pvlv_counts_ $vg1 4 2 0
|
||||
check pvlv_counts $vg1 4 2 0
|
||||
vgsplit -n $lv2 $vg1 $vg2
|
||||
vg_validate_pvlv_counts_ $vg1 3 1 0
|
||||
vg_validate_pvlv_counts_ $vg2 1 1 0
|
||||
check pvlv_counts $vg1 3 1 0
|
||||
check pvlv_counts $vg2 1 1 0
|
||||
vgremove -ff $vg1
|
||||
vgremove -ff $vg2
|
||||
|
||||
@ -266,9 +266,9 @@ lvcreate -l 64 -i 2 -n $lv1 $vg1 $dev1 $dev2
|
||||
lvcreate -l 4 -i 2 -s -n $lv2 $vg1/$lv1
|
||||
lvcreate -l 64 -i 2 -n $lv3 $vg1 $dev3 $dev4
|
||||
lvchange -an $vg1/$lv3
|
||||
vg_validate_pvlv_counts_ $vg1 4 3 1
|
||||
check pvlv_counts $vg1 4 3 1
|
||||
not vgsplit -n $lv2 $vg1 $vg2;
|
||||
vg_validate_pvlv_counts_ $vg1 4 3 1
|
||||
check pvlv_counts $vg1 4 3 1
|
||||
lvremove -f $vg1/$lv2
|
||||
vgremove -ff $vg1
|
||||
|
||||
@ -279,10 +279,10 @@ lvcreate -l 4 -s -n $lv2 $vg1/$lv1
|
||||
vgextend $vg1 $dev4
|
||||
lvcreate -l 64 -n $lv3 $vg1 $dev4
|
||||
lvchange -an $vg1/$lv3
|
||||
vg_validate_pvlv_counts_ $vg1 4 3 1
|
||||
check pvlv_counts $vg1 4 3 1
|
||||
vgsplit -n $lv3 $vg1 $vg2
|
||||
vg_validate_pvlv_counts_ $vg1 3 2 1
|
||||
vg_validate_pvlv_counts_ $vg2 1 1 0
|
||||
check pvlv_counts $vg1 3 2 1
|
||||
check pvlv_counts $vg2 1 1 0
|
||||
vgchange -an $vg1
|
||||
lvremove -f $vg1/$lv2
|
||||
vgremove -ff $vg1
|
||||
|
@ -8,12 +8,13 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
prepare_lvmconf '[ "a/dev\/mirror/", "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
|
||||
aux lvmconf 'devices/filter = [ "a/dev\/mirror/", "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
|
||||
cat $TESTDIR/etc/lvm.conf
|
||||
aux prepare_devs 3
|
||||
|
||||
pvcreate $devs
|
||||
pvcreate $(cat DEVICES)
|
||||
vgcreate $vg1 $dev1 $dev2
|
||||
lvcreate -n $lv1 -l 100%FREE $vg1
|
||||
|
||||
|
@ -11,29 +11,29 @@
|
||||
|
||||
# Test vgsplit command options for validity
|
||||
|
||||
. ./test-utils.sh
|
||||
. lib/test
|
||||
|
||||
aux prepare_devs 5
|
||||
|
||||
for mdatype in 1 2
|
||||
do
|
||||
|
||||
pvcreate -M$mdatype $devs
|
||||
pvcreate -M$mdatype $(cat DEVICES)
|
||||
|
||||
# ensure name order does not matter
|
||||
# NOTE: if we're using lvm1, we must use -M on vgsplit
|
||||
vgcreate -M$mdatype $vg1 $devs
|
||||
vgcreate -M$mdatype $vg1 $(cat DEVICES)
|
||||
vgsplit -M$mdatype $vg1 $vg2 $dev1
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
vgcreate -M$mdatype $vg2 $devs
|
||||
vgcreate -M$mdatype $vg2 $(cat DEVICES)
|
||||
vgsplit -M$mdatype $vg2 $vg1 $dev1
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
|
||||
# vgsplit accepts new vg as destination of split
|
||||
# lvm1 -- bz244792
|
||||
vgcreate -M$mdatype $vg1 $devs
|
||||
vgcreate -M$mdatype $vg1 $(cat DEVICES)
|
||||
vgsplit $vg1 $vg2 $dev1 1>err
|
||||
grep "New volume group \"$vg2\" successfully split from \"$vg1\"" err
|
||||
vgremove $vg1
|
||||
@ -50,14 +50,14 @@ vgremove $vg2
|
||||
# vgsplit accepts --maxphysicalvolumes 128 on new VG
|
||||
vgcreate -M$mdatype $vg1 $dev1 $dev2
|
||||
vgsplit --maxphysicalvolumes 128 $vg1 $vg2 $dev1
|
||||
check_vg_field_ $vg2 max_pv 128
|
||||
check vg_field $vg2 max_pv 128
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
|
||||
# vgsplit accepts --maxlogicalvolumes 128 on new VG
|
||||
vgcreate -M$mdatype $vg1 $dev1 $dev2
|
||||
vgsplit --maxlogicalvolumes 128 $vg1 $vg2 $dev1
|
||||
check_vg_field_ $vg2 max_lv 128
|
||||
check vg_field $vg2 max_lv 128
|
||||
vgremove $vg1
|
||||
vgremove $vg2
|
||||
|
||||
@ -129,7 +129,7 @@ vgcreate -M$mdatype $vg1 $dev1 $dev2
|
||||
lvcreate -l 4 -n $lv1 $vg1
|
||||
vgchange -an $vg1
|
||||
vgsplit $vg1 $vg2 $dev1
|
||||
compare_vg_field_ $vg1 $vg2 max_lv
|
||||
check compare_vg_field $vg1 $vg2 max_lv
|
||||
vgremove -f $vg2
|
||||
vgremove -f $vg1
|
||||
|
||||
@ -138,7 +138,7 @@ vgcreate -M$mdatype $vg1 $dev1 $dev2
|
||||
lvcreate -l 4 -n $lv1 $vg1
|
||||
vgchange -an $vg1
|
||||
vgsplit $vg1 $vg2 $dev1
|
||||
compare_vg_field_ $vg1 $vg2 max_pv
|
||||
check compare_vg_field $vg1 $vg2 max_pv
|
||||
vgremove -f $vg2
|
||||
vgremove -f $vg1
|
||||
|
||||
@ -147,7 +147,7 @@ vgcreate -M$mdatype $vg1 $dev1 $dev2
|
||||
lvcreate -l 4 -n $lv1 $vg1
|
||||
vgchange -an $vg1
|
||||
vgsplit $vg1 $vg2 $dev1
|
||||
compare_vg_field_ $vg1 $vg2 vg_fmt
|
||||
check compare_vg_field $vg1 $vg2 vg_fmt
|
||||
vgremove -f $vg2
|
||||
vgremove -f $vg1
|
||||
|
||||
@ -170,9 +170,9 @@ pvcreate --metadatacopies 0 $dev5
|
||||
vgcreate $vg1 $dev5 $dev2
|
||||
lvcreate -l 10 -n $lv1 $vg1
|
||||
lvchange -an $vg1/$lv1
|
||||
vg_validate_pvlv_counts_ $vg1 2 1 0
|
||||
check pvlv_counts $vg1 2 1 0
|
||||
not vgsplit $vg1 $vg2 $dev5;
|
||||
vg_validate_pvlv_counts_ $vg1 2 1 0
|
||||
check pvlv_counts $vg1 2 1 0
|
||||
vgremove -ff $vg1
|
||||
|
||||
# vgsplit rejects split because metadata types differ
|
||||
|
Loading…
x
Reference in New Issue
Block a user