[Stgt-devel] [PATCH 5/7] Add direct-store option to the configuration file

Richard Sharpe realrichardsharpe
Thu Jul 24 00:47:51 CEST 2008


On Tue, Jul 22, 2008 at 4:20 AM, Doron Shoham <dorons at voltaire.com> wrote:
> Add direct-store option to the configuration file
> It is used in order to export the real device properties.
> When several targets export the same device to the initiator we
> will be able to use dm-multipath on the initiator.
>
> Signed-off-by: Doron Shoham <dorons at voltaire.com>

Acked-by: Richard Sharpe <realrichardsharpe at gmail.com>

> ---
>  scripts/tgt-admin |   32 ++++++++++++++++++++++++++++++++
>  1 files changed, 32 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/tgt-admin b/scripts/tgt-admin
> index 8eea44f..846437a 100755
> --- a/scripts/tgt-admin
> +++ b/scripts/tgt-admin
> @@ -146,6 +146,38 @@ sub process_options {
>                }
>        }
>
> +       if ( $option eq "direct-store" ) {
> +               my $inq;
> +               my $vendor_id="";
> +               my $prod_id="";
> +               my $prod_rev="";
> +               my $scsi_serial="";
> +               # if we have one command, force it to be an array anyway
> +               unless (ref($value) eq 'ARRAY') {
> +                       $value = [ $value ];
> +               }
> +               my @value_arr = @$value;
> +               my $i = 1;
> +               foreach my $direct_store (@value_arr) {
> +                       $inq=`sg_inq $direct_store`;
> +                       if ($inq=~/Vendor identification:\s*(\w+)\s*\n*Product identification:\s*([\w\s\/\-]+)\n\s*\n*Product revision level:\s*(\w*)\s*\n*Unit serial number:\s*(\w+)/)
> +                       {
> +                               $vendor_id="$1";
> +                               $prod_id="$2";
> +                               $prod_rev="$3";
> +                               $scsi_serial="$4";
> +                       }
> +                       $vendor_id =~ s/\s+$//;
> +                       $prod_id =~ s/\s+$//;
> +                       $prod_rev =~ s/\s+$//;
> +                       $scsi_serial =~ s/\s+$//;
> +
> +                       execute("tgtadm --lld iscsi --op new --mode logicalunit --tid $next_tid --lun 1 -b $direct_store");
> +                       execute("tgtadm --lld iscsi --op update --mode logicalunit --tid  $next_tid --lun 1 --params vendor_id=\"$vendor_id\",product_id=\"$prod_id\",product_rev=\"$prod_rev\",scsi_sn=\"$scsi_serial\"");
> +                       $i += 1;
> +               }
> +       }
> +
>        if ( $option eq "incominguser" ) {
>                if (ref($value) eq "ARRAY") {
>                        my @value_arr = @$value;
> --
> 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