From 4c1c27c7534a2ed2c75d7f93e87deb3307890cb7 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 15 Aug 2013 23:13:01 -0700 Subject: [PATCH] update the nodelist.status to installing/netbooting via feedback from node during provision --- .../share/xcat/netboot/ubuntu/genimage | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index f3b634930..965de17a2 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -263,7 +263,7 @@ unless ($onlyinitrd) { my %pkg_hash=imgutils::get_package_names($pkglist); my $index=1; my $pass; - foreach $pass (sort {$a <=> $b} (keys(%pkg_hash))) { + foreach $pass (sort {$a <=> $b} (keys(%pkg_hash))) { my $pkgnames = ""; foreach (keys(%{$pkg_hash{$pass}})) { if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next;} @@ -959,6 +959,8 @@ grep '\(debug\)' /proc/cmdline > /dev/null && export DEBUG=1 # TODO: does "anaconda.busybox sh" support "set " ? PRINIC=$prinic +NODESTATUS='y' +XCATIPORT="3002" for i in `cat /proc/cmdline`; do KEY=`echo \$i |awk -F= '{print \$1}'` @@ -971,7 +973,17 @@ for i in `cat /proc/cmdline`; do VALUE=`echo \$i |awk -F= '{print \$2}'` # format: XCAT=xcatmaster:3001 XCATSERVER=\$VALUE + elif [ "\$KEY" == 'XCATIPORT' ]; then + VALUE=`echo \$i |awk -F= '{print \$2}'` + # format: XCAT=xcatmaster:3001 + XCATIPORT=\$VALUE fi + + #if "nonodestatus" specified,do not update the nodestatus + if [ \$i == 'nonodestatus' ]; then + NODESTATUS='n' + fi + done if [ -z "\$IFACE" ]; then @@ -998,6 +1010,16 @@ while ! ifconfig | grep 'inet addr'; do done ifconfig lo 127.0.0.1 ifconfig lo up + + +XCATMASTER=`echo \$XCATSERVER|awk -F: '{print \$1}'` + + +#update nodelist.nodestatus to "netbooting" +if [ \$NODESTATUS != 'n' ]; then + /tmp/updateflag \$XCATMASTER \$XCATIPORT "installstatus netbooting" +fi + cd / for i in `cat /proc/cmdline`; do KEY=`echo \$i |awk -F= '{print \$1}'` @@ -1309,10 +1331,40 @@ exit 0 EOF close($inifile); + + #if "nonodestatus" specified,do not update the nodestatus + system("mkdir -p /tmp/xcatinitrd.$$/tmp/"); + open($inifile, ">","/tmp/xcatinitrd.$$/tmp/updateflag"); + + print $inifile < /tmp/ncarg + nc \$1 \$2 -w 60 -e /tmp/updateflag +else + retrytimes=0 + cmd="" + while [ "\$cmd" != "done" ]; do + retrytimes=`expr \$retrytimes + 1` + if [ \$retrytimes -eq 60 ]; then + break; + fi + read -t 60 cmd + if [ "\$cmd" == "ready" ]; then + head -n 1 /tmp/ncarg + rm -rf /tmp/ncarg + fi + done + +fi +EOMS + close($inifile); + chmod(0755,"/tmp/xcatinitrd.$$/usr/share/udhcpc/default.script"); chmod(0755,"/tmp/xcatinitrd.$$/init"); chmod(0755,"/tmp/xcatinitrd.$$/bin/netstart"); + chmod(0755,"/tmp/xcatinitrd.$$/tmp/updateflag"); @filestoadd=(); foreach (@ndrivers) { if (-f "$customdir/$_") {