]> git.proxmox.com Git - pve-storage.git/commitdiff
zfs: cleanup zfs_request
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 22 Jan 2015 08:37:52 +0000 (09:37 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 22 Jan 2015 08:37:52 +0000 (09:37 +0100)
PVE/Storage/ZFSPlugin.pm

index afa54153295a813ba5c5710300a58fb828f355f6..69c6ecc0c669c3ad69f7ae5cb77dd011ee98ed26 100644 (file)
@@ -49,13 +49,10 @@ my $zfs_get_base = sub {
 sub zfs_request {
     my ($class, $scfg, $timeout, $method, @params) = @_;
 
-    my $cmdmap;
-    my $zfscmd;
-    my $target;
-    my $msg;
-
     $timeout = 5 if !$timeout;
 
+    my $msg = '';
+
     if ($lun_cmds->{$method}) {
         if ($scfg->{iscsiprovider} eq 'comstar') {
             $msg = PVE::Storage::LunCmd::Comstar::run_lun_command($scfg, $timeout, $method, @params);
@@ -67,22 +64,22 @@ sub zfs_request {
             $zfs_unknown_scsi_provider->($scfg->{iscsiprovider});
         }
     } else {
-        if ($method eq 'zpool_list') {
-            $zfscmd = 'zpool';
-            $method = 'list',
-        } else {
-            $zfscmd = 'zfs';
-        }
 
-        $target = 'root@' . $scfg->{portal};
+       my $target = 'root@' . $scfg->{portal};
+
+       my $cmd = [@ssh_cmd, '-i', "$id_rsa_path/$scfg->{portal}_id_rsa", $target];
 
-        my $cmd = [@ssh_cmd, '-i', "$id_rsa_path/$scfg->{portal}_id_rsa", $target, $zfscmd, $method, @params];
+        if ($method eq 'zpool_list') {
+           push @$cmd, 'zpool', 'list';
+       } else {
+           push @$cmd, 'zfs', $method;
+        }
 
-        $msg = '';
+       push @$cmd, @params;
 
-        my $output = sub {
-        my $line = shift;
-        $msg .= "$line\n";
+       my $output = sub {
+           my $line = shift;
+           $msg .= "$line\n";
         };
 
         run_command($cmd, outfunc => $output, timeout => $timeout);