[pve-devel] [PATCH storage] fix #3803: ZFSPoolPlugin: zfs_request: increase minimum timeout in worker

Dominik Csapak d.csapak at proxmox.com
Thu Dec 23 13:06:22 CET 2021


Since most zfs operations can take a while (under certain conditions),
increase the minimum timeout for zfs_request in workers to 5 minutes.

We cannot increase the timeouts in synchronous api calls, since they are
hard limited to 30 seconds, but in worker we do not have such limits.

The existing default timeout does not change (60minutes in worker,
5seconds otherwise), but all zfs_requests with a set timeout (<5minutes)
will use the increased 5 minutes in a worker.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/Storage/ZFSPoolPlugin.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 5f6befd..148e154 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -178,7 +178,12 @@ sub zfs_request {
     my $msg = '';
     my $output = sub { $msg .= "$_[0]\n" };
 
-    $timeout = PVE::RPCEnvironment->is_worker() ? 60*60 : 5 if !$timeout;
+    if (PVE::RPCEnvironment->is_worker()) {
+	$timeout = 60*60 if !$timeout;
+	$timeout = 60*5 if $timeout < 60*5;
+    } else {
+	$timeout = 5 if !$timeout;
+    }
 
     run_command($cmd, errmsg => "zfs error", outfunc => $output, timeout => $timeout);
 
-- 
2.30.2






More information about the pve-devel mailing list