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