Created
April 17, 2013 06:08
-
-
Save shaon/19c213937dfb76eb7784 to your computer and use it in GitHub Desktop.
re-export all the volumes
This file contains hidden or 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
# 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