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
This commit is contained in:
jbjohnso 2012-01-18 21:16:24 +00:00
parent c8105a2349
commit 3ff7e9887d
2 changed files with 19 additions and 7 deletions

View File

@ -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

View File

@ -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"