fixed SF bug #3398 updatenode -P fails if hostname on the node is FQDN

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15401 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2013-03-06 15:20:58 +00:00
parent f688bd1efe
commit 92b22201f6
9 changed files with 81 additions and 15 deletions

View File

@ -90,6 +90,8 @@ do
touch /opt/xcat/xcatinfo
fi
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
NODE=#TABLE:nodelist:THISNODE:node#
echo "NODE=$NODE" >> /opt/xcat/xcatinfo
break
fi
RAND=$(perl -e 'print int(rand(5)). "\n"')
@ -99,7 +101,7 @@ cd /xcatpost
#gunzip xcatpost.tar.gz
#tar -xvf xcatpost.tar
#/xcatpost/#TABLE:nodelist:THISNODE:node#
export PATH=/xcatpost:$PATH
export PATH=$PATH:/xcatpost
#save the postboot scripts to /var/tmp/mypostscript.post
#

View File

@ -40,7 +40,7 @@ ifconfig
cat /etc/resolv.conf
mount $MASTER_IP:/install/postscripts /xcatpost
cd /xcatpost
export PATH=/xcatpost:$PATH
export PATH=$PATH:/xcatpost
export NODE=#TABLE:nodelist:THISNODE:node#
export OSVER=#TABLE:nodetype:THISNODE:os#
export ARCH=#TABLE:nodetype:THISNODE:arch#

View File

@ -82,7 +82,9 @@ do
touch /opt/xcat/xcatinfo
fi
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
NODE=#TABLE:nodelist:THISNODE:node#
echo "NODE=$NODE" >> /opt/xcat/xcatinfo
break
fi
RAND=$(perl -e 'print int(rand(5)). "\n"')
@ -90,7 +92,7 @@ do
done
cd /xcatpost
export PATH=/xcatpost:$PATH
export PATH=$PATH:/xcatpost
# Use the run_ps subroutine to run the postscripts
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`

View File

@ -82,14 +82,16 @@ do
touch /opt/xcat/xcatinfo
fi
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
break
NODE=#TABLE:nodelist:THISNODE:node#
echo "NODE=$NODE" >> /opt/xcat/xcatinfo
break
fi
RAND=$(perl -e 'print int(rand(5)). "\n"')
sleep $RAND
done
cd /xcatpost
export PATH=/xcatpost:$PATH
export PATH=$PATH:/xcatpost
# Use the run_ps subroutine to run the postscripts
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`

View File

@ -88,6 +88,8 @@ do
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
NODE=#TABLE:nodelist:THISNODE:node#
echo "NODE=$NODE" >> /opt/xcat/xcatinfo
break
fi
@ -96,7 +98,7 @@ do
sleep $RAND
done
PATH=/xcatpost:$PATH
PATH=$PATH:/xcatpost
export PATH
# use the run_ps subroutine to run the postscripts

View File

@ -89,6 +89,8 @@ do
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
NODE=#TABLE:nodelist:THISNODE:node#
echo "NODE=$NODE" >> /opt/xcat/xcatinfo
break
fi
@ -97,7 +99,7 @@ do
sleep $RAND
done
PATH=/xcatpost:$PATH
PATH=$PATH:/xcatpost
export PATH
# use the run_ps subroutine to run the postscripts

View File

@ -90,6 +90,8 @@ do
touch /opt/xcat/xcatinfo
fi
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
NODE=#TABLE:nodelist:THISNODE:node#
echo "NODE=$NODE" >> /opt/xcat/xcatinfo
break
fi
RAND=$(perl -e 'print int(rand(5)). "\n"')
@ -99,7 +101,7 @@ cd /xcatpost
#gunzip xcatpost.tar.gz
#tar -xvf xcatpost.tar
#/xcatpost/#TABLE:nodelist:THISNODE:node#
export PATH=/xcatpost:$PATH
export PATH=$PATH:/xcatpost
#save the postboot scripts to /var/tmp/mypostscript.post
#

View File

@ -98,12 +98,15 @@ do
sleep $RAND
done
echo "INSTALLDIR=$INSTALLDIR" >> /opt/xcat/xcatinfo
NODE=#TABLE:nodelist:THISNODE:node#
echo "NODE=$NODE" >> /opt/xcat/xcatinfo
#echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
cd /xcatpost
#gunzip xcatpost.tar.gz
#tar -xvf xcatpost.tar
#/xcatpost/#TABLE:nodelist:THISNODE:node#
export PATH=/xcatpost:$PATH
export PATH=$PATH:/xcatpost
# use the run_ps subroutine to run the postscripts
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#####################################################
#
@ -341,10 +341,38 @@ fi # finish the postscripts download
rm -rf /xcatpost/mypostscript
node=`hostname --short`
#get node name
if [ -f /opt/xcat/xcatinfo ]; then
node=`grep 'NODE' /opt/xcat/xcatinfo |cut -d= -f2`
fi
#try to get the node ip address that connects to the server.
#then resolve the name of the ip
if [ -z "$node" ]; then
#find out the ip address of the node for the management nic
NIP=`ip route get $SIP | head -n 1 | sed 's/^.*src//g' | awk {'print $1'}
`
if [ -n "$NIP" ]; then
#relsove the name of the node from ip address
node=`host $NIP | awk {'print $5'} | sed '$s/\.$//'`
fi
fi
if [ -z "$node" ]; then
node=`hostname`
fi
#try the short name first
node_short=`echo $node |awk -F. {'print $1'}`
max_retries=2
postfix=0
download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR
download_mypostscript $SIP $node_short $postfix $max_retries $TFTPDIR
if [ $? -ne 0 ]; then
if [ "$node" != "node_short" ]; then
download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR
fi
fi
@ -383,6 +411,11 @@ if [ ! -x /xcatpost/mypostscript ]; then
max_retries=1
postfix=1
download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR
if [ $? -ne 0 ]; then
if [ "$node" != "node_short" ]; then
download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR
fi
fi
MYCONT=`grep MASTER /xcatpost/mypostscript`
#echo "MYCONT=$MYCONT"
@ -409,7 +442,11 @@ while [ -z "$MYCONT" ]; do
max_retries=1
postfix=1
download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR
if [ $? -ne 0 ]; then
if [ "$node" != "node_short" ]; then
download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR
fi
fi
MYCONT=`grep MASTER /xcatpost/mypostscript`
if [ ! -z "$MYCONT" ]; then
break;
@ -435,7 +472,21 @@ if [ -n "$new_ms" ]; then
echo "XCATSERVER=$new_ms" >> /opt/xcat/xcatinfo
fi
fi
#save the NODE into xcatinfo
new_node=`grep '^NODE=' /xcatpost/mypostscript |cut -d= -f2`
if [ -n "$new_node" ]; then
if [ ! -f /opt/xcat/xcatinfo ]; then
mkdir -p /opt/xcat
touch /opt/xcat/xcatinfo
fi
grep '^NODE=' /opt/xcat/xcatinfo 2>&1 > /dev/null
if [ $? -eq 0 ]; then
sed -i "s/NODE=.*/NODE=$new_node/" /opt/xcat/xcatinfo
else
echo "NODE=$new_node" >> /opt/xcat/xcatinfo
fi
fi
# when called by the updatenode command
#modify the UPDATENODE flag to 1