[Stgt-devel] [PATCH 3/7] add option to show all targets
Doron Shoham
dorons
Tue Jul 22 13:18:20 CEST 2008
Add -s flag.
Show all the targets and exit.
Signed-off-by: Doron Shoham <dorons at voltaire.com>
---
scripts/tgt-admin | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index 278e93d..9bbe710 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -28,6 +28,7 @@ This tool configures tgt targets.
-e, --execute read $configfile and execute tgtadm commands
-d, --delete delete all the targets
+ -s, --show show all the targets
-f, --force don't exit on tgtadm errors
-p, --pretend only print tgtadm options
-v, --verbose increase verbosity (no effect in "pretend" mode)
@@ -42,6 +43,7 @@ my $param = $ARGV[0];
my $execute = 0;
my $delete = 0;
+my $show = 0;
my $force = 0;
my $pretend = 0;
my $verbose = 0;
@@ -49,6 +51,7 @@ my $help = 0;
my $result = GetOptions (
"e|execute" => \$execute,
"d|delete" => \$delete,
+ "s|show" => \$show,
"f|force" => \$force,
"p|pretend" => \$pretend,
"v|verbose" => \$verbose,
@@ -59,6 +62,11 @@ if (($help == 1) || ($param eq undef)) {
&usage
}
+# Show all the targets and exit
+if ($show == 1) {
+ execute("tgtadm --lld iscsi --op show --mode target");
+ exit;
+}
# Some variables/arrays/hashes we will use globally
my %tgtadm_output;
--
1.5.3.8
More information about the stgt
mailing list