5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-02-26 21:57:31 +03:00

fix #3803: ZFSPoolPlugin: zfs_request: increase minimum timeout in worker

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@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-12-23 13:06:22 +01:00 committed by Thomas Lamprecht
parent 428872eb71
commit 4cd9b85d15

View File

@ -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);