master - tests: always zero disk header
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3fbb7b6e35b12c...
Commit: 3fbb7b6e35b12c36838139eb365b526129b63baf
Parent: 1bb5b498f01db75822a861046ca934f50447eb05
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 28 11:32:52 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 28 11:32:52 2015 +0200
tests: always zero disk header
It appear that older wipefs doesn't wipe partition table.
So ensure there is no partition on LVM_TEST_BACKING_DEVICE.
---
test/lib/aux.sh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 1af43d0..0e59d6e 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -497,6 +497,8 @@ prepare_devs() {
# non-ephemeral devices need to be cleared between tests
test -f LOOP || for d in ${DEVICES[@]}; do
blkdiscard "$d" 2>/dev/null || true
+ # ensure disk header is always zeroed
+ dd if=/dev/zero of="$d" bs=4096 count=1
wipefs -a "$d" 2>/dev/null || dd if=/dev/zero of="$d" bs=64K count=1
done
7 years, 11 months
master - tests: more descriptive aux
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1bb5b498f01db7...
Commit: 1bb5b498f01db75822a861046ca934f50447eb05
Parent: a378e5a6dd3e8a2d8ccb69bb9f0acdd1e279b1dc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 27 17:45:10 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 28 11:23:16 2015 +0200
tests: more descriptive aux
Tell what's reason of aux fail here.
---
test/lib/aux.sh | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 95c2f73..1af43d0 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -951,14 +951,19 @@ target_at_least() {
local version=$(dmsetup targets 2>/dev/null | grep "${1##dm-} " 2>/dev/null)
version=${version##* v}
- shift
- version_at_least "$version" "$@"
+ version_at_least "$version" "${@:2}" || {
+ echo "Found $1 version $version, but requested ${*:2}." >&2
+ return 1
+ }
}
have_thin() {
- test "$THIN" = shared -o "$THIN" = internal || return 1
- target_at_least dm-thin-pool "$@" || return 1
+ test "$THIN" = shared -o "$THIN" = internal || {
+ echo "Thin is not built-in." >&2
+ return 1;
+ }
+ target_at_least dm-thin-pool "$@"
declare -a CONF
# disable thin_check if not present in system
@@ -978,12 +983,18 @@ have_thin() {
}
have_raid() {
- test "$RAID" = shared -o "$RAID" = internal || return 1
+ test "$RAID" = shared -o "$RAID" = internal || {
+ echo "Raid is not built-in." >&2
+ return 1;
+ }
target_at_least dm-raid "$@"
}
have_cache() {
- test "$CACHE" = shared -o "$CACHE" = internal || return 1
+ test "$CACHE" = shared -o "$CACHE" = internal || {
+ echo "Cache is not built-in." >&2
+ return 1;
+ }
target_at_least dm-cache "$@"
declare -a CONF
7 years, 11 months
master - tests: drop debug test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a378e5a6dd3e8a...
Commit: a378e5a6dd3e8a2d8ccb69bb9f0acdd1e279b1dc
Parent: 0c1bda9b53d1935a6eadea579061c323366c8e61
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 27 17:44:29 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 28 11:23:16 2015 +0200
tests: drop debug test
Remove 'debug leftover' from test.
---
test/shell/pvcreate-operation-md.sh | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/test/shell/pvcreate-operation-md.sh b/test/shell/pvcreate-operation-md.sh
index 2bfb937..810fc53 100644
--- a/test/shell/pvcreate-operation-md.sh
+++ b/test/shell/pvcreate-operation-md.sh
@@ -75,7 +75,6 @@ EOF
test "$DM_DEV_DIR" != "/dev" && cp -LR "${mddev}p1" "$DM_DEV_DIR"
pvcreate --metadatasize 128k "${pvdev}p1"
- check sysfs "${pvdev}p1" alignment_offset 0
maj=$(($(stat -L --printf=0x%t "${mddev}p1")))
min=$(($(stat -L --printf=0x%T "${mddev}p1")))
7 years, 11 months
master - example.conf.in: regenerate
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0c1bda9b53d193...
Commit: 0c1bda9b53d1935a6eadea579061c323366c8e61
Parent: cfb0174fed25cb6a27a5ff3554b5c442d2defcc9
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Apr 27 14:15:24 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Apr 27 14:15:24 2015 -0500
example.conf.in: regenerate
>From recent config_settings.h changes.
---
conf/example.conf.in | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index eedefb5..5354779 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -144,7 +144,7 @@ devices {
# global_filter=[]
# Configuration option devices/cache.
- # This has been replaced by the devices/cache_dir setting.
+ # The path can be set using the devices/cache_dir setting.
cache="/etc/lvm/cache/.cache"
# Configuration option devices/cache_dir.
@@ -540,7 +540,7 @@ backup {
# Configuration option backup/archive_dir.
# Location of the metdata archive files.
# Remember to back up this directory regularly!
- archive_dir="/etc/lvm/archive"
+ archive_dir="@DEFAULT_SYS_DIR@/@DEFAULT_ARCHIVE_SUBDIR@"
# Configuration option backup/retain_min.
# Minimum number of archives to keep.
@@ -863,7 +863,7 @@ global {
# ignorable errors and fix them later.
# With thin_check version 3.2 or newer you should add
# --clear-needs-check-flag.
- thin_check_options="-q --clear-needs-check-flag"
+ thin_check_options=["-q", "--clear-needs-check-flag"]
# Configuration option global/thin_repair_options.
# String of options passed to the thin_repair command.
@@ -879,7 +879,8 @@ global {
# error_if_no_space.
# Example:
# thin_disabled_features = [ "discards", "block_size" ]
- thin_disabled_features=[]
+ # This configuration option does not have a default value defined.
+# thin_disabled_features=[]
# Configuration option global/cache_check_executable.
# The full path to the cache_check command.
7 years, 11 months
master - config: fix a couple mistakes with defaults
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cfb0174fed25cb...
Commit: cfb0174fed25cb6a27a5ff3554b5c442d2defcc9
Parent: a7d28639eb4a2cd5adbf5b14b07702ba4d84593c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Apr 27 13:17:15 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Apr 27 13:54:45 2015 -0500
config: fix a couple mistakes with defaults
for archive, archive_dir, and cache
---
lib/config/config_settings.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 742fa19..dcbc332 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -222,7 +222,7 @@ cfg_array(devices_global_filter_CFG, "global_filter", devices_CFG_SECTION, CFG_D
"Devices rejected by global_filter are not opened by LVM.\n")
cfg_runtime(devices_cache_CFG, "cache", devices_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(1, 0, 0), NULL,
- "This has been replaced by the devices/cache_dir setting.\n")
+ "The path can be set using the devices/cache_dir setting.\n")
cfg_runtime(devices_cache_dir_CFG, "cache_dir", devices_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(1, 2, 19), "@DEFAULT_SYS_DIR@/@DEFAULT_CACHE_SUBDIR@",
"Directory in which to store the device cache file.\n"
@@ -537,11 +537,11 @@ cfg_runtime(backup_backup_dir_CFG, "backup_dir", backup_CFG_SECTION, 0, CFG_TYPE
"Location of the metadata backup files.\n"
"Remember to back up this directory regularly!\n")
-cfg(backup_archive_CFG, "archive", backup_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ARCHIVE_ENABLED, vsn(1, 0, 0), "@DEFAULT_SYS_DIR@/@DEFAULT_ARCHIVE_SUBDIR@",
+cfg(backup_archive_CFG, "archive", backup_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ARCHIVE_ENABLED, vsn(1, 0, 0), NULL,
"Maintain an archive of old metadata configurations.\n"
"Think very hard before turning this off.\n")
-cfg_runtime(backup_archive_dir_CFG, "archive_dir", backup_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(1, 0, 0), NULL,
+cfg_runtime(backup_archive_dir_CFG, "archive_dir", backup_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(1, 0, 0), "@DEFAULT_SYS_DIR@/@DEFAULT_ARCHIVE_SUBDIR@",
"Location of the metdata archive files.\n"
"Remember to back up this directory regularly!\n")
7 years, 11 months
master - tests: use new help in aux
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a7d28639eb4a2c...
Commit: a7d28639eb4a2cd5adbf5b14b07702ba4d84593c
Parent: 1e3c135d7178426d3cd1c92a3ab9a71303b64aa2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 25 00:38:06 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Apr 25 00:40:02 2015 +0200
tests: use new help in aux
Simplify tests and use aux mdadm helpers.
---
test/shell/lvmetad-pvscan-md.sh | 65 +++---------------
test/shell/pvcreate-operation-md.sh | 133 +++++++++++------------------------
2 files changed, 50 insertions(+), 148 deletions(-)
diff --git a/test/shell/lvmetad-pvscan-md.sh b/test/shell/lvmetad-pvscan-md.sh
index ff86fdd..bfa6171 100644
--- a/test/shell/lvmetad-pvscan-md.sh
+++ b/test/shell/lvmetad-pvscan-md.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014-2015 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
@@ -12,72 +12,25 @@
. lib/inittest
test -e LOCAL_LVMETAD || skip
-which mdadm || skip
test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \
modprobe raid0 || skip
-aux lvmconf 'devices/md_component_detection = 1'
-aux extend_filter_LVMTEST
-aux extend_filter "a|/dev/md.*|"
-
aux prepare_devs 2
-# TODO factor out the following MD-creation code into lib/
-
-# Have MD use a non-standard name to avoid colliding with an existing MD device
-# - mdadm >= 3.0 requires that non-standard device names be in /dev/md/
-# - newer mdadm _completely_ defers to udev to create the associated device node
-mdadm_maj=$(mdadm --version 2>&1 | perl -pi -e 's|.* v(\d+).*|\1|')
-[ $mdadm_maj -ge 3 ] && \
- mddev=/dev/md/md_lvm_test0 || \
- mddev=/dev/md_lvm_test0
-
-cleanup_md() {
- # sleeps offer hack to defeat: 'md: md127 still in use'
- # see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25
- aux udev_wait
- mdadm --stop "$mddev" || true
- # also remove singnatures
- mdadm --zero-superblock "$dev1" "$dev2" || true
- aux udev_wait
- if [ -b "$mddev" ]; then
- # mdadm doesn't always cleanup the device node
- sleep 2
- rm -f "$mddev"
- fi
-}
-
-cleanup_md_and_teardown() {
- cleanup_md
- aux teardown
-}
-
# create 2 disk MD raid0 array (stripe_width=128K)
-test -b "$mddev" && skip
-trap 'cleanup_md_and_teardown' EXIT # cleanup this MD device at the end of the test
-mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 64 "$dev1" "$dev2"
-test -b "$mddev" || skip
-if test "$DM_DEV_DIR" != "/dev" ; then
- cp -LR "$mddev" "$DM_DEV_DIR" # so that LVM/DM can see the device
- pvdev="$DM_DEV_DIR/md_lvm_test0"
-else
- pvdev=$(readlink -f "$mddev")
-fi
-# TODO end MD-creation code
+aux prepare_md_dev 0 64 2 "$dev1" "$dev2"
-# maj=$(($(stat -L --printf=0x%t "$dev2")))
-# min=$(($(stat -L --printf=0x%T "$dev2")))
+aux lvmconf 'devices/md_component_detection = 1'
+aux extend_filter_LVMTEST
+aux extend_filter "a|/dev/md.*|"
-pvcreate "$pvdev"
+pvdev=$(< MD_DEV_PV)
-pvscan --cache "$pvdev"
+pvcreate "$pvdev"
# ensure that lvmetad can only see the toplevel MD device
-pvscan --cache "$dev1" 2>&1 | grep "not found"
-pvscan --cache "$dev2" 2>&1 | grep "not found"
-
pvs | tee out
grep "$pvdev" out
-pvs | not grep "$dev1"
-pvs | not grep "$dev2"
+not grep "$dev1" out
+not grep "$dev2" out
diff --git a/test/shell/pvcreate-operation-md.sh b/test/shell/pvcreate-operation-md.sh
index ec15c5d..2bfb937 100644
--- a/test/shell/pvcreate-operation-md.sh
+++ b/test/shell/pvcreate-operation-md.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2009 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2009-2015 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
@@ -12,11 +12,7 @@
. lib/inittest
# skip this test if mdadm or sfdisk (or others) aren't available
-which mdadm || skip
which sfdisk || skip
-which perl || skip
-which awk || skip
-which cut || skip
test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \
modprobe raid0 || skip
@@ -27,66 +23,33 @@ aux extend_filter "a|/dev/md.*|"
aux prepare_devs 2
-# Have MD use a non-standard name to avoid colliding with an existing MD device
-# - mdadm >= 3.0 requires that non-standard device names be in /dev/md/
-# - newer mdadm _completely_ defers to udev to create the associated device node
-mdadm_maj=$(mdadm --version 2>&1 | perl -pi -e 's|.* v(\d+).*|\1|')
-[ $mdadm_maj -ge 3 ] && \
- mddev=/dev/md/md_lvm_test0 || \
- mddev=/dev/md_lvm_test0
-
-cleanup_md() {
- # sleeps offer hack to defeat: 'md: md127 still in use'
- # see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25
- aux udev_wait
- mdadm --stop "$mddev" || true
- mdadm --zero-superblock "$dev1" "$dev2" || true
- aux udev_wait
- if [ -b "$mddev" ]; then
- # mdadm doesn't always cleanup the device node
- sleep 2
- rm -f "$mddev"
- fi
-}
-
-cleanup_md_and_teardown() {
- cleanup_md
- aux teardown
-}
-
# create 2 disk MD raid0 array (stripe_width=128K)
-test -b "$mddev" && skip
-trap 'cleanup_md_and_teardown' EXIT # cleanup this MD device at the end of the test
-mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 64 "$dev1" "$dev2"
-test -b "$mddev" || skip
-test "$DM_DEV_DIR" != "/dev" && cp -LR "$mddev" "$DM_DEV_DIR" # so that LVM/DM can see the device
-lvmdev="$DM_DEV_DIR/md_lvm_test0"
+aux prepare_md_dev 0 64 2 "$dev1" "$dev2"
+
+mddev=$(< MD_DEV)
+pvdev=$(< MD_DEV_PV)
# Test alignment of PV on MD without any MD-aware or topology-aware detection
# - should treat $mddev just like any other block device
-pv_align="1.00m"
pvcreate --metadatasize 128k \
--config 'devices {md_chunk_alignment=0 data_alignment_detection=0 data_alignment_offset_detection=0}' \
- "$lvmdev"
+ "$pvdev"
-check pv_field "$lvmdev" pe_start $pv_align
+check pv_field "$pvdev" pe_start "1.00m"
# 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}' \
- "$lvmdev"
-check pv_field "$lvmdev" pe_start $pv_align
-
+ "$pvdev"
+check pv_field "$pvdev" pe_start "1.00m"
# Test newer topology-aware alignment detection
# - first added to 2.6.31 but not "reliable" until 2.6.33
if kernel_at_least 2 6 33 ; then
- pv_align="1.00m"
# optimal_io_size=131072, minimum_io_size=65536
pvcreate --metadatasize 128k \
- --config 'devices { md_chunk_alignment=0 }' "$lvmdev"
- check pv_field "$lvmdev" pe_start $pv_align
+ --config 'devices { md_chunk_alignment=0 }' "$pvdev"
+ check pv_field "$pvdev" pe_start "1.00m"
fi
# partition MD array directly, depends on blkext in Linux >= 2.6.28
@@ -98,67 +61,53 @@ EOF
pvscan
# make sure partition on MD is _not_ removed
# - tests partition -> parent lookup via sysfs paths
- not pvcreate --metadatasize 128k "$lvmdev"
+ not pvcreate --metadatasize 128k "$pvdev"
# verify alignment_offset is accounted for in pe_start
# - topology infrastructure is available in Linux >= 2.6.31
# - also tests partition -> parent lookup via sysfs paths
- # Oh joy: need to lookup /sys/block/md127 rather than /sys/block/md_lvm_test0
- mddev_maj_min=$(ls -lL "$mddev" | awk '{ print $5 $6 }' | perl -pi -e 's|,|:|')
- mddev_p_sysfs_name=$(echo /sys/dev/block/${mddev_maj_min}/*p1)
- base_mddev_p=`basename $mddev_p_sysfs_name`
- mddev_p=/dev/${base_mddev_p}
-
- # in case the system is running without devtmpfs /dev
- # wait here for created device node on tmpfs
- aux udev_wait "$mddev_p"
- test -b "$mddev_p" || skip
- test "$DM_DEV_DIR" != "/dev" && cp -LR "$mddev_p" "$DM_DEV_DIR"
- lvmdev_p="$DM_DEV_DIR/$base_mddev_p"
-
# Checking for 'alignment_offset' in sysfs implies Linux >= 2.6.31
# but reliable alignment_offset support requires kernel.org Linux >= 2.6.33
- sysfs_alignment_offset=/sys/dev/block/${mddev_maj_min}/${base_mddev_p}/alignment_offset
- [ -f $sysfs_alignment_offset ] && kernel_at_least 2 6 33 && \
- alignment_offset=`cat $sysfs_alignment_offset` || \
- alignment_offset=0
-
- if [ $alignment_offset -gt 0 ]; then
- # default alignment is 1M, add alignment_offset
- pv_align=$((1048576+$alignment_offset))B
- pvcreate --metadatasize 128k "$lvmdev_p"
- check pv_field "$lvmdev_p" pe_start $pv_align --units b
- pvremove "$lvmdev_p"
+ if kernel_at_least 2 6 33 ; then
+ # in case the system is running without devtmpfs /dev
+ # wait here for created device node on tmpfs
+ test "$DM_DEV_DIR" != "/dev" && cp -LR "${mddev}p1" "$DM_DEV_DIR"
+
+ pvcreate --metadatasize 128k "${pvdev}p1"
+ check sysfs "${pvdev}p1" alignment_offset 0
+
+ maj=$(($(stat -L --printf=0x%t "${mddev}p1")))
+ min=$(($(stat -L --printf=0x%T "${mddev}p1")))
+
+ sysfs_alignment_offset="/sys/dev/block/$maj:$min/alignment_offset"
+ [ -f "$sysfs_alignment_offset" ] && \
+ alignment_offset=$(< "$sysfs_alignment_offset") || \
+ alignment_offset=0
+
+ # default alignment is 1M, add alignment_offset
+ pv_align=$((1048576+$alignment_offset))
+ check pv_field "${pvdev}p1" pe_start $pv_align --units b --nosuffix
+
+ pvremove "${pvdev}p1"
+ test "$DM_DEV_DIR" != "/dev" && rm -f "$DM_DEV_DIR/${mddev}p1"
fi
fi
-
# Test newer topology-aware alignment detection w/ --dataalignment override
if kernel_at_least 2 6 33 ; then
# make sure we're clean for another test
- test -b "$mddev" && cleanup_md
- dd if=/dev/zero of="$dev1" bs=512 count=1
- dd if=/dev/zero of="$dev2" bs=512 count=1
-
- pvcreate -f "$dev1"
- pvcreate -f "$dev2"
-
- # create 2 disk MD raid0 array (stripe_width=2M)
- test -b "$mddev" && skip
- mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 1024 "$dev1" "$dev2"
- test -b "$mddev" || skip
+ dd if=/dev/zero of="$mddev" bs=512 count=1
+ aux prepare_md_dev 0 1024 2 "$dev1" "$dev2"
+ pvdev=$(< MD_DEV_PV)
# optimal_io_size=2097152, minimum_io_size=1048576
- pv_align="2.00m"
pvcreate --metadatasize 128k \
- --config 'devices { md_chunk_alignment=0 }' "$lvmdev"
- pvscan # Something is seriously broken.
- check pv_field "$lvmdev" pe_start $pv_align
+ --config 'devices { md_chunk_alignment=0 }' "$pvdev"
+ check pv_field "$pvdev" pe_start "2.00m"
# now verify pe_start alignment override using --dataalignment
- pv_align="192.00k"
pvcreate --dataalignment 64k --metadatasize 128k \
- --config 'devices { md_chunk_alignment=0 }' "$lvmdev"
- check pv_field "$lvmdev" pe_start $pv_align
+ --config 'devices { md_chunk_alignment=0 }' "$pvdev"
+ check pv_field "$pvdev" pe_start "192.00k"
fi
7 years, 11 months
master - tests: aux for mdadm
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1e3c135d717842...
Commit: 1e3c135d7178426d3cd1c92a3ab9a71303b64aa2
Parent: f50229041bfc9570aeae0eef614f1e68f157802e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 25 00:37:27 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Apr 25 00:40:02 2015 +0200
tests: aux for mdadm
Implement aux helper fce for mdadm.
---
test/lib/aux.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 66 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index cc3718c..95c2f73 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2011-2015 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
@@ -256,6 +256,8 @@ kill_listed_processes() {
}
teardown() {
+ test -f MD_DEV && cleanup_md_dev
+
echo -n "## teardown..."
if test -f TESTNAME ; then
@@ -387,6 +389,69 @@ cleanup_scsi_debug_dev() {
rm -f SCSI_DEBUG_DEV LOOP
}
+prepare_md_dev() {
+ local level=$1
+ local rchunk=$2
+ local rdevs=$3
+
+ local maj=$(mdadm --version 2>&1) || skip "mdadm tool is missing!"
+ local mddev
+
+ cleanup_md_dev
+
+ rm -f debug.log strace.log MD_DEV MD_DEV_PV MD_DEVICES
+
+ # Have MD use a non-standard name to avoid colliding with an existing MD device
+ # - mdadm >= 3.0 requires that non-standard device names be in /dev/md/
+ # - newer mdadm _completely_ defers to udev to create the associated device node
+ maj=${maj##*- v}
+ maj=${maj%%.*}
+ [ "$maj" -ge 3 ] && \
+ mddev=/dev/md/md_lvm_test0 || \
+ mddev=/dev/md_lvm_test0
+
+ mdadm --create --metadata=1.0 "$mddev" --auto=md --level $level --chunk $rchunk --raid-devices=$rdevs "${@:4}"
+ test -b "$mddev" || skip "mdadm has not create device!"
+
+ # LVM/DM will see this device
+ case "$DM_DEV_DIR" in
+ "/dev") readlink -f "$mddev" ;;
+ *) cp -LR "$mddev" "$DM_DEV_DIR"
+ echo "$DM_DEV_DIR/md_lvm_test0" ;;
+ esac > MD_DEV_PV
+ echo "$mddev" > MD_DEV
+ notify_lvmetad $(< MD_DEV_PV)
+ printf "%s\n" "${@:4}" > MD_DEVICES
+ for mddev in "${@:4}"; do
+ notify_lvmetad "$mddev"
+ done
+}
+
+cleanup_md_dev() {
+ test -f MD_DEV || return 0
+
+ local IFS=$IFS_NL
+ local dev=$(< MD_DEV)
+
+ udev_wait
+ mdadm --stop "$dev" || true
+ test "$DM_DEV_DIR" != "/dev" && rm -f "$DM_DEV_DIR/$(basename $dev)"
+ notify_lvmetad $(< MD_DEV_PV)
+ for dev in $(< MD_DEVICES); do
+ mdadm --zero-superblock "$dev" || true
+ notify_lvmetad "$dev"
+ done
+ udev_wait
+ if [ -b "$mddev" ]; then
+ # mdadm doesn't always cleanup the device node
+ # sleeps offer hack to defeat: 'md: md127 still in use'
+ # see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25
+ sleep 2
+ rm -f "$mddev"
+ fi
+ rm -f MD_DEV MD_DEVICES MD_DEV_PV
+}
+
prepare_backing_dev() {
if test -f BACKING_DEV; then
BACKING_DEV=$(< BACKING_DEV)
7 years, 11 months
master - tests: allow add printable skip message
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f50229041bfc95...
Commit: f50229041bfc9570aeae0eef614f1e68f157802e
Parent: a939857a63e7e119e6a4ce0f749cf981a196aabc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 24 20:32:21 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Apr 25 00:40:02 2015 +0200
tests: allow add printable skip message
---
test/lib/utils.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index a610632..80e5922 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -209,6 +209,7 @@ dm_table() {
}
skip() {
+ test "$#" -eq 0 || echo "TEST SKIPPED: $@"
touch SKIP_THIS_TEST
exit 200
}
7 years, 11 months
master - tests: check sysfs more generically
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a939857a63e7e1...
Commit: a939857a63e7e119e6a4ce0f749cf981a196aabc
Parent: d9176782feab130c3e94030f64bf67ca25f41e11
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 24 20:31:22 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Apr 25 00:40:02 2015 +0200
tests: check sysfs more generically
Allow to access more files in device sysfs subtree.
---
test/lib/check.sh | 4 ++--
test/shell/profiles-thin.sh | 4 ++--
test/shell/topology-support.sh | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/test/lib/check.sh b/test/lib/check.sh
index 219d43f..5244290 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -365,11 +365,11 @@ dev_md5sum() {
die "LV $1/$2 has different MD5 check sum!")
}
-sysfs_queue() {
+sysfs() {
# read maj min and also convert hex to decimal
local maj=$(($(stat -L --printf=0x%t "$1")))
local min=$(($(stat -L --printf=0x%T "$1")))
- local P="/sys/dev/block/$maj:$min/queue/$2"
+ local P="/sys/dev/block/$maj:$min/$2"
local val=$(< "$P") || return 0 # no sysfs ?
test "$val" -eq "$3" || \
die "$1: $P = $val differs from expected value $3!"
diff --git a/test/shell/profiles-thin.sh b/test/shell/profiles-thin.sh
index 8800e7b..d3e282a 100644
--- a/test/shell/profiles-thin.sh
+++ b/test/shell/profiles-thin.sh
@@ -25,12 +25,12 @@ aux prepare_profiles "thin-performance"
# Create scsi debug dev with sector size of 4096B and 1MiB optimal_io_size
aux prepare_scsi_debug_dev $DEV_SIZE sector_size=4096 opt_blks=256 || skip
EXPECT=1048576
-check sysfs_queue "$(< SCSI_DEBUG_DEV)" optimal_io_size "$EXPECT"
+check sysfs "$(< SCSI_DEBUG_DEV)" queue/optimal_io_size "$EXPECT"
aux prepare_pvs 1 $DEV_SIZE
# Check we are not running on buggy kernel (broken lcm())
# If so, turn chunk_size test into 'should'
-check sysfs_queue "$dev1" optimal_io_size "$EXPECT" || SHOULD=should
+check sysfs "$dev1" queue/optimal_io_size "$EXPECT" || SHOULD=should
vgcreate $vg "$dev1"
diff --git a/test/shell/topology-support.sh b/test/shell/topology-support.sh
index 9bded0e..c186814 100644
--- a/test/shell/topology-support.sh
+++ b/test/shell/topology-support.sh
@@ -56,7 +56,7 @@ aux cleanup_scsi_debug_dev
LOGICAL_BLOCK_SIZE=512
aux prepare_scsi_debug_dev $DEV_SIZE \
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3
-check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
+check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
get_devs
@@ -72,7 +72,7 @@ aux cleanup_scsi_debug_dev
LOGICAL_BLOCK_SIZE=512
aux prepare_scsi_debug_dev $DEV_SIZE \
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3 lowest_aligned=7
-check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
+check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate $vg "${DEVICES[@]}"
@@ -87,7 +87,7 @@ aux cleanup_scsi_debug_dev
LOGICAL_BLOCK_SIZE=4096
aux prepare_scsi_debug_dev $DEV_SIZE \
sector_size=$LOGICAL_BLOCK_SIZE
-check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
+check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate $vg "${DEVICES[@]}"
@@ -107,14 +107,14 @@ LOGICAL_BLOCK_SIZE=512
aux prepare_scsi_debug_dev $DEV_SIZE \
sector_size=$LOGICAL_BLOCK_SIZE opt_blks=1536
-check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
-check sysfs_queue "$(< SCSI_DEBUG_DEV)" optimal_io_size 786432
+check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
+check sysfs "$(< SCSI_DEBUG_DEV)" queue/optimal_io_size 786432
aux prepare_pvs 1 $PER_DEV_SIZE
# Kernel (3.19) could provide wrong results - in this case skip
# test with incorrect result - lvm2 can't figure out good values.
-check sysfs_queue "$dev1" optimal_io_size 786432 || SHOULD=should
+check sysfs "$dev1" queue/optimal_io_size 786432 || SHOULD=should
$SHOULD check pv_field "${DEVICES[@]}" pe_start 768.00k
aux cleanup_scsi_debug_dev
7 years, 11 months
master - tests: add double quotes around add_to_kill_list parms
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d9176782feab13...
Commit: d9176782feab130c3e94030f64bf67ca25f41e11
Parent: d7888e83169ac1a7a962ffd66502995792879244
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Fri Apr 24 11:42:26 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Apr 25 00:40:02 2015 +0200
tests: add double quotes around add_to_kill_list parms
---
test/shell/pvmove-abort-all.sh | 6 +++---
test/shell/pvmove-abort.sh | 4 ++--
test/shell/pvmove-basic.sh | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/test/shell/pvmove-abort-all.sh b/test/shell/pvmove-abort-all.sh
index 0398c75..de6d8c9 100644
--- a/test/shell/pvmove-abort-all.sh
+++ b/test/shell/pvmove-abort-all.sh
@@ -51,11 +51,11 @@ if test -z "$backgroundarg" ; then
lvs -a $vg $vg1
else
"${cmd1[@]}"
- aux add_to_kill_list ${cmd1[*]} -P 1
+ aux add_to_kill_list "${cmd1[*]}" -P 1
"${cmd2[@]}"
- aux add_to_kill_list ${cmd2[*]} -P 1
+ aux add_to_kill_list "${cmd2[*]}" -P 1
"${cmd3[@]}"
- aux add_to_kill_list ${cmd3[*]} -P 1
+ aux add_to_kill_list "${cmd3[*]}" -P 1
fi
# test removal of all pvmove LVs
diff --git a/test/shell/pvmove-abort.sh b/test/shell/pvmove-abort.sh
index 72f6f96..3165c6f 100644
--- a/test/shell/pvmove-abort.sh
+++ b/test/shell/pvmove-abort.sh
@@ -41,9 +41,9 @@ if test -z "$backgroundarg" ; then
aux wait_pvmove_lv_ready "$vg-pvmove1"
else
"${cmd1[@]}"
- aux add_to_kill_list ${cmd1[*]} -P 1
+ aux add_to_kill_list "${cmd1[*]}" -P 1
"${cmd2[@]}"
- aux add_to_kill_list ${cmd2[*]} -P 1
+ aux add_to_kill_list "${cmd2[*]}" -P 1
fi
# remove specific device
diff --git a/test/shell/pvmove-basic.sh b/test/shell/pvmove-basic.sh
index e93a04e..d5b7845 100644
--- a/test/shell/pvmove-basic.sh
+++ b/test/shell/pvmove-basic.sh
@@ -334,9 +334,9 @@ check_and_cleanup_lvs_
#COMM "pvmove abort"
restore_lvs_
-cmd=$(echo -n pvmove $mode -i100 -b "$dev1" "$dev3")
-$cmd
-aux add_to_kill_list "$cmd" "-P 1"
+cmd=(pvmove $mode -i100 -b "$dev1" "$dev3")
+"${cmd[@]}"
+aux add_to_kill_list "${cmd[*]}" -P 1
pvmove --abort
check_and_cleanup_lvs_
7 years, 11 months