now zfs will wait 5 sec if error msg is dataset is busy
Signed-off-by: Wolfgang Link w.l...@proxmox.com
---
PVE/Storage/ZFSPoolPlugin.pm | 27 ++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 5cbd1b2..9609dd1 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -291,7 +291,32 @@ sub zfs_create_zvol {
sub zfs_delete_zvol {
my ($class, $scfg, $zvol) = @_;
-$class-zfs_request($scfg, undef, 'destroy', '-r', $scfg-{pool}/$zvol);
+open(STDERR, /tmp/zfslog.txt);
+eval { $class-zfs_request($scfg, undef, 'destroy', '-r',
$scfg-{pool}/$zvol)};
+close STDERR;
+if ($@) {
+ my $error = $@;
+ open(my $fh, ,/tmp/zfslog.txt);
+
+ $/ = undef;
+ my $msg = $fh;
+ close $fh;
+
+ unlink /tmp/zfslog.txt;
+
+ if ($msg =~ m/dataset is busy/) {
+
+ for(my $i = 0; $error $i 5; $i++){
+ sleep(1);
+ eval { $class-zfs_request($scfg, undef, 'destroy', '-r',
$scfg-{pool}/$zvol)};
+ $error = $@;
+ }
+ die print $msg.$error if $error;
+ } else {
+ die $msg.$error;
+ }
+}
+unlink /tmp/zfslog.txt;
}
sub zfs_list_zvol {
--
1.7.10.4
___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel