Merge pull request #80 from TheGrandWazoo/master

Merge request to v2.0 branch.
This commit is contained in:
Kevin Scott Adams 2020-10-13 07:31:17 -04:00 committed by GitHub
commit 837399e62f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -83,7 +83,7 @@ my $freenas_api_version_matrix = {
"type" => "DISK",
"name" => "\$name",
"disk" => "\$device",
},
},
},
"targetextent" => {
"resource" => "/api/v2.0/iscsi/targetextent/",
@ -399,9 +399,9 @@ sub freenas_api_check {
$result->{'fullversion'} =~ s/^"//g;
}
syslog("info", (caller(0))[3] . " : successful : Server version: " . $result->{'fullversion'});
$result->{'fullversion'} =~ s/^(\w+)\-(\d+)\.(\d+)\-(?:U|BETA)(\d?)\.?(\d?)//;
my $freenas_version = sprintf("%02d%02d%02d%02d", $2, $3 || 0, $4 || 0, $5 || 0);
$result->{'fullversion'} =~ s/^((?!\-\d).*)\-(\d+)\.(\d+)\-([A-Za-z]*)(?(?=\-)\-(\d*)\-(\d*)|(\d?)\.?(\d?))//;
$product_name = $1;
my $freenas_version = sprintf("%02d%02d%02d%02d", $2, $3 || 0, $7 || 0, $8 || 0);
syslog("info", (caller(0))[3] . " : ". $product_name . " Unformatted Version: " . $freenas_version);
if ($freenas_version >= 11030100) {
$freenas_api_version = "v2.0";
@ -439,7 +439,7 @@ sub freenas_api_call {
$freenas_rest_connection = $freenas_server_list->{$apihost};
$freenas_global_config = $freenas_global_config_list->{$apihost};
my $json_data = (defined $data) ? encode_json($data) : undef;
$freenas_rest_connection->$method($path, $json_data);
$freenas_rest_connection->request($method, $path, $json_data);
syslog("info", (caller(0))[3] . " : successful");
return;
}
@ -510,7 +510,7 @@ sub freenas_iscsi_create_extent {
my $name = $lun_path;
$name =~ s/^.*\///; # all from last /
$name = $scfg->{'pool'} . '/' . $name;
$name = $scfg->{'pool'} . ($product_name eq "TrueNAS-SCALE" ? '-' : '/') . $name;
my $device = $lun_path;
$device =~ s/^\/dev\///; # strip /dev/