update the nodelist.status to installing/netbooting via feedback from node during provision

This commit is contained in:
immarvin 2013-08-15 23:13:01 -07:00
parent f78ec64c25
commit 4c1c27c753

View File

@ -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 <<EOMS;
#!/bin/sh
if [ \$# -eq 3 ]; then
echo \$3 > /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/$_") {