add --driver option to use different lld then iscsi. if driver is not provided the default is iscsi. Signed-off-by: Doron Shoham <dorons at voltaire.com> --- scripts/tgt-admin | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/tgt-admin b/scripts/tgt-admin index 634066a..ab78c95 100755 --- a/scripts/tgt-admin +++ b/scripts/tgt-admin @@ -31,6 +31,7 @@ This tool configures tgt targets. (see "--ready help" for more info) --update <value> update configuration for all or selected targets (see "--update help" for more info) + --driver use specific lld (default is iscsi) -s, --show show all the targets -c, --conf <conf file> specify an alternative configuration file --ignore-errors continue even if tgtadm exits with non-zero code @@ -60,6 +61,7 @@ my $pretend = 0; my $dump = 0; my $verbose = 0; my $help = 0; +my $driver = "iscsi"; my $result = GetOptions ( "e|execute" => \$execute, "delete=s" => \$delete, @@ -67,6 +69,7 @@ my $result = GetOptions ( "ready=s" => \$ready, "update=s" => \$update, "s|show" => \$show, + "driver=s" => \$driver, "c|conf=s" => \$alternate_conf, "ignore-errors" => \$ignore_errors, "f|force" => \$force, @@ -82,7 +85,7 @@ if (($help == 1) || ($param eq undef)) { # Show all the targets and exit if ($show == 1) { - execute("tgtadm --op show --mode target"); + execute("tgtadm --lld $driver --op show --mode target"); exit; } @@ -755,15 +758,15 @@ EOF # Run over all targets and offline/ready them my @all_targets = keys %tgtadm_output_tid; foreach my $existing_target (@all_targets) { - execute("tgtadm --op update --mode target --tid=$tgtadm_output_tid{$existing_target} -n state -v $var"); + execute("tgtadm --lld $driver --op update --mode target --tid=$tgtadm_output_tid{$existing_target} -n state -v $var"); } } elsif ($off_ready =~ m/tid=(.+)/) { process_targets; - execute("tgtadm --op update --mode target --tid=$1 -n state -v $var"); + execute("tgtadm --lld $driver --op update --mode target --tid=$1 -n state -v $var"); } else { process_targets; if (length $tgtadm_output_tid{$off_ready}) { - execute("tgtadm --op update --mode target --tid=$tgtadm_output_tid{$off_ready} --name=\"$off_ready\" -n state -v $var"); + execute("tgtadm --lld $driver --op update --mode target --tid=$tgtadm_output_tid{$off_ready} --name=\"$off_ready\" -n state -v $var"); } else { print "There is no target with name \"$off_ready\", can't $var it!\n"; exit 1; @@ -859,16 +862,16 @@ sub main_delete { # Remove ACLs first my @acl_info = show_target_info($current_target, "acl_information"); foreach my $acl (@acl_info) { - execute("tgtadm --op unbind --mode target --tid $tgtadm_output_tid{$current_target} -I $acl"); + execute("tgtadm --lld $driver--op unbind --mode target --tid $tgtadm_output_tid{$current_target} -I $acl"); } # Now, remove all sessions / connections from that tid my %sessions = show_target_info($current_target, "sessions"); foreach my $sid (keys %sessions) { foreach my $cid ($sessions{$sid}) { - execute("tgtadm --op delete --mode conn --tid $tgtadm_output_tid{$current_target} --sid $sid --cid $cid"); + execute("tgtadm --lld $driver --op delete --mode conn --tid $tgtadm_output_tid{$current_target} --sid $sid --cid $cid"); } } - execute("tgtadm --mode target --op delete --tid=$tgtadm_output_tid{$current_target}"); + execute("tgtadm --lld $driver --mode target --op delete --tid=$tgtadm_output_tid{$current_target}"); } else { if ($update ne 0) { $del_upd_text = "updated"; @@ -880,7 +883,7 @@ sub main_delete { } } elsif (length $tgtadm_output_tid{$current_target}) { execute("# Removing target: $current_target"); - execute("tgtadm --mode target --op delete --tid=$tgtadm_output_tid{$current_target}"); + execute("tgtadm --lld $driver --mode target --op delete --tid=$tgtadm_output_tid{$current_target}"); } else { if (length $current_tid) { execute("# Target with tid $current_tid does not exist!"); -- 1.5.3.8 -- 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 |