2011-02-02 14:47:16 +00:00
|
|
|
#!/bin/sh
|
2011-03-17 09:55:29 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
2011-02-02 14:47:16 +00:00
|
|
|
|
2011-03-17 09:55:29 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
2012-02-08 02:47:11 +00:00
|
|
|
# Sample xCAT post script for configuring hfi settings and some conventions.
|
|
|
|
# This scripts works for both diskfull installs, diskless boots on AIX or Linux.
|
2011-03-17 09:55:29 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
PLTFRM=`uname`
|
|
|
|
|
|
|
|
name=`echo $NODE | awk -F-hf '{print $1}'`
|
2011-02-15 06:15:02 +00:00
|
|
|
if [ -z $name ]
|
|
|
|
then
|
|
|
|
name=$NODE
|
|
|
|
fi
|
|
|
|
|
2011-03-17 09:55:29 +00:00
|
|
|
if [[ $PLTFRM != AIX ]] && [[ $PLTFRM != aix ]]
|
|
|
|
then
|
|
|
|
|
2011-03-18 06:18:06 +00:00
|
|
|
# A difference between service node and compute node is that service node is booted from
|
|
|
|
# ethernet, all the HFI interfaces should be configured. Compute node is booted from hf0
|
|
|
|
# so hf0 on compute node should not be re-configured on compute node.
|
2011-03-17 09:55:29 +00:00
|
|
|
if [[ $NTYPE = service ]]
|
|
|
|
then
|
|
|
|
|
2012-01-05 05:47:19 +00:00
|
|
|
CLIENT_IP=`ping -c 3 $name-hf0 -I hf0 2>/dev/null | grep "data" | sed 's/.* (\([0-9.]*\)).*/\1/' | uniq 2>&1`
|
2011-03-17 09:55:29 +00:00
|
|
|
|
2012-01-05 05:47:19 +00:00
|
|
|
if [ -n "$CLIENT_IP" ]
|
2011-02-15 06:15:02 +00:00
|
|
|
then
|
2011-03-17 09:55:29 +00:00
|
|
|
echo "DEVICE=hf0
|
|
|
|
NM_CONTROLLED=yes
|
|
|
|
IPADDR=$CLIENT_IP
|
|
|
|
NETMASK=255.0.0.0
|
|
|
|
ONBOOT=yes
|
2012-01-05 05:47:19 +00:00
|
|
|
" >/etc/sysconfig/network-scripts/ifcfg-hf0
|
2011-03-17 09:55:29 +00:00
|
|
|
|
2012-01-05 05:47:19 +00:00
|
|
|
ifdown hf0
|
|
|
|
ifup hf0
|
2011-02-15 06:15:02 +00:00
|
|
|
fi
|
2011-02-02 14:47:16 +00:00
|
|
|
|
2011-03-17 09:55:29 +00:00
|
|
|
fi
|
|
|
|
|
2011-03-18 06:18:06 +00:00
|
|
|
# Configure hf0-hf<n> interfaces one by one.
|
2012-01-05 05:47:19 +00:00
|
|
|
for i in 1 2 3 4 5 6 7
|
2011-03-17 09:55:29 +00:00
|
|
|
do
|
|
|
|
|
2012-01-05 05:47:19 +00:00
|
|
|
CLIENT_IP=`ping -c 3 $name-hf$i -I hf$i 2>/dev/null | grep "data" | sed 's/.* (\([0-9.]*\)).*/\1/' | uniq 2>&1`
|
2011-03-17 09:55:29 +00:00
|
|
|
|
2012-01-05 05:47:19 +00:00
|
|
|
if [ -n "$CLIENT_IP" ]
|
2011-02-02 14:47:16 +00:00
|
|
|
then
|
|
|
|
echo "DEVICE=hf$i
|
|
|
|
NM_CONTROLLED=yes
|
|
|
|
IPADDR=$CLIENT_IP
|
|
|
|
NETMASK=255.0.0.0
|
|
|
|
ONBOOT=yes
|
|
|
|
" >/etc/sysconfig/network-scripts/ifcfg-hf$i
|
|
|
|
|
2012-01-05 03:30:47 +00:00
|
|
|
ifdown hf$i
|
2011-02-02 14:47:16 +00:00
|
|
|
ifup hf$i
|
|
|
|
fi
|
2011-02-15 06:15:02 +00:00
|
|
|
|
2011-02-02 14:47:16 +00:00
|
|
|
done
|
2011-03-17 09:55:29 +00:00
|
|
|
|
|
|
|
else
|
2011-07-06 07:13:27 +00:00
|
|
|
NETMASK=255.0.0.0
|
2011-03-17 09:55:29 +00:00
|
|
|
|
|
|
|
if [[ $NTYPE = service ]]
|
|
|
|
then
|
|
|
|
|
|
|
|
CLIENT_IP=`ping -q -n -c 1 -w 1 $name-hf0 | grep PING |awk '{print $3}' | sed 's/(\(.*\)):/\1/' `
|
|
|
|
|
|
|
|
if [ -n $CLIENT_IP ]
|
|
|
|
then
|
2011-07-06 07:13:27 +00:00
|
|
|
mkhfi -i hf0 -a $CLIENT_IP -m $NETMASK
|
2011-03-17 09:55:29 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in 1 2 3
|
|
|
|
do
|
|
|
|
CLIENT_IP=`ping -q -n -c 1 -w 1 $name-hf$i | grep PING |awk '{print $3}' | sed 's/(\(.*\)):/\1/' `
|
|
|
|
|
2012-01-05 05:47:19 +00:00
|
|
|
if [ -n "$CLIENT_IP" ]
|
2011-03-17 09:55:29 +00:00
|
|
|
then
|
2011-07-06 07:13:27 +00:00
|
|
|
mkhfi -i hf$i -a $CLIENT_IP -m $NETMASK
|
2011-03-17 09:55:29 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
2011-03-18 06:18:06 +00:00
|
|
|
# Configure ml0 for AIX.
|
|
|
|
CLIENT_IP=`ping -q -n -c 1 -w 1 $name-ml0 | grep PING |awk '{print $3}' | sed 's/(\(.*\)):/\1/' `
|
|
|
|
|
2012-01-05 05:47:19 +00:00
|
|
|
if [ -n "$CLIENT_IP" ]
|
2011-03-18 06:18:06 +00:00
|
|
|
then
|
2011-07-13 06:16:28 +00:00
|
|
|
#Check whether the mlt0 is available
|
|
|
|
`lsdev -C | grep mlt0 | grep Available 2>&1 >/dev/null`
|
2011-07-13 06:53:22 +00:00
|
|
|
|
|
|
|
chdev -l ml0 -a state=detach
|
2011-10-30 10:16:13 +00:00
|
|
|
|
|
|
|
# Reconfig ml0 since HFx are configured after ml0 is available
|
|
|
|
rmdev -l mlt0
|
|
|
|
mkdev -l mlt0
|
|
|
|
|
2011-07-13 06:53:22 +00:00
|
|
|
chdev -l ml0 -a netaddr=$CLIENT_IP -a netmask=$NETMASK -a state=up
|
2011-03-18 06:18:06 +00:00
|
|
|
fi
|
|
|
|
|
2011-03-17 09:55:29 +00:00
|
|
|
fi
|