[stgt] Target naming: a minor bug in tgt-setup-lun

Yaron Sheffer yaronf at porticor.com
Sun Jul 17 08:03:43 CEST 2011


Hi Tomonori,

this works fine. Thanks a lot!

     Yaron

*Yaron Sheffer* | Co-Founder and CTO, *Porticor Cloud Security* | 
T:+972-52-8698984 | yaronf at porticor.com <mailto:yaronf at porticor.com> | 
www.porticor.com <http://www.porticor.com/>

On 07/16/2011 01:36 PM, FUJITA Tomonori wrote:
> On Wed, 13 Jul 2011 16:24:29 +0300
> Yaron Sheffer<yaronf at porticor.com>  wrote:
>
>> Hi,
>>
>>
>> When creating the target name, the application prepends the string
>> iqn.2001-04.com.<hostname>- before the user-supplied name. However the
>> ".com" is redundant. Moreover, some users might prefer to supply their
>> own names, e.g. if the hostname is not stable (as may be the case in the
>> cloud). So I suggest to change the code so that if the user provides a
>> full name (one that starts with "iqn"), it is used as is.
> Can you try the following patch?
>
> diff --git a/scripts/tgt-setup-lun b/scripts/tgt-setup-lun
> index 9fef7f9..14a5f0a 100755
> --- a/scripts/tgt-setup-lun
> +++ b/scripts/tgt-setup-lun
> @@ -188,7 +188,9 @@ fi
>
>   echo "Using transport: $lld_name"
>
> -tgt_name="iqn.2001-04.com.$(hostname -s)-$tgt_name"
> +if ! [[ $tgt_name =~ ^iqn ]]; then
> +    tgt_name="iqn.2001-04.com.$(hostname -s)-$tgt_name"
> +fi
>
>   # Make sure that a target with the same name doesn't exist
>   check_if_tgt_exists
--
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