zfs: cleanup zfs_request
This commit is contained in:
@ -49,13 +49,10 @@ my $zfs_get_base = sub {
|
|||||||
sub zfs_request {
|
sub zfs_request {
|
||||||
my ($class, $scfg, $timeout, $method, @params) = @_;
|
my ($class, $scfg, $timeout, $method, @params) = @_;
|
||||||
|
|
||||||
my $cmdmap;
|
|
||||||
my $zfscmd;
|
|
||||||
my $target;
|
|
||||||
my $msg;
|
|
||||||
|
|
||||||
$timeout = 5 if !$timeout;
|
$timeout = 5 if !$timeout;
|
||||||
|
|
||||||
|
my $msg = '';
|
||||||
|
|
||||||
if ($lun_cmds->{$method}) {
|
if ($lun_cmds->{$method}) {
|
||||||
if ($scfg->{iscsiprovider} eq 'comstar') {
|
if ($scfg->{iscsiprovider} eq 'comstar') {
|
||||||
$msg = PVE::Storage::LunCmd::Comstar::run_lun_command($scfg, $timeout, $method, @params);
|
$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});
|
$zfs_unknown_scsi_provider->($scfg->{iscsiprovider});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
my $target = 'root@' . $scfg->{portal};
|
||||||
|
|
||||||
|
my $cmd = [@ssh_cmd, '-i', "$id_rsa_path/$scfg->{portal}_id_rsa", $target];
|
||||||
|
|
||||||
if ($method eq 'zpool_list') {
|
if ($method eq 'zpool_list') {
|
||||||
$zfscmd = 'zpool';
|
push @$cmd, 'zpool', 'list';
|
||||||
$method = 'list',
|
} else {
|
||||||
} else {
|
push @$cmd, 'zfs', $method;
|
||||||
$zfscmd = 'zfs';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = 'root@' . $scfg->{portal};
|
push @$cmd, @params;
|
||||||
|
|
||||||
my $cmd = [@ssh_cmd, '-i', "$id_rsa_path/$scfg->{portal}_id_rsa", $target, $zfscmd, $method, @params];
|
my $output = sub {
|
||||||
|
my $line = shift;
|
||||||
$msg = '';
|
$msg .= "$line\n";
|
||||||
|
|
||||||
my $output = sub {
|
|
||||||
my $line = shift;
|
|
||||||
$msg .= "$line\n";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
run_command($cmd, outfunc => $output, timeout => $timeout);
|
run_command($cmd, outfunc => $output, timeout => $timeout);
|
||||||
|
|||||||
Reference in New Issue
Block a user