From a10695b4e83487e7cb692687c1cd68d375e8f010 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 17 Apr 2019 14:31:05 +0000 Subject: [PATCH] zpool: cleanup zfs_request command a bit Signed-off-by: Thomas Lamprecht --- PVE/Storage/ZFSPoolPlugin.pm | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm index 9ba3999..7315c0c 100644 --- a/PVE/Storage/ZFSPoolPlugin.pm +++ b/PVE/Storage/ZFSPoolPlugin.pm @@ -167,8 +167,6 @@ sub path { sub zfs_request { my ($class, $scfg, $timeout, $method, @params) = @_; - my $default_timeout = PVE::RPCEnvironment->is_worker() ? 60*60 : 5; - my $cmd = []; if ($method eq 'zpool_list') { @@ -179,17 +177,12 @@ sub zfs_request { } else { push @$cmd, 'zfs', $method; } - push @$cmd, @params; - + my $msg = ''; + my $output = sub { $msg .= "$_[0]\n" }; - my $output = sub { - my $line = shift; - $msg .= "$line\n"; - }; - - $timeout = $default_timeout if !$timeout; + $timeout = PVE::RPCEnvironment->is_worker() ? 60*60 : 5 if !$timeout; run_command($cmd, errmsg => "zfs error", outfunc => $output, timeout => $timeout);