From 3ff7e9887d7278705bac839d79b958954e13ddff Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 18 Jan 2012 21:16:24 +0000 Subject: [PATCH] Fix genesis to more aggressively remove stale ip addresses (sometimes RELEASE never comes, but with BOUND comes, it also has old_ip_address set if one must be removed) Also fix more instances where whitespace in destiny mucks things up git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11394 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-nbroot2/dhclient-script | 6 ++++++ xCAT-nbroot2/doxcat | 20 +++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/xCAT-nbroot2/dhclient-script b/xCAT-nbroot2/dhclient-script index 4ac4af5d5..b78cb1bba 100755 --- a/xCAT-nbroot2/dhclient-script +++ b/xCAT-nbroot2/dhclient-script @@ -11,6 +11,9 @@ if [ $reason = "PREINIT" -o $reason = "PREINIT6" ]; then tries=$((tries-1)) done elif [ $reason = "BOUND" ]; then + if [ ! -z "$old_ip_address" ]; then + ip addr del dev $interface $old_ip_address/$old_subnet_mask + fi if [ ! -z "$new_ip_address" -a ! -z "$new_subnet_mask" ]; then ip addr add dev $interface $new_ip_address/$new_subnet_mask fi @@ -44,6 +47,9 @@ elif [ $reason = "BOUND" ]; then rm -rf /usr/share/zoneinfo #free up ramdisk fi elif [ $reason = "BOUND6" ]; then + if [ ! -z "$old_ip6_address" ]; then + ip addr del dev $interface $old_ip6_address/$old_ip6_prefixlen + fi if [ ! -z "$new_ip6_address" ]; then ip addr add dev $interface $new_ip6_address/$new_ip6_prefixlen fi diff --git a/xCAT-nbroot2/doxcat b/xCAT-nbroot2/doxcat index 3b32acfe5..bde549036 100755 --- a/xCAT-nbroot2/doxcat +++ b/xCAT-nbroot2/doxcat @@ -106,19 +106,23 @@ while :; do destparameter=`echo $destiny|awk -F= '{print $2}'` destiny=`echo $destiny|awk -F= '{print $1}'` dest=`echo $destiny|awk '{print $1}'` #could probably use bash but oh well - if [ "$destiny" = "discover" ]; then #skip a query to xCAT when /proc/cmdline will do + if [ "$dest" = "discover" ]; then #skip a query to xCAT when /proc/cmdline will do /bin/dodiscovery /bin/getcert $XCATMASTER:$XCATPORT destiny='' - elif [ "$destiny" = shell ]; then + dest='' + elif [ "$dest" = shell ]; then echo "Dropping to debug shell, exit to check for further action" destiny='' + dest='' /bin/bash - elif [ "$destiny" = runcmd ]; then + elif [ "$dest" = runcmd ]; then destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` + dest=`echo $destiny|awk -F= '{print $1}'` $destparameter - elif [ "$destiny" = runimage ]; then + elif [ "$dest" = runimage ]; then destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` + dest=`echo $destiny|awk -F= '{print $1}'` mkdir /tmp/`basename $destparameter` cd /tmp/`basename $destparameter` ERROR=`wget $desparamater 2>&1` @@ -129,13 +133,14 @@ while :; do tar xvf `basename $TARG` ./runme.sh cd - - elif [ "$destiny" = "reboot" -o "$destiny" = "boot" ]; then + elif [ "$dest" = "reboot" -o "$dest" = "boot" ]; then /bin/nextdestiny $XCATMASTER:$XCATPORT reboot -f elif [ "$dest" = "install" -o "$dest" = "netboot" ]; then reboot -f - elif [ "$destiny" = standby ]; then + elif [ "$dest" = standby ]; then destiny='' + dest='' delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do echo -en "Received request to retry in a bit, will call xCAT back in $delay seconds \r" @@ -144,8 +149,9 @@ while :; do done echo "Retrying "; else - echo "Unrecognized directive $destiny" + echo "Unrecognized directive $dest" destiny='' + dest='' delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do echo -en "Will retry in $delay seconds \r"