diff --git a/xCAT-server-2.0/etc/xcat/postscripts.rules b/xCAT-server-2.0/etc/xcat/postscripts.rules index cbcf7dead..02f3f9865 100644 --- a/xCAT-server-2.0/etc/xcat/postscripts.rules +++ b/xCAT-server-2.0/etc/xcat/postscripts.rules @@ -194,9 +194,6 @@ ALL { updateflag.awk $MASTER 3002 } -NODERANGE=iscsi { - uploadboot -} # hardcode networking #OSVER=sl[34].* or OSVER=centos.* or OSVER=rh.* or OSVER=sles.* or OSVER=suse.* { # hardnis diff --git a/xCAT-server-2.0/share/xcat/install/fedora/iscsi.ppc64.tmpl b/xCAT-server-2.0/share/xcat/install/fedora/iscsi.ppc64.tmpl index 07a03c2dd..5793a7c24 100644 --- a/xCAT-server-2.0/share/xcat/install/fedora/iscsi.ppc64.tmpl +++ b/xCAT-server-2.0/share/xcat/install/fedora/iscsi.ppc64.tmpl @@ -172,4 +172,4 @@ openssh-server %pre #INCLUDE:../scripts/pre.rh# %post -#INCLUDE:../scripts/post.rh# +#INCLUDE:../scripts/post.rh.iscsi# diff --git a/xCAT-server-2.0/share/xcat/install/fedora/iscsi.tmpl b/xCAT-server-2.0/share/xcat/install/fedora/iscsi.tmpl index 4de2baf64..f95ceda14 100644 --- a/xCAT-server-2.0/share/xcat/install/fedora/iscsi.tmpl +++ b/xCAT-server-2.0/share/xcat/install/fedora/iscsi.tmpl @@ -171,4 +171,4 @@ openssh-server %pre #INCLUDE:../scripts/pre.rh# %post -#INCLUDE:../scripts/post.rh# +#INCLUDE:../scripts/post.rh.iscsi# diff --git a/xCAT-server-2.0/share/xcat/install/rh/iscsi.ppc64.tmpl b/xCAT-server-2.0/share/xcat/install/rh/iscsi.ppc64.tmpl index f24eca66d..9729fe7df 100644 --- a/xCAT-server-2.0/share/xcat/install/rh/iscsi.ppc64.tmpl +++ b/xCAT-server-2.0/share/xcat/install/rh/iscsi.ppc64.tmpl @@ -180,4 +180,4 @@ compat-libstdc++-33 %pre #INCLUDE:../scripts/pre.rh# %post -#INCLUDE:../scripts/post.rh# +#INCLUDE:../scripts/post.rh.iscsi# diff --git a/xCAT-server-2.0/share/xcat/install/rh/iscsi.tmpl b/xCAT-server-2.0/share/xcat/install/rh/iscsi.tmpl index 73beb37ed..65051f9d9 100644 --- a/xCAT-server-2.0/share/xcat/install/rh/iscsi.tmpl +++ b/xCAT-server-2.0/share/xcat/install/rh/iscsi.tmpl @@ -179,4 +179,4 @@ compat-libstdc++-33 %pre #INCLUDE:../scripts/pre.rh# %post -#INCLUDE:../scripts/post.rh# +#INCLUDE:../scripts/post.rh.iscsi# diff --git a/xCAT-server-2.0/share/xcat/install/scripts/post.rh b/xCAT-server-2.0/share/xcat/install/scripts/post.rh index eddbd1764..cb9bb749e 100644 --- a/xCAT-server-2.0/share/xcat/install/scripts/post.rh +++ b/xCAT-server-2.0/share/xcat/install/scripts/post.rh @@ -25,6 +25,7 @@ hostname $HOSTNAME # export MASTER_IP="#XCATVAR:XCATMASTER#" export MASTER_IPS="#XCATVAR:XCATMASTER#" +export MASTER="#XCATVAR:XCATMASTER#" mkdir -p /xcatpost cd /xcatpost RAND=$(perl -e 'print int(rand(50)). "\n"') diff --git a/xCAT-server-2.0/share/xcat/install/scripts/post.rh.iscsi b/xCAT-server-2.0/share/xcat/install/scripts/post.rh.iscsi new file mode 100644 index 000000000..6b24544c6 --- /dev/null +++ b/xCAT-server-2.0/share/xcat/install/scripts/post.rh.iscsi @@ -0,0 +1,59 @@ +# +# Setup hostname +# +echo "post scripts" >/root/post.log +export PRINIC=#TABLE:noderes:THISNODE:primarynic# +if [ -z "$PRINIC" ] +then + export PRINIC=eth0 +fi +IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') +if [ -z $IP ] +then + dhclient eth0 + IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') +fi +echo "search #TABLE:site:key=domain:value#" >/etc/resolv.conf +for i in $(echo #TABLE:site:key=nameservers:value# | tr ',' ' ') +do + echo "nameserver $i" +done >>/etc/resolv.conf +export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}') +hostname $HOSTNAME +# +# Run xCAT post install +# +export MASTER_IP="#XCATVAR:XCATMASTER#" +export MASTER_IPS="#XCATVAR:XCATMASTER#" +export MASTER="#XCATVAR:XCATMASTER#" +mkdir -p /xcatpost +cd /xcatpost +RAND=$(perl -e 'print int(rand(50)). "\n"') +sleep $RAND +for i in $(seq 1 20) +do + GOTIT=0 + for i in $MASTER_IPS + do + wget --wait=10 --random-wait --waitretry=10 --retry-connrefused -t 0 -T 60 http://$i/install/autoinst/xcatpost.tar.bz2 + if [ "$?" = "0" ] + then + GOTIT=1 + break + fi + done + if [ "$GOTIT" = "1" ] + then + break + fi + RAND=$(perl -e 'print int(rand(5)). "\n"') + sleep $RAND +done +tar -xvf xcatpost.tar.bz2 +/xcatpost/#TABLE:nodelist:THISNODE:node# +export NODE=#TABLE:nodelist:THISNODE:node# +export PATH=/xcatpost:$PATH +uploadboot +cd / +rm -Rf /xcatpost +exit 0