From dd1006a3d141173d1c3787571c15a24face3c5c4 Mon Sep 17 00:00:00 2001 From: vallard Date: Fri, 11 Jun 2010 20:34:25 +0000 Subject: [PATCH] check which lan to use so can be used with other machines besides IBM machines git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6445 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-nbroot/overlay/bin/bmcsetup | 48 +++++++++++++++++++------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/xCAT-nbroot/overlay/bin/bmcsetup b/xCAT-nbroot/overlay/bin/bmcsetup index fd1ac79c7..b5537b545 100755 --- a/xCAT-nbroot/overlay/bin/bmcsetup +++ b/xCAT-nbroot/overlay/bin/bmcsetup @@ -32,6 +32,16 @@ while [ -z "$BMCIP" ]; do echo "FAILED TO RETRIEVE SETTINGS, RETRYING in 15 seconds" sleep 15 fi + + echo "Attempting to locate correct lan channel" + + for LANCHAN in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do + if ipmitool channel info $LANCHAN | grep 802.3 > /dev/null; + then break; + fi; + done + + echo "Using lan channel $LANCHAN" done IPMIVER=`ipmitool mc info|grep ^IPMI|awk '{print $4}'` IPMIMFG=`ipmitool mc info|grep "^Manufacturer ID"|awk '{print $4}'` @@ -42,7 +52,7 @@ if [ "$IPMIMFG" == 2 ]; then #IBM if [ -z "$BMCUS" ]; then #blank user, set to foo first ipmitool user set name 2 "foo"; else - TEMPUSER=`echo $BMCUS|sed -e 's/'^.//'` + TEMPUSER=`echo $BMCUS|sed -e \'s/'^.//'` if [ -z "$TEMPUSER" ]; then #was one character, set it to foo first ipmitool user set name 2 "foo"; else #still non blank, can use tempuser as safe temporary value @@ -55,30 +65,28 @@ if [ "$IPMIMFG" == 2 ]; then #IBM fi fi fi - - TRIES=0 -while ! ipmitool lan set 1 ipsrc static; do +while ! ipmitool lan set $LANCHAN ipsrc static; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi done TRIES=0 -while ! ipmitool lan set 1 ipaddr $BMCIP; do +while ! ipmitool lan set $LANCHAN ipaddr $BMCIP; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi done TRIES=0 -while ! ipmitool lan set 1 netmask $BMCNM; do +while ! ipmitool lan set $LANCHAN netmask $BMCNM; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi done TRIES=0 if [ ! -z "$BMCGW" ]; then - while ! ipmitool lan set 1 defgw ipaddr $BMCGW; do + while ! ipmitool lan set $LANCHAN defgw ipaddr $BMCGW; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi @@ -109,7 +117,9 @@ while ! ipmitool user enable 2; do if [ $TRIES -gt $TIMEOUT ]; then break; fi done TRIES=0 -while ! ipmitool user priv 2 4 1; do +# Last param in ipmitool user priv is the channel to set it on. +# Penguin boxes are all channel 2 +while ! ipmitool user priv 2 4 $LANCHAN; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi @@ -131,14 +141,14 @@ echo "Set up following user table: " ipmitool user list 1 -echo "Enabling Channel 1: " -while ! ipmitool raw 0x6 0x40 0x1 0x42 0x44; do +echo "Enabling Channel $LANCHAN: " +while ! ipmitool raw 0x6 0x40 $LANCHAN 0x42 0x44; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi done TRIES=0 -while ! ipmitool raw 0x6 0x40 0x1 0x82 0x84; do +while ! ipmitool raw 0x6 0x40 $LANCHAN 0x82 0x84; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi @@ -146,7 +156,7 @@ done TRIES=0 echo -n "Enabling ARP responses: " -while ! ipmitool lan set 1 arp respond on; do +while ! ipmitool lan set $LANCHAN arp respond on; do sleep 1 let TRIES=TRIES+1 echo -n . @@ -156,7 +166,7 @@ TRIES=0 echo echo "Enabling IPMI v 1.5 MD5 LAN access:" -while ! ipmitool lan set 1 auth admin md5; do +while ! ipmitool lan set $LANCHAN auth admin md5; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi @@ -164,8 +174,8 @@ done TRIES=0 if [ ! "$IPMIVER" == "1.5" ]; then echo "Enabling IPMI v 2.0 LAN access:" - SUPPORTEDSUITES=`ipmitool lan print 1|grep Suites|awk -F: '{print $2}'|sed -e 's/ 0//'` - PRIVS="X" + SUPPORTEDSUITES=`ipmitool lan print $LANCHAN|grep Suites|awk -F: '{print $2}'|sed -e 's/ 0//'` + PRIVS="a" for priv in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do if echo $SUPPORTEDSUITES|grep $priv > /dev/null; then PRIVS="$PRIVS"a @@ -173,15 +183,15 @@ if [ ! "$IPMIVER" == "1.5" ]; then PRIVS="$PRIVS"X fi done - while ! ipmitool lan set 1 cipher_privs $PRIVS; do + while ! ipmitool lan set $LANCHAN cipher_privs $PRIVS; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi done TRIES=0 - echo "Enabling SOL for channel 1" - while ! ipmitool raw 0xc 0x21 0x1 0x1 0x1; do + echo "Enabling SOL for channel $LANCHAN" + while ! ipmitool raw 0xc 0x21 $LANCHAN 0x1 0x1; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi @@ -189,7 +199,7 @@ if [ ! "$IPMIVER" == "1.5" ]; then TRIES=0 echo "Enabling SOL for user 2" - while ! ipmitool raw 6 0x4c 1 2 2 0 0 0; do + while ! ipmitool raw 6 0x4c $LANCHAN 2 2 0 0 0; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi