|
#!/bin/ksh93 |
|
|
|
### Initial Check |
|
|
|
while getopts ":l:f:" argument |
|
do |
|
case $argument in |
|
l) SRV_TARGET=$OPTARG;; |
|
f) PARAM=$OPTARG;; |
|
:) echo "Option -$OPTARG need argument"; exit;; |
|
\?) echo "Option -$OPTARG invalid"; exit;; |
|
esac |
|
done |
|
|
|
echo server=$SRV_TARGET |
|
if (( ${#SRV_TARGET} == 0 )) |
|
then |
|
echo "\nERROR! You must give short hostname as argument" |
|
echo "ERROR!\t\tExample $0 -l <lpar_name>\n" |
|
exit 99 |
|
fi |
|
|
|
CONFIG_FILE="vegaV2/$SRV_TARGET/lpar_param.txt" |
|
PARAM=${PARAM:-$CONFIG_FILE} |
|
echo "File Parameter=$PARAM" |
|
if [[ ! -f $PARAM ]] || [[ ! -s $PARAM ]] |
|
then |
|
echo "\nERROR! You must give a pameter file as argument" |
|
echo "ERROR!\t\tExample $0 -f <param_file>\n" |
|
exit 99 |
|
fi |
|
|
|
if (( $(id -u) != 0 )) |
|
then |
|
echo "ERROR! you should connect as root user to exec this script" |
|
exit 99 |
|
fi |
|
|
|
if ! lsnim -l $SRV_TARGET > /dev/null 2>&1 |
|
then |
|
echo "ERROR! ($SRV_TARGET) is not NIM client for $(hostname) " |
|
exit 99 |
|
fi |
|
|
|
RC=$(ssh -o BatchMode=yes -o ConnectTimeout=10 $SRV_TARGET "date >/dev/null 2>&1 && echo 0 || echo 1") |
|
if (( RC == 1 )) |
|
then |
|
echo "ERROR! ($SRV_TARGET) not available by ssh" |
|
exit 99 |
|
fi |
|
|
|
################## Main script ########################## |
|
|
|
# identify queue_depth rootvg sytem source |
|
QUEUE_DEPTH=$(awk -F";" ' $1 == "rootvg" {print $NF}' $PARAM) |
|
echo "Queue_Depth = $QUEUE_DEPTH" |
|
|
|
for i in $(ssh $SRV_TARGET "lsdev -Cc disk | awk ' {print \$1}'") |
|
do |
|
typeset -i qd=$(ssh $SRV_TARGET "lsattr -El $i -a queue_depth| awk '{print \$2}'") |
|
if (( qd != QUEUE_DEPTH )) |
|
then |
|
echo "modify $i ..." |
|
ssh $SRV_TARGET "chdev -l $i -a queue_depth=$QUEUE_DEPTH -a reserve_policy=no_reserve -P" |
|
fi |
|
done |
|
|
|
echo "Hdisk List ..." |
|
ssh $SRV_TARGET "lsdev -Cc disk" |
|
|
|
exit 0 |
|
|
|
./ident_hdisk_vg_lun.sh |
|
#!/bin/ksh93 |
|
# |
|
# [Oct 21 2015, 15:28:43] |
|
# |
|
|
|
### Initial Check |
|
|
|
while getopts ":l:" argument |
|
do |
|
case $argument in |
|
l) SRV_TARGET=$OPTARG;; |
|
:) echo "Option -$OPTARG need an argument"; exit;; |
|
\?) echo "Option _$OPTARG invalid";exit;; |
|
esac |
|
done |
|
|
|
if (( ${#SRV_TARGET} == 0 )) |
|
then |
|
echo "ERROR! You must give short hostname as argument" |
|
echo "ERROR!\t\tExample $0 -l <lpar_name>" |
|
exit 99 |
|
fi |
|
|
|
if (( $(id -u) != 0 )) |
|
then |
|
echo "ERROR! you should connect as root user to exec this script" |
|
exit 99 |
|
fi |
|
|
|
if ! lsnim -l $SRV_TARGET > /dev/null 2>&1 |
|
then |
|
echo "ERROR! ($SRV_TARGET) is not NIM client for $(hostname) " |
|
exit 99 |
|
fi |
|
|
|
RC=$(ssh -o BatchMode=yes -o ConnectTimeout=10 $SRV_TARGET "date >/dev/null 2>&1 && echo 0 || echo 1") |
|
if (( RC == 1 )) |
|
then |
|
echo "ERROR! ($SRV_TARGET) not available by ssh" |
|
exit 99 |
|
fi |
|
|
|
################## Main script ########################## |
|
|
|
CONFIG_DIR="vegaV2/$SRV_TARGET" |
|
if [[ ! -d $CONFIG_DIR ]] |
|
then |
|
mkdir -p $CONFIG_DIR |
|
fi |
|
|
|
CONFIG_FILE="$CONFIG_DIR/lpar_param.txt" |
|
printf "%-4s %-5s %-4s %-12s %s\n" "# VG" HDISK LUN PVID QDEPTH > $CONFIG_FILE |
|
for HD in $(ssh $SRV_TARGET "lspv | awk ' { print \$1 }'") |
|
do |
|
VG=$(ssh $SRV_TARGET "lspv | awk ' \$1 == hd { print \$3 }' hd=$HD") |
|
LDEV=$(ssh $SRV_TARGET "lscfg -vl $HD | awk -F. ' \$2 == \"(Z1)\" { print substr(\$10,1,4)}'") |
|
QDEPTH=$(ssh $SRV_TARGET "lsattr -El $HD -a queue_depth | awk ' { print \$2}'") |
|
PVID=$(ssh $SRV_TARGET "lspv | awk ' \$1 == hd { print \$2 }' hd=$HD") |
|
#printf "%-8s=> %-8s: %s\n" $VG $HD $LDEV |
|
echo "$VG;$HD;$LDEV;$PVID;$QDEPTH" >> $CONFIG_FILE |
|
done |
|
|
|
ssh $SRV_TARGET "prtconf;lspv -u;lsdev -Cc disk;lspv | awk '{print(\"####### \" \$1);system(\"lsattr -El \" \$1)}';lsvg |lsvg -i -l;ifconfig -a;netstat -nr;netstat -i;bootlist -om normal" > $CONFIG_DIR/lpar_definition.txt |
|
|
|
echo "Config file available in <$CONFIG_DIR>" |
|
|
|
exit 0 |
|
|
|
./importvg_g1k.sh |
|
#!/bin/ksh93 |
|
|
|
### Initial Check |
|
|
|
while getopts ":l:f:" argument |
|
do |
|
case $argument in |
|
l) SRV_TARGET=$OPTARG;; |
|
f) PARAM=$OPTARG;; |
|
:) echo "Option -$OPTARG need an argument"; exit;; |
|
\?) echo "Option _$OPTARG invalid";exit;; |
|
esac |
|
done |
|
if (( ${#SRV_TARGET} == 0 )) |
|
then |
|
echo "ERROR! You must give short hostname as argument" |
|
echo "ERROR!\t\tExample $0 -l <lpar_name>" |
|
exit 99 |
|
fi |
|
|
|
CONFIG_FILE="vegaV2/$SRV_TARGET/lpar_param.txt" |
|
PARAM=${PARAM:-$CONFIG_FILE} |
|
echo "File Parameter=$PARAM" |
|
if [[ ! -f $PARAM ]] || [[ ! -s $PARAM ]] |
|
then |
|
echo "\nERROR! You must give a pameter file as argument" |
|
echo "ERROR!\t\tExample $0 -f <param_file>\n" |
|
exit 99 |
|
fi |
|
|
|
if (( $(id -u) != 0 )) |
|
then |
|
echo "ERROR! you should connect as root user to exec this script" |
|
exit 99 |
|
fi |
|
|
|
if ! lsnim -l $SRV_TARGET > /dev/null 2>&1 |
|
then |
|
echo "ERROR! ($SRV_TARGET) is not NIM client for $(hostname) " |
|
exit 99 |
|
fi |
|
|
|
RC=$(ssh -o BatchMode=yes -o ConnectTimeout=10 $SRV_TARGET "date >/dev/null 2>&1 && echo 0 || echo 1") |
|
if (( RC == 1 )) |
|
then |
|
echo "ERROR! ($SRV_TARGET) not available by ssh" |
|
exit 99 |
|
fi |
|
|
|
################## Main script ########################## |
|
echo "importVG Hitachi..." |
|
|
|
# identify queue_depth rootvg |
|
|
|
cat $PARAM | grep -Ev -e "^#|^rootvg" | while IFS=";" read VG HD LDEV PVID QDEPTH |
|
do |
|
echo "Import VG : $VG" |
|
ssh $SRV_TARGET "lspv | awk ' \$2 == \"$PVID\" {system(\"echo importvg -y $VG \" \$1 \" ; importvg -y $VG \" \$1)}'" |
|
done |
|
|
|
echo "Hdisk List ..." |
|
ssh $SRV_TARGET "lspv" |
|
|
|
exit 0 |
|
|
|
./install_hds_odm5410.sh |
|
#!/bin/ksh93 |
|
# |
|
# [Oct 21 2015, 15:28:43] |
|
# |
|
|
|
### Initial Check |
|
|
|
while getopts ":l:q:" argument |
|
do |
|
case $argument in |
|
l) SRV_TARGET=$OPTARG;; |
|
:) echo "Option -$OPTARG need and argument";exit;; |
|
\?) echo "Option -$OPTARG invalid";exit;; |
|
esac |
|
done |
|
|
|
if (( ${#SRV_TARGET} == 0 )) |
|
then |
|
echo "\nERROR! You must give short hostname as argument" |
|
echo "ERROR!\t\tExample $0 -l <lpar_name>\n" |
|
exit 99 |
|
fi |
|
|
|
if (( $(id -u) != 0 )) |
|
then |
|
echo "ERROR! you should connect as root user to exec this script" |
|
exit 99 |
|
fi |
|
|
|
if ! lsnim -l $SRV_TARGET > /dev/null 2>&1 |
|
then |
|
echo "ERROR! ($SRV_TARGET) is not NIM client for $(hostname) " |
|
exit 99 |
|
fi |
|
|
|
RC=$(ssh -o BatchMode=yes -o ConnectTimeout=10 $SRV_TARGET "date >/dev/null 2>&1 && echo 0 || echo 1") |
|
if (( RC == 1 )) |
|
then |
|
echo "ERROR! ($SRV_TARGET) not available by ssh" |
|
exit 99 |
|
fi |
|
|
|
################## Main script ########################## |
|
echo "Begin ODM Hitachi Install V5.4.1.0" |
|
/usr/lpp/bos.sysmgt/nim/methods/m_sm_nim update_all -t $SRV_TARGET -l 'lpp_hds_odm5410' -f 'c' -f 'N' -f 'g' -f 'X' -f 'Y' |
|
RC=$? |
|
if (( RC == 0 )) |
|
then |
|
echo "End ODM Hitachi Install V5.4.1.0" |
|
else |
|
echo "ERROR! Install terminated with error, please check level" |
|
fi |
|
|
|
# Change default parameter on HDS Driver |
|
echo "Update Default Parameter : reserve_policy=no_reserve queue_depth=16" |
|
ssh -o BatchMode=yes -o ConnectTimeout=10 $SRV_TARGET "chdef -a reserve_policy=no_reserve -c disk -s fcp -t htcvspg1000mpio" |
|
ssh -o BatchMode=yes -o ConnectTimeout=10 $SRV_TARGET "chdef -a queue_depth=16 -c disk -s fcp -t htcvspg1000mpio" |
|
# Change and display bootlist |
|
ssh -o BatchMode=yes -o ConnectTimeout=10 $SRV_TARGET "bootlist -m normal \$(lsvg -p rootvg | awk ' NR == 3 { print \$1}');bootlist -om normal" |
|
|
|
# display HDS driver level |
|
ssh -o BatchMode=yes -o ConnectTimeout=10 $SRV_TARGET "/usr/bin/lslpp -l devices.fcp.disk.Hitachi.array.mpio.rte" |
|
|
|
echo "\nWARNING!\nWARNING \t you should reboot this LPAR now to apply last level\n" |
|
exit 0 |