Skip to content

Instantly share code, notes, and snippets.

@cwilkers
Created July 28, 2021 19:33
Show Gist options
  • Save cwilkers/d895120748300dac5c8ce2dbeac24158 to your computer and use it in GitHub Desktop.
Save cwilkers/d895120748300dac5c8ce2dbeac24158 to your computer and use it in GitHub Desktop.
Clear all trident luns from NetApp for a backend
#!/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