📄 target.sample.srp
字号:
#!/bin/sh# # A template for setting up a connection to the target using SRP ## Copy this file under /opt/unh/iscsi/conf/<TARGET-NAME> [the same <TARGET-NAME># should be used in /opt/unh/iscsi/conf/fstab.iscsi also, for consistency] and# make the necessary changes detailed in the guidelines (below) and# /usr/share/doc/unh-iscsi*/README.CONFIG.# # GUIDELINES# ----------# The following environment variables are autoset by iscsi_connect# and SHOULD NOT be re-defined by the user.## HOST - iSCSI Initiator Host HBA number # TARGET_NO - Target (session) Number ## Script should return success(0) or failure(1) back to iscsi_connect.# PATH also includes /opt/unh/iscsi/bin.## To run a target script on startup, set the execute permission# /bin/chmod +x /opt/unh/iscsi/conf/<TARGETALIAS># # To not run a target script on startup, unset the execute permission# /bin/chmod -x /opt/unh/iscsi/conf/<TARGETALIAS>## DOCUMENTATION# -------------# For more information on iscsi_manage and iscsi_config, please refer to# iscsi_config(8) and iscsi_manage(8).## CUSTOMIZATION# ------------# Additional parameters can be set to connect to the target. For a complete# list of additional parameters refer to iscsi_manage(8).# # The iscsi_config can also be used to set up multiple connections to# targets or to make connections to specific LUNs (the default is to# connect to all LUNs on the target). The complete features of the# iscsi_config command can be found at# /usr/share/doc/unh_iscsi*/ISCSI_CONFIG.## CONFIGURATION# -------------# The following variables need to be defined by the user.## <INITIATOR NAME> - A fully qualified iSCSI Initiator name as expected# by the Target.INITIATOR_NAME=# <TARGET NAME> - A fully qualified iSCSI Target name.TARGET_NAME=# <TARGET IP> - Target portal's network IP address.TARGET_IP=# <PORT> - Port number of the iSCSI Target at <TARGET IP># Default is 3260.PORT=3260##<LUN> - Probe ALL (0) LUNS or set to a specific number <1..14>LUN=1## NOTE# ----# The set of iscsi_manage and iscsi_config statments section below# are considered bare minimum to connect to the target and should not be # removed (they can be modified, however).#echo "$0: Host: $HOST"echo "$0: TARGET_NO: $TARGET_NO" echo "$0: Target: $TARGET_NAME"echo "$0: INAME: $INITIATOR_NAME"echo "$0: IP: $TARGET_IP"echo "$0: LUNS: $LUN"iscsi_manage init restore host=$HOST target=$TARGET_NOiscsi_manage init set InitiatorName=$INITIATOR_NAME host=$HOST target=$TARGET_NOiscsi_manage init set TargetName=$TARGET_NAME host=$HOST target=$TARGET_NO## Srp Entries# Select the sx and sn options to be shared with the target.#iscsi_manage init set AuthMethod=SRP,None host=$HOST target=$TARGET_NO# SRP secret STRING of sx="key"iscsi_manage init force sx="SRP_SECRET_KEY" host=$HOST target=$TARGET_NO# SRP secret NAME of sn="name"iscsi_manage init force sn=SRP_SECRET_NAME host=$HOST target=$TARGET_NO# Debugiscsi_manage init force V=0 host=$HOST target=$TARGET_NO## connection 1#if [ $LUN = "ALL" ] ; then iscsi_config up ip=$TARGET_IP host=$HOST target=$TARGET_NO port=$PORT lun=0else iscsi_config up ip=$TARGET_IP host=$HOST target=$TARGET_NO port=$PORT lun=$LUNfiiscsi_manage init force V=0 host=$HOST target=$TARGET_NO## If your Target supports multiple connections, remove the exit below# exit 0 iscsi_manage init restore host=$HOST target=$TARGET_NOiscsi_manage init set InitiatorName=$INITIATOR_NAME host=$HOST target=$TARGET_NOiscsi_manage init set TargetName=$TARGET_NAME host=$HOST target=$TARGET_NOif [ $LUN = "ALL" ] ; then echo "$0: Sorry ! Multiple Connections require specific LUN numbering "else (( CID = $LUN + 1)) iscsi_config up ip=$TARGET_IP host=$HOST target=$TARGET_NO port=$PORT lun=$LUN cid=$CIDfiexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -