[pve-devel] [PATCH RFC storage] Use is_worker to decide default timeout for ZFS

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Mar 15 14:01:11 CET 2016


Bump timeout to 1 hour if running in a worker and no timeout
specified.
---
Note: requires "is_worker" patch to pve-access-control

 PVE/Storage/ZFSPlugin.pm     | 5 ++++-
 PVE/Storage/ZFSPoolPlugin.pm | 5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm
index d6339ce..6ed3dc9 100644
--- a/PVE/Storage/ZFSPlugin.pm
+++ b/PVE/Storage/ZFSPlugin.pm
@@ -6,12 +6,14 @@ use IO::File;
 use POSIX;
 use PVE::Tools qw(run_command);
 use PVE::Storage::ZFSPoolPlugin;
+use PVE::RPCEnvironment;
 
 use base qw(PVE::Storage::ZFSPoolPlugin);
 use PVE::Storage::LunCmd::Comstar;
 use PVE::Storage::LunCmd::Istgt;
 use PVE::Storage::LunCmd::Iet;
 
+
 my @ssh_opts = ('-o', 'BatchMode=yes');
 my @ssh_cmd = ('/usr/bin/ssh', @ssh_opts);
 my $id_rsa_path = '/etc/pve/priv/zfs';
@@ -49,7 +51,8 @@ my $zfs_get_base = sub {
 sub zfs_request {
     my ($class, $scfg, $timeout, $method, @params) = @_;
 
-    $timeout = 10 if !$timeout;
+    $timeout = PVE::RPCEnvironment::is_worker() ? 60*60 : 10
+	if !$timeout;
 
     my $msg = '';
 
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 7011acc..9f76cee 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -6,7 +6,7 @@ use IO::File;
 use POSIX;
 use PVE::Tools qw(run_command);
 use PVE::Storage::Plugin;
-
+use PVE::RPCEnvironment;
 
 use base qw(PVE::Storage::Plugin);
 
@@ -164,7 +164,8 @@ sub path {
 sub zfs_request {
     my ($class, $scfg, $timeout, $method, @params) = @_;
 
-    $timeout = 5 if !$timeout;
+    $timeout = PVE::RPCEnvironment::is_worker() ? 60*60 : 5
+	if !$timeout;
 
     my $cmd = [];
 
-- 
2.1.4





More information about the pve-devel mailing list