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