[stgt] [PATCH 1/2] tgt-admin: Add support for config of discovery auth
Andy Grover
agrover at redhat.com
Thu Mar 15 01:07:51 CET 2012
Add parsing of"incomingdiscoveryuser" and "outgoingdiscoveryuser"
directives at toplevel of targets.conf. This will create the user account
and bind w/o specifying a tid, which is how discovery auth is passed to
tgtadm.
Signed-off-by: Andy Grover <agrover at redhat.com>
---
scripts/tgt-admin | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index 030f1ae..cd34f95 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -210,7 +210,21 @@ sub add_targets {
check_if_hash_array($conf{$k}, $k);
execute("tgtadm -C $control_port --op update --mode sys --name $k -v $conf{$k}");
}
+ } elsif (($k eq "incomingdiscoveryuser") || ($k eq "outgoingdiscoveryuser")) {
+ my @userpass = split(/ /, $conf{$k});
+ check_value($userpass[1]);
+ # Only delete or create account if it doesn't already exist
+ if (! exists $existing_accounts{$userpass[0]} ) {
+ execute("tgtadm -C $control_port --mode account --op new --user=$userpass[0] --password=$userpass[1]");
+ $existing_accounts{$userpass[0]} = 1;
+ }
+ my $extra_str = "";
+ if ($k eq "outgoingdiscoveryuser") {
+ $extra_str = " --outgoing";
+ }
+ execute("tgtadm -C $control_port --mode account --op bind --user=$userpass[0] $extra_str");
}
+
}
foreach my $k (sort keys %conf) {
if ($k eq "iSNS") {
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list