From f76fac2a3a5621e9df082f699d7632456a0d8115 Mon Sep 17 00:00:00 2001 From: jjhua Date: Tue, 27 Mar 2012 02:07:46 +0000 Subject: [PATCH] For AIX, remove the original ib configuration; use the loop number instead of 0, 1, 2... git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12010 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/ib/scripts/configiba.2ports | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/ib/scripts/configiba.2ports b/xCAT-server/share/xcat/ib/scripts/configiba.2ports index 1ee071a44..e903ef11a 100644 --- a/xCAT-server/share/xcat/ib/scripts/configiba.2ports +++ b/xCAT-server/share/xcat/ib/scripts/configiba.2ports @@ -1,4 +1,4 @@ -#!/bin/sh -vx +#!/bin/sh # IBM(c) 2008 EPL license http://www.eclipse.org/legal/epl-v10.html # Sample xCAT post script for configuring secondary adatper based on eth0 @@ -52,9 +52,42 @@ if [ $PLTFRM == "Linux" ] then ib_number=`lspci | grep -i InfiniBand | wc -l` - loop_number=$[ $ib_number * 2 ] - #loop_number=$[ $loop_number - 1 ] + loop_number=`expr $ib_number \* 2` + + if [ -f /etc/redhat-release ] + then + OS_name="redhat" + elif [ -f /etc/SuSE-release ] + then + OS_name="suse" + else + echo "Unsupported to config IB on this OS!" + exit + fi + + if [ $OS_name == 'suse' ] + then + dir="/etc/sysconfig/network" + else + dir="/etc/sysconfig/network-scripts" + fi + `rm -f $dir/ifcfg-ib*` + + else + + loop_number=`lsdev | grep "IP over Infiniband Network Interface" | wc -l` + + num=0 + #for (( num = 0; num < loop_number; num++ )) + while [ $num -lt $loop_number ] + do + num1=`expr $num % 2` + `rmdev -d -l ib$num` + `rmdev -d -l ml$num1` + num=`expr $num + 1` + done + loop_number=`lsdev -Cc adapter |grep iba |wc -l` fi @@ -62,8 +95,9 @@ fi HOST=`hostname -s` +num=0 #ifor num in 0 1 -for (( num=0; num<$loop_number; num++)) +while [ $num -lt $loop_number ] do # Take primary node name, add -ib$num and then reverse resolve to get what ip should be nic="ib$num" @@ -169,6 +203,7 @@ GATEWAY=$gateway" > $dir/ifcfg-$nic mkiba -a $ip -i $nic -A $ib_adapter -p $port -P -1 -S up -m $netmask fi fi + num=`expr $num + 1` done # Bringup all the ib interfaces @@ -177,8 +212,9 @@ then /sbin/service $ib_driver restart + num=0 #for num in 0 1 - for (( num=0; num<$loop_number; num++)) + while [ $num -lt $loop_number ] do sleep 5 @@ -188,6 +224,7 @@ then else ifup ib$num fi + num=`expr $num + 1` done fi