@@ -9,7 +9,7 @@ FSXN_ADMIN_IP=[Fsx admin ip, e.g. 172.25.45.32]
99# Volume name
1010VOLUME_NAME=[Fsx volume name, e.g. iscsiVol]
1111# Volume size in GB
12- VOLUME_SIZE=[volume size in GB, e.g 100g ]
12+ VOLUME_SIZE=[volume size in GB, e.g 100 ]
1313# Default value is fsx, but you can change it to any other value according to yours FSx for ONTAP SVM name
1414SVM_NAME=fsx
1515# Default value is fsxadmin, but you can change it to any other value according to yours FSx for ONTAP admin user name
@@ -146,15 +146,15 @@ else
146146 ./uninstall.sh
147147fi
148148
149- commandDescription=" Create volume for vserver: ${SVM_NAME} volume name: ${VOLUME_NAME} and size: ${VOLUME_SIZE} "
149+ commandDescription=" Create volume for vserver: ${SVM_NAME} volume name: ${VOLUME_NAME} and size: ${VOLUME_SIZE} g "
150150logMessage " ${commandDescription} "
151- sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " volume create -vserver $SVM_NAME -volume $VOLUME_NAME -aggregate aggr1 -size $VOLUME_SIZE -state online"
151+ sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " volume create -vserver ${ SVM_NAME} -volume ${ VOLUME_NAME} -aggregate aggr1 -size ${ VOLUME_SIZE} g -state online"
152152checkCommand " ${commandDescription} "
153153addUndoCommand " sshpass -p ${FSXN_PASSWORD} ssh -o StrictHostKeyChecking=no ${ONTAP_USER} @${FSXN_ADMIN_IP} volume delete -vserver ${SVM_NAME} -volume ${VOLUME_NAME} -force"
154154
155155commandDescription=" Create iscsi lun for vserver: ${SVM_NAME} volume name: ${VOLUME_NAME} and lun name: ${LUN_NAME} and size: ${LUN_SIZE} g which is 90% of the volume size"
156156logMessage " ${commandDescription} "
157- sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " lun create -vserver $SVM_NAME -path /vol/$VOLUME_NAME /$LUN_NAME -size " ${LUN_SIZE} g" -ostype linux -space-allocation enabled"
157+ sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " lun create -vserver ${ SVM_NAME} -path /vol/${ VOLUME_NAME} /$LUN_NAME -size ${LUN_SIZE} g -ostype linux -space-allocation enabled"
158158checkCommand " ${commandDescription} "
159159addUndoCommand " sshpass -p ${FSXN_PASSWORD} ssh -o StrictHostKeyChecking=no ${ONTAP_USER} @${FSXN_ADMIN_IP} lun delete -vserver ${SVM_NAME} -path /vol/${VOLUME_NAME} /${LUN_NAME} -force"
160160
@@ -164,12 +164,12 @@ addUndoCommand "sshpass -p ${FSXN_PASSWORD} ssh -o StrictHostKeyChecking=no ${ON
164164commandDescription=" Create a mapping from the LUN you created to the igroup you created"
165165logMessage " ${commandDescription} "
166166lun_id=0
167- sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " lun mapping create -vserver $SVM_NAME -path /vol/$VOLUME_NAME / $ LUN_NAME -igroup $groupName -lun-id 0"
167+ sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " lun mapping create -vserver ${ SVM_NAME} -path /vol/${ VOLUME_NAME} / ${ LUN_NAME} -igroup ${ groupName} -lun-id 0"
168168checkCommand " ${commandDescription} "
169169
170170commandDescription=" Validate the lun mapping was created"
171171logMessage " ${commandDescription} "
172- serialHex=$( sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " lun show -path /vol/$VOLUME_NAME / $ LUN_NAME -fields state,mapped,serial-hex" | grep $SVM_NAME | awk ' {print $3}' )
172+ serialHex=$( sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " lun show -path /vol/${ VOLUME_NAME} / ${ LUN_NAME} -fields state,mapped,serial-hex" | grep $SVM_NAME | awk ' {print $3}' )
173173if [ -n " $serialHex " ]; then
174174 logMessage " Lun mapping was created"
175175else
180180# The serail hex in needed for creating readable name for the block device.
181181commandDescription=" Get the iscsi interface addresses for the svm ${SVM_NAME} "
182182logMessage " ${commandDescription} "
183- iscsi1IP=$( sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " network interface show -vserver $SVM_NAME " | grep -e iscsi_1 | awk ' {print $3}' )
184- iscsi2IP=$( sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " network interface show -vserver $SVM_NAME " | grep -e iscsi_2 | awk ' {print $3}' )
183+ iscsi1IP=$( sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " network interface show -vserver ${ SVM_NAME} " | grep -e iscsi_1 | awk ' {print $3}' )
184+ iscsi2IP=$( sshpass -p $FSXN_PASSWORD ssh -o StrictHostKeyChecking=no $ONTAP_USER @$FSXN_ADMIN_IP " network interface show -vserver ${ SVM_NAME} " | grep -e iscsi_2 | awk ' {print $3}' )
185185
186186if [ -n " $i$iscsi1IP " ] && [ -n " $iscsi2IP " ]; then
187187 iscsi1IP=$( echo ${iscsi1IP%/* } )
@@ -197,8 +197,8 @@ commandDescription="Discover the target iSCSI nodes, iscsi IP: ${iscsi1IP}"
197197logMessage " ${commandDescription} "
198198iscsiadm --mode discovery --op update --type sendtargets --portal $iscsi1IP
199199checkCommand " ${commandDescription} "
200- addUndoCommand " iscsiadm --mode discovery --op delete --type sendtargets --portal $iscsi1IP "
201- addUndoCommand " iscsiadm --mode discovery --op delete --type sendtargets --portal $iscsi2IP "
200+ addUndoCommand " iscsiadm --mode discovery --op delete --type sendtargets --portal ${ iscsi1IP} "
201+ addUndoCommand " iscsiadm --mode discovery --op delete --type sendtargets --portal ${ iscsi2IP} "
202202
203203logMessage " Getting target initiator"
204204targetInitiator=$( iscsiadm --mode discovery --op update --type sendtargets --portal $iscsi1IP | awk ' {print $2}' | head -n 1)
@@ -302,7 +302,7 @@ chown $username:$username /$directory_path/$mount_point
302302# verify read write
303303# example: echo "test mount iscsci" > /mnt/myIscsi/testIscsi.txt
304304echo " test mount iscsci" > /$directory_path /$mount_point /testIscsi.txt
305- cat /$directory_path /$mount_point /testIscsci .txt
305+ cat /$directory_path /$mount_point /testIscsi .txt
306306rm /$directory_path /$mount_point /testIscsi.txt
307307
308308logMessage " Mounting the FSXn iSCSI volume was successful."
0 commit comments