All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 5eec1276 authored by Mike Hibler's avatar Mike Hibler

More API changes (or else I didn't test this very well last time!)

Pass authinit index, not tag, to targetgroup.
Set serial number via extent, not target.
parent 1263882a
...@@ -140,6 +140,7 @@ sub getVlan($); ...@@ -140,6 +140,7 @@ sub getVlan($);
sub getNextAuthITag(); sub getNextAuthITag();
sub genSerial(); sub genSerial();
sub findAuthITag($;$); sub findAuthITag($;$);
sub findAuthIId($);
sub createVlanInterface($$); sub createVlanInterface($$);
sub removeVlanInterface($$); sub removeVlanInterface($$);
sub setupIPAlias($;$); sub setupIPAlias($;$);
...@@ -789,6 +790,7 @@ sub exportSlice($$$$) { ...@@ -789,6 +790,7 @@ sub exportSlice($$$$) {
my $res = freenasRequest($FREENAS_API_RESOURCE_IST_EXTENT, my $res = freenasRequest($FREENAS_API_RESOURCE_IST_EXTENT,
"POST", undef, "POST", undef,
{"iscsi_target_extent_name" => $iqn, {"iscsi_target_extent_name" => $iqn,
"iscsi_target_extent_serial" => genSerial(),
"iscsi_target_extent_type" => "Disk", "iscsi_target_extent_type" => "Disk",
"iscsi_target_extent_disk" => "zvol/$pool/$volume"}); "iscsi_target_extent_disk" => "zvol/$pool/$volume"});
if (!$res) { if (!$res) {
...@@ -851,10 +853,13 @@ sub exportSlice($$$$) { ...@@ -851,10 +853,13 @@ sub exportSlice($$$$) {
} }
my $tindex = $res->{'id'}; my $tindex = $res->{'id'};
# XXX we need the authinit index, not tag
my $aindex = findAuthIId($tag);
$res = freenasRequest($FREENAS_API_RESOURCE_IST_TGTGROUP, $res = freenasRequest($FREENAS_API_RESOURCE_IST_TGTGROUP,
"POST", undef, "POST", undef,
{"iscsi_target" => $tindex, {"iscsi_target" => $tindex,
"iscsi_target_initiatorgroup" => $tag, "iscsi_target_initiatorgroup" => $aindex,
"iscsi_target_portalgroup" => $ISCSI_GLOBAL_PORTAL, "iscsi_target_portalgroup" => $ISCSI_GLOBAL_PORTAL,
"iscsi_target_authgroup" => undef, "iscsi_target_authgroup" => undef,
"iscsi_target_authtype" => "None"}); "iscsi_target_authtype" => "None"});
...@@ -975,6 +980,26 @@ sub findAuthITag($;$) { ...@@ -975,6 +980,26 @@ sub findAuthITag($;$) {
return undef; return undef;
} }
# Helper function.
# Locate and return ID for given auth tag, if it exists
sub findAuthIId($) {
my ($tag) = @_;
return undef
if !defined($tag);
my $aiinfo = freenasAuthInitList();
foreach my $ai (keys %{$aiinfo}) {
my $aient = $aiinfo->{$ai};
if (exists($aient->{'tag'}) && $aient->{'tag'} eq $tag) {
return $aient->{'id'};
}
}
return undef;
}
# Helper function. # Helper function.
# Locate and return next unused tag ID for iSCSI initiator groups. # Locate and return next unused tag ID for iSCSI initiator groups.
sub getNextAuthITag() { sub getNextAuthITag() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment