Skip to content

Commit 20b8774

Browse files
committed
Added support for Gen2 and scale-out.
1 parent 83c82fe commit 20b8774

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

Management-Utilities/fsx-ontap-aws-cli-scripts/create_fsxn_filesystem

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ is_in(){
6666

6767
local value=$1
6868
shift
69-
for i in $@; do
69+
for i in "$@"; do
7070
if [ $i == $value ]; then
7171
return 0
7272
fi
@@ -157,19 +157,19 @@ while [ ! -z "$1" ]; do
157157
shift
158158
done
159159

160-
if is_in "$throughput" ${throughputValuesGen1[@]}; then
161-
if [ $availType="single" ]; then
160+
if is_in "$throughput" "${throughputValuesGen1[@]}"; then
161+
if [ $availType == "single" ]; then
162162
azType="SINGLE_AZ_1"
163163
elif [ $availType="multi" ]; then
164164
azType="MULTI_AZ_1"
165165
else
166166
echo "Error, unknown availability type '$availType'."
167167
usage
168168
fi
169-
elif is_in "$throughput" ${throughputValuesGen2[@]}; then
170-
if [ $availType="single" ]; then
169+
elif is_in "$throughput" "${throughputValuesGen2[@]}"; then
170+
if [ $availType == "single" ]; then
171171
azType="SINGLE_AZ_2"
172-
elif [ $availType="multi" ]; then
172+
elif [ $availType == "multi" ]; then
173173
azType="MULTI_AZ_2"
174174
else
175175
echo "Error, unknown availability type '$availType'."
@@ -181,8 +181,13 @@ else
181181
fi
182182
#
183183
# Ensure all the required parameters have been provided.
184-
if [ -z "$fileSystemName" -o -z "$subnetID1" -o "$azType" == "MULTI_AZ_1" -a -z "$subnetID2" -o "$azType" == "MULTI_AZ_2" -a -z "$subnetID2" ]; then
185-
echo "Missing arguments." 1>&2
184+
if [ -z "$fileSystemName" ]; then
185+
echo "Error, you must specify a file system name." 1>&2
186+
usage
187+
fi
188+
189+
if [ -z "$subnetID1" -o "$azType" == "MULTI_AZ_1" -a -z "$subnetID2" -o "$azType" == "MULTI_AZ_2" -a -z "$subnetID2" ]; then
190+
echo "Error, you must specify only subnetID1 for a single availability zone deployments or both subnetID1 and subnetID2 for a multi availability zone deployments." 1>&2
186191
usage
187192
fi
188193

@@ -199,13 +204,13 @@ if [[ $azType == *"SINGLE_AZ"* ]]; then
199204
fi
200205

201206
if [ $numPairs -gt 1 ]; then
202-
if [ $azType != "SINGLE_AZ_2" ]; then
203-
echo "Error, you can only specify more than one HA pair with a single availability zone deployment." 1>&2
207+
if ! is_in "$throughput" "${throughputValuesMultiHAPairs[@]}"; then
208+
echo "Error, you can only specify more than one HA pair with throughput values of 1536, 3072, and 6144." 1>&2
204209
usage
205210
fi
206211

207-
if ! is_in "$throughput" ${throughputValuesMultiHAPairs[@]}; then
208-
echo "Error, you can only specify more than one HA pair with throughput values of 1536, 3072, and 6144." 1>&2
212+
if [ $azType != "SINGLE_AZ_2" ]; then
213+
echo "Error, you can only specify more than one HA pair with a single availability zone deployment." 1>&2
209214
usage
210215
fi
211216
fi
@@ -216,13 +221,14 @@ if [ $size -lt $minSize ]; then
216221
usage
217222
fi
218223

219-
aws fsx create-file-system --output=json --file-system-type ONTAP --storage-capacity $size --subnet-ids $subnetID1 $subnetID2 --storage-type SSD --tags "Key=Name,Value=$fileSystemName" $securityGroupOption --ontap-configuration '{
224+
echo aws fsx create-file-system --output=json --file-system-type ONTAP --storage-capacity $size --subnet-ids $subnetID1 $subnetID2 --storage-type SSD --tags "Key=Name,Value=$fileSystemName" $securityGroupOption --ontap-configuration '{
220225
"PreferredSubnetId": "'$subnetID1'",
221226
'$endpointips'
222227
"DeploymentType": "'$azType'",
223228
"HAPairs": '$numPairs',
224-
"ThroughputCapacityPerHAPair": '$throughput'}' --region=$region > $tmpout 2>&1
225-
229+
"ThroughputCapacityPerHAPair": '$throughput'}' --region=$region
230+
# "ThroughputCapacityPerHAPair": '$throughput'}' --region=$region > $tmpout 2>&1
231+
exit
226232
if [ $? != "0" ]; then
227233
echo "Failed to create FSxN file system." 1>&2
228234
cat $tmpout 1>&2

0 commit comments

Comments
 (0)