Created
July 28, 2021 19:33
-
-
Save cwilkers/d895120748300dac5c8ce2dbeac24158 to your computer and use it in GitHub Desktop.
Clear all trident luns from NetApp for a backend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BACKEND=${1:-trident-backend.json} | |
source <(awk -F':' '$2~/./ { gsub(/[ \t,"]+/,""); print $1 "=\"" $2 "\""}' $BACKEND) | |
PREFIX=$(echo $storagePrefix |tr - _) | |
echo $PREFIX | |
for lun in $(showmount -e $dataLIF | awk -F '[/ ]' "/$PREFIX/ { print \$2 }") | |
do | |
SSHPASS=${password} sshpass -e ssh -l $username $managementLIF volume offline -f $lun | |
SSHPASS=${password} sshpass -e ssh -l $username $managementLIF volume delete $lun | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment