[Stgt-devel] [PATCH 3/7] add option to show all targets

Richard Sharpe realrichardsharpe
Thu Jul 24 00:46:12 CEST 2008


On Tue, Jul 22, 2008 at 4:18 AM, Doron Shoham <dorons at voltaire.com> wrote:
> Add -s flag.
> Show all the targets and exit.
>
> Signed-off-by: Doron Shoham <dorons at voltaire.com>

Acked-by: Richard Sharpe <realrichardsharpe at gmail.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
>
>
> _______________________________________________
> Stgt-devel mailing list
> Stgt-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/stgt-devel
>



More information about the stgt mailing list