From 5576b8b1f41c8209b54fcfe2a201ac391406ca90 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 22 Sep 2014 20:35:18 -0700 Subject: [PATCH] enhance for finding bootnic in genesis --- xCAT-genesis-scripts/bin/doxcat | 20 +++++++++++++++++--- xCAT-server/lib/xcat/plugins/nodediscover.pm | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 2820e48be..7d6203531 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -146,10 +146,24 @@ if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then else echo "Setting IP via DHCP..." # This section is for System P hardware discovery, which won't have a BOOTIF value set + tries=0 + while [ $tries -lt 5 ]; do + if [ -z "$bootnic" ]; then + ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo` + for tmp1 in $ALLUP_NICS; do + bootnic=$tmp1 + break + done + else + break + fi + sleep 2 + tries=$(($tries+1)) + done if [ -z "$bootnic" ]; then - ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo` - for tmp1 in $ALLUP_NICS; do - bootnic=$tmp1 + ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo` + for tmp in $ALL_NICS; do + bootnic=$tmp break done fi diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index d8b3c1c32..4dd348e36 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -353,7 +353,7 @@ sub process_request { $callback->({error=> ["The node [$node] should have a correct IP address which belongs to the management network."], errorcode=>["1"]}); return; } - if (defined ($request->{pbmc_node})) { + if (defined ($request->{pbmc_node}) and defined($request->{pbmc_node}->[0]) ) { my $pbmc_node = $request->{pbmc_node}->[0]; xCAT::Utils->cleanup_for_powerLE_hardware_discovery($node, $pbmc_node, $doreq); }