2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 09:36:41 +00:00

Merge pull request #87 from immarvin/master

fix defect [DEV] Error: either "dev" is duplicate, or "virbr0" is a garbage." message on the 1st reboot after kvmhost installation #86
This commit is contained in:
Xiaopeng Wang 2015-08-19 14:09:37 +08:00
commit 95086d765a

View File

@ -19,24 +19,38 @@ fi
SLI=$(awk 'BEGIN{srand(); printf("%d\n",rand()*10)}')
sleep $SLI
MACADDR=`grep MACADDRESS= /xcatpost/mypostscript.post |awk -F = '{print $2}'|sed s/\'//g`
INSTALLNIC=`ip -o link|grep -i $MACADDR|awk '{print $2}'|sed s/://`
#the nics have not been configured when running the PBS sometimes, need to make sure...
RETRY=0
until ip -4 --oneline addr show dev $INSTALLNIC|grep inet >/dev/null
do
sleep 2
NETUP=0
while true; do
#scan the nics with the specified mac address
#there will be multiple nic names for a mac address when the network bridge exists
for nic in $INSTALLNIC ;do
#check whether the nic is configured and linkup
ip -4 --oneline addr show dev $nic |grep inet >/dev/null && NETUP=1 && break
done
#nic is configured,terminate scan...
[ $NETUP -ne 0 ] && break;
RETRY=$[ $RETRY + 1 ]
if [ $RETRY -eq 90 ];then
msgutil_r "$MASTER_IP" "err" `date`" xcatinstallpost: Network not configured, please check..." "/var/log/xcat/xcat.log"
exit 1
if [ $RETRY -eq 90 ];then
#timeout, complain and exit
msgutil_r "$MASTER_IP" "err" `date`" xcatinstallpost: Network not configured, please check..." "/var/log/xcat/xcat.log"
exit 1
fi
#sleep sometime before the next scan
sleep 2
done
cd /xcatpost;
PATH=/xcatpost:$PATH
export PATH