fix for bug 3148030: setbootfromnet handle the xcatmaster=<hostname>

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8530 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2010-12-30 09:10:11 +00:00
parent 2bba1b7836
commit 0d6ee2b958

View File

@ -14,10 +14,35 @@
#
#-----------------------------------------------------------------------------
NODE_NAME=$NODE
SERVER_IP=$MASTER
GATE_WAY=$GATEWAY
OS=`uname`
if [ -z $MASTER ]; then
msg="$0: The environment variable MASTER is null, pls check.\n"
echo $msg
logger -t xcat "$msg"
exit 1
fi
SERVER_IP=`echo $MASTER | grep -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'`
if [ ! -z $SERVER_IP ]; then
SERVER_IP=$MASTER
else
if [[ $OS = "Linux" ]]; then
SERVER_IP=`ping -c 3 $MASTER | sed '/icmp_seq/!d;s/.*(\([0-9.]\+\)).*/\1/' | uniq 2>&1`
SRET=`echo $?`
else ## for AIX
SERVER_IP=`ping -c 3 $MASTER | grep "icmp_seq" | sed 's/.*from \([0-9.]*\):.*/\1/' | uniq 2>&1`
SRET=`echo $?`
fi
if [ $SRET -ne 0 ]; then
msg="$0: The returned value is not correct, server_ip=$SERVER_IP\n"
echo $msg
logger -t xcat "$msg"
exit 1
fi
fi
if [ ! -z $NODE_NAME ]; then
if [[ $OS = "Linux" ]]; then
CLIENT_IP=`ping -c 3 $NODE_NAME | sed '/icmp_seq/!d;s/.*(\([0-9.]\+\)).*/\1/' | uniq 2>&1`