From 089b16f48da2255b2c47cbab9dfbac3dcfe43ae8 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sat, 18 Aug 2018 21:16:12 -0700 Subject: [PATCH] ZTS: Fix import_cache_device_replaced Allow the 'zpool replace' to run slowly without overwhelming the vdev queues by setting zfs_scan_vdev_limit=128k. This limits the number of concurrent slow IOs which need to be handled. The net effect is the test case runs approximately 3x faster putting it well under the 10 minute per-test time limit. Rename import_cache* test cases to imprt_cachefile*. Originally these were renamed due to a maximum tar name limit, this limit was removed by commit 1dfde3d9b. Replaced instances of /var/tmp in zpool_import.cfg with $TEST_BASE_DIR. Reviewed-by: bunder2015 Reviewed-by: George Melikov Signed-off-by: Brian Behlendorf Closes #7765 Closes #7802 --- tests/runfiles/linux.run | 12 ++++++------ tests/test-runner/bin/zts-report.py | 1 - .../functional/cli_root/zpool_import/Makefile.am | 12 ++++++------ ..._added.ksh => import_cachefile_device_added.ksh} | 0 ...oved.ksh => import_cachefile_device_removed.ksh} | 0 ...ced.ksh => import_cachefile_device_replaced.ksh} | 5 ++++- ...hed.ksh => import_cachefile_mirror_attached.ksh} | 0 ...hed.ksh => import_cachefile_mirror_detached.ksh} | 0 ...evice.ksh => import_cachefile_shared_device.ksh} | 0 .../cli_root/zpool_import/zpool_import.cfg | 13 ++++++++----- 10 files changed, 24 insertions(+), 19 deletions(-) rename tests/zfs-tests/tests/functional/cli_root/zpool_import/{import_cache_device_added.ksh => import_cachefile_device_added.ksh} (100%) rename tests/zfs-tests/tests/functional/cli_root/zpool_import/{import_cache_device_removed.ksh => import_cachefile_device_removed.ksh} (100%) rename tests/zfs-tests/tests/functional/cli_root/zpool_import/{import_cache_device_replaced.ksh => import_cachefile_device_replaced.ksh} (94%) rename tests/zfs-tests/tests/functional/cli_root/zpool_import/{import_cache_mirror_attached.ksh => import_cachefile_mirror_attached.ksh} (100%) rename tests/zfs-tests/tests/functional/cli_root/zpool_import/{import_cache_mirror_detached.ksh => import_cachefile_mirror_detached.ksh} (100%) rename tests/zfs-tests/tests/functional/cli_root/zpool_import/{import_cache_shared_device.ksh => import_cachefile_shared_device.ksh} (100%) diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index 5e0dd0832..10c1200a4 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -363,12 +363,12 @@ tests = ['zpool_import_001_pos', 'zpool_import_002_pos', 'zpool_import_rename_001_pos', 'zpool_import_all_001_pos', 'zpool_import_encrypted', 'zpool_import_encrypted_load', 'zpool_import_errata3', - 'import_cache_device_added', - 'import_cache_device_removed', - 'import_cache_device_replaced', - 'import_cache_mirror_attached', - 'import_cache_mirror_detached', - 'import_cache_shared_device', + 'import_cachefile_device_added', + 'import_cachefile_device_removed', + 'import_cachefile_device_replaced', + 'import_cachefile_mirror_attached', + 'import_cachefile_mirror_detached', + 'import_cachefile_shared_device', 'import_devices_missing', 'import_paths_changed', 'import_rewind_config_changed', diff --git a/tests/test-runner/bin/zts-report.py b/tests/test-runner/bin/zts-report.py index acb20048e..6c0a2262d 100755 --- a/tests/test-runner/bin/zts-report.py +++ b/tests/test-runner/bin/zts-report.py @@ -231,7 +231,6 @@ maybe = { ['FAIL', rewind_reason], 'cli_root/zpool_import/import_rewind_config_changed': ['FAIL', rewind_reason], - 'cli_root/zpool_import/import_cache_device_replaced': ['FAIL', '7765'], 'cli_root/zpool_import/zpool_import_missing_003_pos': ['SKIP', '6839'], 'cli_root/zpool_remove/setup': ['SKIP', disk_reason], 'cli_root/zpool_upgrade/zpool_upgrade_004_pos': ['FAIL', '6141'], diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am index 585f10a0b..6f0f5d0b8 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am @@ -4,12 +4,12 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_impo dist_pkgdata_SCRIPTS = \ setup.ksh \ cleanup.ksh \ - import_cache_device_added.ksh \ - import_cache_device_removed.ksh \ - import_cache_device_replaced.ksh \ - import_cache_mirror_attached.ksh \ - import_cache_mirror_detached.ksh \ - import_cache_shared_device.ksh \ + import_cachefile_device_added.ksh \ + import_cachefile_device_removed.ksh \ + import_cachefile_device_replaced.ksh \ + import_cachefile_mirror_attached.ksh \ + import_cachefile_mirror_detached.ksh \ + import_cachefile_shared_device.ksh \ import_devices_missing.ksh \ import_paths_changed.ksh \ import_rewind_config_changed.ksh \ diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_device_added.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_device_added.ksh similarity index 100% rename from tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_device_added.ksh rename to tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_device_added.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_device_removed.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_device_removed.ksh similarity index 100% rename from tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_device_removed.ksh rename to tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_device_removed.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_device_replaced.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_device_replaced.ksh similarity index 94% rename from tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_device_replaced.ksh rename to tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_device_replaced.ksh index 3ad22433d..f42c85b98 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_device_replaced.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_device_replaced.ksh @@ -60,6 +60,7 @@ function custom_cleanup log_must set_zfs_txg_timeout $ZFS_TXG_TIMEOUT zinject -c all + log_must set_tunable64 zfs_scan_vdev_limit $ZFS_SCAN_VDEV_LIMIT_DEFAULT cleanup } @@ -87,9 +88,10 @@ function test_replacing_vdevs log_must zpool export $TESTPOOL1 log_must cp $CPATHBKP $CPATH log_must zpool import -c $CPATH -o cachefile=$CPATH $TESTPOOL1 + log_must set_tunable64 zfs_scan_vdev_limit $ZFS_SCAN_VDEV_LIMIT_SLOW typeset device for device in $zinjectdevices ; do - log_must zinject -d $device -D 200:1 $TESTPOOL1 > /dev/null + log_must zinject -d $device -D 50:1 $TESTPOOL1 > /dev/null done log_must zpool replace $TESTPOOL1 $replacevdev $replaceby @@ -102,6 +104,7 @@ function test_replacing_vdevs # Confirm pool is still replacing log_must pool_is_replacing $TESTPOOL1 log_must zinject -c all > /dev/null + log_must set_tunable64 zfs_scan_vdev_limit $ZFS_SCAN_VDEV_LIMIT_DEFAULT log_must zpool export $TESTPOOL1 ( $earlyremove ) && log_must rm $replacevdev diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_mirror_attached.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_mirror_attached.ksh similarity index 100% rename from tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_mirror_attached.ksh rename to tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_mirror_attached.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_mirror_detached.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_mirror_detached.ksh similarity index 100% rename from tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_mirror_detached.ksh rename to tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_mirror_detached.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_shared_device.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_shared_device.ksh similarity index 100% rename from tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cache_shared_device.ksh rename to tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_shared_device.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.cfg index 20f43cefa..ecdf0ee53 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.cfg +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.cfg @@ -117,11 +117,11 @@ export DEVICE_FILE=disk export DEVICE_ARCHIVE=archive_import-test export MYTESTFILE=$STF_SUITE/include/libtest.shlib -export CPATH=/var/tmp/cachefile.$$ -export CPATHBKP=/var/tmp/cachefile.$$.bkp -export CPATHBKP2=/var/tmp/cachefile.$$.bkp2 -export MD5FILE=/var/tmp/md5sums.$$ -export MD5FILE2=/var/tmp/md5sums.$$.2 +export CPATH=$TEST_BASE_DIR/cachefile.$$ +export CPATHBKP=$TEST_BASE_DIR/cachefile.$$.bkp +export CPATHBKP2=$TEST_BASE_DIR/cachefile.$$.bkp2 +export MD5FILE=$TEST_BASE_DIR/md5sums.$$ +export MD5FILE2=$TEST_BASE_DIR/md5sums.$$.2 typeset -i num=0 while (( num < $GROUP_NUM )); do @@ -137,3 +137,6 @@ export VDEV3=$DEVICE_DIR/${DEVICE_FILE}3 export VDEV4=$DEVICE_DIR/${DEVICE_FILE}4 export ALTER_ROOT=/alter_import-test + +export ZFS_SCAN_VDEV_LIMIT_SLOW=$((128*1024)) +export ZFS_SCAN_VDEV_LIMIT_DEFAULT=$((4*1024*1024))