root / bin / update-iscsi-volume @ 39
Historique | Voir | Annoter | Télécharger (2,33 ko)
1 |
#!/bin/bash |
---|---|
2 |
# $Id: update-iscsi-volume 39 2013-10-08 12:46:21Z ltaulell $ |
3 |
|
4 |
cat /proc/net/iet/volume |
5 |
echo "*** Saisir TID a mettre a jour : ***" |
6 |
|
7 |
while read inputline |
8 |
do |
9 |
TID_ISCSI=$inputline |
10 |
echo "*** Etes-vous sur de vouloir mettre a jour le TID : $inputline ? (y/n) ***" |
11 |
|
12 |
while read inputConfirm |
13 |
do |
14 |
if [ "$inputConfirm" = "y" ]||[ "$inputConfirm" = "n" ] |
15 |
then |
16 |
break |
17 |
fi |
18 |
echo "*** Etes-vous sur du nom : $inputline ? (y/n) ***" |
19 |
done |
20 |
|
21 |
if [ "$inputConfirm" = "y" ] |
22 |
then |
23 |
COPY_LINE=1 |
24 |
TARGET=$(cat /proc/net/iet/session |grep tid:$TID_ISCSI |awk '{split($0,array,"name:")} END {print array[2]}') |
25 |
LUN=$(cat /proc/net/iet/volume |grep "tid:$TID_ISCSI" -A1 | awk '{split($0,array,"lun:")} END {print array[2]}'|cut -d " " -f1) |
26 |
TYPE=$(cat /proc/net/iet/volume |grep "tid:$TID_ISCSI" -A1 | awk '{split($0,array,"iotype:")} END {print array[2]}'|cut -d " " -f1) |
27 |
DEV_PATH=$(cat /proc/net/iet/volume |grep "tid:$TID_ISCSI" -A1 | awk '{split($0,array,"path:")} END {print array[2]}'|cut -d " " -f1) |
28 |
|
29 |
echo "*** $TARGET" |
30 |
echo "*** $LUN" |
31 |
echo "*** $TYPE" |
32 |
echo "*** $DEV_PATH" |
33 |
COPY_LINE=0 |
34 |
while read line |
35 |
do |
36 |
echo $line |grep -i "^Target" |
37 |
if [ $? -eq 0 ] |
38 |
then |
39 |
COPY_LINE=0 |
40 |
fi |
41 |
echo $line |grep -i "^Target $TARGET" |
42 |
if [ $? -eq 0 ] |
43 |
then |
44 |
COPY_LINE=1 |
45 |
fi |
46 |
if [ $COPY_LINE -eq 1 ] |
47 |
then |
48 |
SEARCH_USER=$(echo $line |grep -i "^IncomingUser") |
49 |
if [ "$SEARCH_USER" != "" ] |
50 |
then |
51 |
echo "FIND $SEARCH_USER" |
52 |
USERCHAP=$(echo $SEARCH_USER|cut -d " " -f2) |
53 |
PASSCHAP=$(echo $SEARCH_USER|cut -d " " -f3) |
54 |
if [ "$USERCHAP" != "IncomingUser" ] |
55 |
then |
56 |
echo "USERCHAP : $USERCHAP" |
57 |
echo "PASSCHAP : $PASSCHAP" |
58 |
fi |
59 |
fi |
60 |
fi |
61 |
|
62 |
done < "/etc/iet/ietd.conf" |
63 |
|
64 |
#ietadm --op delete --tid=$TID_ISCSI |
65 |
#ietadm --op new --tid=$TID_ISCSI --params Name=$TARGET |
66 |
#ietadm --op new --tid=$TID_ISCSI --lun=$LUN --params Path=$DEV_PATH,Type=$TYPE |
67 |
#ietadm --op new --tid=$TID_ISCSI --user --params=IncomingUser=$USERCHAP,Password=$PASSCHAP |
68 |
break |
69 |
fi |
70 |
if [ "$inputConfirm" != "y" ] |
71 |
then |
72 |
echo "*** Saisir TID a mettre a jour : ***" |
73 |
fi |
74 |
done |