ZTS: Fix upgrade_readonly_pool

Update cleanup_upgrade to use destroy_dataset and destroy_pool
when performing cleanup.  These wrappers retry if the pool is busy
preventing occasional failures like those observed when running
tests upgrade_readonly_pool.  For example:

    SUCCESS: test enabled == enabled
    User accounting upgrade is not executed on readonly pool
    NOTE: Performing local cleanup via log_onexit (cleanup_upgrade)
    cannot destroy 'testpool': pool is busy
    ERROR: zpool destroy testpool exited 1

Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9400
This commit is contained in:
Brian Behlendorf 2019-10-03 09:39:13 -07:00 committed by Tony Hutter
parent 5f67022bf7
commit 05e2a4cfc9

View File

@ -34,8 +34,8 @@ export TMPDEV=$TEST_BASE_DIR/zpool_upgrade_test.dat
function cleanup_upgrade
{
datasetexists $TESTPOOL/fs1 && log_must zfs destroy $TESTPOOL/fs1
datasetexists $TESTPOOL/fs2 && log_must zfs destroy $TESTPOOL/fs2
datasetexists $TESTPOOL/fs3 && log_must zfs destroy $TESTPOOL/fs3
datasetexists $TESTPOOL && log_must zpool destroy $TESTPOOL
destroy_dataset "$TESTPOOL/fs1"
destroy_dataset "$TESTPOOL/fs2"
destroy_dataset "$TESTPOOL/fs3"
destroy_pool "$TESTPOOL"
}