]> git.proxmox.com Git - mirror_zfs.git/commitdiff
ZTS: pool_checkpoint improvements
authorBrian Behlendorf <behlendorf1@llnl.gov>
Sat, 3 Apr 2021 15:33:22 +0000 (08:33 -0700)
committerGitHub <noreply@github.com>
Sat, 3 Apr 2021 15:33:22 +0000 (08:33 -0700)
The pool_checkpoint tests may incorrectly fail because several of
them invoke zdb for an imported pool.  In this scenario it's not
unexpected for zdb to fail if the pool is modified.  To resolve
this these zdb checks are now done after the pool has been exported.

Additionally, the default cleanup functions assumed the pool would
be imported when they were run.  If this was not the case they're
exit early and fail to cleanup all of the test state causing
subsequent tests to fail.  Add a check to only destroy the pool
when it is imported.

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #11832

tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_big_rewind.ksh
tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh
tests/zfs-tests/tests/functional/pool_checkpoint/pool_checkpoint.kshlib

index f915d2ad418c999c32498753f89dbf2682b460a3..7e523ef908735c6233349f1e698d977a30fe4e8d 100755 (executable)
@@ -52,6 +52,7 @@ fragment_after_checkpoint_and_verify
 log_must zpool export $NESTEDPOOL
 log_must zpool import -d $FILEDISKDIR --rewind-to-checkpoint $NESTEDPOOL
 
-log_must zdb $NESTEDPOOL
+log_must zpool export $NESTEDPOOL
+log_must zdb -e -p $FILEDISKDIR $NESTEDPOOL
 
 log_pass "Rewind to checkpoint on a stressed pool."
index 15afc4adf4bc8ab0211e46b631313ee508512c99..b6d34307b3f2c839ba399be7d4f9de0c2db3c48d 100755 (executable)
@@ -80,13 +80,14 @@ log_mustnot dd if=/dev/urandom of=$NESTEDFS0FILE bs=1M count=300
 #
 log_must zpool list $NESTEDPOOL
 
-log_must zdb -kc $NESTEDPOOL
-
 log_must zpool export $NESTEDPOOL
+log_must zdb -e -p $FILEDISKDIR -kc $NESTEDPOOL
+
 log_must zpool import -d $FILEDISKDIR --rewind-to-checkpoint $NESTEDPOOL
 
 log_must [ "$(head -c 100 $NESTEDFS0FILE)" = "$FILE0INTRO" ]
 
-log_must zdb $NESTEDPOOL
+log_must zpool export $NESTEDPOOL
+log_must zdb -e -p $FILEDISKDIR $NESTEDPOOL
 
 log_pass "Do not reuse checkpointed space at low capacity."
index ae099ff270f1b477a1cfeb3c54f9ff3d94e84ec4..f970935f5bd0bcd1afc044a90bc9ace344fee75b 100755 (executable)
@@ -104,7 +104,8 @@ set_tunable64 SPA_DISCARD_MEMORY_LIMIT 16777216
 
 nested_wait_discard_finish
 
-log_must zdb $NESTEDPOOL
+log_must zpool export $NESTEDPOOL
+log_must zdb -e -p $FILEDISKDIR $NESTEDPOOL
 
 log_pass "Can export/import but not rewind/checkpoint/discard or " \
     "change pool's config while discarding."
index ea6c03e9d59d5f0a968f89f85d82c74c041c6880..bb8bab6cdf46d8ef7a954069658db9fecec0c68f 100644 (file)
@@ -154,13 +154,18 @@ function setup_nested_pools
 
 function cleanup_nested_pool
 {
-       log_must zpool destroy $NESTEDPOOL
+       if poolexists $NESTEDPOOL; then
+               log_must zpool destroy $NESTEDPOOL
+       fi
+
        log_must rm -f $FILEDISKS
 }
 
 function cleanup_test_pool
 {
-       log_must zpool destroy $TESTPOOL
+       if poolexists $TESTPOOL; then
+               log_must zpool destroy $TESTPOOL
+       fi
 
        #
        # We always clear the labels of all disks