[pve-devel] [PATCH_V6] Bug Fix #602: now zfs will wait 5 sec if error msg is dataset is busy

2015-03-06 Thread Wolfgang Link

Signed-off-by: Wolfgang Link w.l...@proxmox.com
---
 PVE/Storage/ZFSPoolPlugin.pm |   17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 5cbd1b2..30efe58 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -166,7 +166,7 @@ sub zfs_request {
 $msg .= $line\n;
 };
 
-run_command($cmd, outfunc = $output, timeout = $timeout);
+run_command($cmd, errmsg = ZFS ERROR, outfunc = $output, timeout = 
$timeout);
 
 return $msg;
 }
@@ -291,7 +291,20 @@ sub zfs_create_zvol {
 sub zfs_delete_zvol {
 my ($class, $scfg, $zvol) = @_;
 
-$class-zfs_request($scfg, undef, 'destroy', '-r', $scfg-{pool}/$zvol);
+for (my $i = 0; $i  5; $i++) {
+
+   eval { $class-zfs_request($scfg, undef, 'destroy', '-r', 
$scfg-{pool}/$zvol); };
+   if (my $err = $@) {
+   if ($err =~ m/^ZFS ERROR:(.*): dataset is busy.*/) {
+   sleep(1);
+   die $err if $i == 4; 
+   } else {
+   die $err;
+   }
+   } else {
+   last;
+   }
+}
 }
 
 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


[pve-devel] [PATCH_V6] Bug Fix #602: now zfs will wait 5 sec if error msg is dataset is busy

2015-03-06 Thread Wolfgang Link

Signed-off-by: Wolfgang Link w.l...@proxmox.com
---
 PVE/Storage/ZFSPoolPlugin.pm |   20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 5cbd1b2..d187e23 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -166,7 +166,7 @@ sub zfs_request {
 $msg .= $line\n;
 };
 
-run_command($cmd, outfunc = $output, timeout = $timeout);
+run_command($cmd, errmsg = zfs error, outfunc = $output, timeout = 
$timeout);
 
 return $msg;
 }
@@ -291,7 +291,23 @@ sub zfs_create_zvol {
 sub zfs_delete_zvol {
 my ($class, $scfg, $zvol) = @_;
 
-$class-zfs_request($scfg, undef, 'destroy', '-r', $scfg-{pool}/$zvol);
+my $err;
+
+for (my $i = 0; $i  6; $i++) {
+
+   eval { $class-zfs_request($scfg, undef, 'destroy', '-r', 
$scfg-{pool}/$zvol); };
+   if ($err = $@) {
+   if ($err =~ m/^zfs error:(.*): dataset is busy.*/) {
+   sleep(1);
+   } else {
+   die $err;
+   }
+   } else {
+   last;
+   }
+}
+
+die $err if $err;
 }
 
 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


Re: [pve-devel] [PATCH_V6] Bug Fix #602: now zfs will wait 5 sec if error msg is dataset is busy

2015-03-06 Thread Dietmar Maurer

Applied, thanks!

___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel