]> git.proxmox.com Git - pve-storage.git/commitdiff
zfstest: improve reset behaviour
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 17 May 2017 09:42:31 +0000 (11:42 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 6 Jun 2017 14:15:42 +0000 (16:15 +0200)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
test/run_test_zfspoolplugin.pl

index 5c1120f4859aef9da2bf2efdbc7e9dad1fee8352..4a01bf73d3b1c4079a4b69c281bd88ffa6b7d44c 100755 (executable)
@@ -2613,11 +2613,20 @@ sub setup_zfs {
 sub cleanup_zfs {
 
     print "destroy $pool\/$subvol\n" if $verbose;
-    run_command("zfs destroy $zpath -r");
+    eval { run_command("zfs destroy $zpath -r"); };
+    if ($@) {
+       print "cleanup failed: $@\nretrying once\n" if $verbose;
+       eval { run_command("zfs destroy $zpath -r"); };
+       if ($@) {
+           clean_up_zpool();
+           setup_zpool();
+       }
+    }
 }
 
 sub setup_zpool {
 
+    unlink 'zpool.img';
     eval {
        run_command("dd if=/dev/zero of=zpool.img bs=1M count=8000 ");
     };