Skip to content

Instantly share code, notes, and snippets.

@shaon
Created April 17, 2013 06:08
Show Gist options
  • Save shaon/19c213937dfb76eb7784 to your computer and use it in GitHub Desktop.
Save shaon/19c213937dfb76eb7784 to your computer and use it in GitHub Desktop.
re-export all the volumes
# from storage database
# eucalyptus_storage=# SELECT volume_name, storename, lv_name from iscsivolumeinfo ;
# save this to <iscsiinfo> file
# remove the snapshots
#sed -i '/snap/d' iscsiinfo
#sed -i 's/|//g' iscsiinfo
while read line
do
read IQN TID LV <<< $(echo $line)
TIDN=$(echo $TID | cut -f 2 -d ':' | sed 's/store//')
tgtadm --lld iscsi --op new --mode target --tid $TIDN -T $TID
tgtadm --lld iscsi --op new --mode logicalunit --tid $TIDN --lun 1 -b /dev/vg01/$LV
tgtadm --lld iscsi --op bind --mode account --tid $TIDN --user eucalyptus
tgtadm --lld iscsi --op bind --mode target --tid $TIDN -I ALL
done < $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment