[pve-devel] [PATCH storage 04/11] zfstest: improve reset behaviour

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed May 17 11:42:31 CEST 2017


Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 test/run_test_zfspoolplugin.pl | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/test/run_test_zfspoolplugin.pl b/test/run_test_zfspoolplugin.pl
index 5c1120f..4a01bf7 100755
--- a/test/run_test_zfspoolplugin.pl
+++ b/test/run_test_zfspoolplugin.pl
@@ -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 ");
     };
-- 
2.1.4





More information about the pve-devel mailing list