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

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16682 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
immarvin 2013-06-19 06:55:03 +00:00
parent 592a0d508c
commit a6aab0c6d0
3 changed files with 66 additions and 0 deletions

View File

@ -889,6 +889,8 @@ sub mknetboot
my $installroot;
$installroot = "/install";
my $xcatdport = "3001";
my $xcatiport = "3002";
my $nodestatus = "y";
if ($sitetab)
{
@ -902,11 +904,21 @@ sub mknetboot
{
$xcatdport = $ref->{value};
}
($ref) = $sitetab->getAttribs({key => 'xcatiport'}, 'value');
if ($ref and $ref->{value})
{
$xcatiport = $ref->{value};
}
($ref) = $sitetab->getAttribs({key => 'tftpdir'}, 'value');
if ($ref and $ref->{value})
{
$globaltftpdir = $ref->{value};
}
($ref) = $sitetab->getAttribs({key => 'nodestatus'}, 'value');
if ($ref and $ref->{value})
{
$nodestatus = $ref->{value};
}
}
my %donetftp=();
my %oents = %{$ostab->getNodesAttribs(\@nodes,[qw(os arch profile provmethod)])};
@ -1307,6 +1319,9 @@ sub mknetboot
$kcmdline = "imgurl=http://$imgsrv/$rootimgdir/rootimg-statelite.gz STATEMNT=";
}
if(($nodestatus eq "n") or ($nodestatus eq "N") or ($nodestatus eq "0")){
$kcmdline .= " nonodestatus ";
}
# add support for subVars in the value of "statemnt"

View File

@ -63,9 +63,18 @@ cat >/tmp/foo.sh <<EOF
if [ \$# -eq 0 ]; then
xcatdhost="#XCATVAR:XCATMASTER#"
xcatdport="#TABLE:site:key=xcatiport:value#"
NODESTATUS="NODESTATUS=#TABLEBLANKOKAY:site:key=nodestatus:value#"
/usr/bin/nc "\$xcatdhost" "\$xcatdport" -e /tmp/foo.sh install_monitor &
if [ -z "\$NODESTATUS" ] || [ "\$NODESTATUS" != "0" -a "\$NODESTATUS" != "N" -a "\$NODESTATUS" != "n" ];
then
/usr/bin/nc "\$xcatdhost" "\$xcatdport" -e /tmp/foo.sh installstatus installing &
fi
while true; do
/usr/bin/nc -l -p 3001 -e /tmp/foo.sh serve_client
done
@ -92,6 +101,26 @@ if [ "\$1" = "install_monitor" ]; then
exit 0
fi
#
# If the script was called with the "installstatus" argument, stdin and stdout are
# connected to an xCAT daemon on the master.
# Write the "installstatus xx" request to the daemon to update thenode installation status.
if [ "\$1" = "installstatus" ]; then
cmd=""
while [ "\$cmd" != "done" ]; do
read cmd remainder
if [ "\$cmd" == "ready" ]; then
echo "installstatus \$2"
fi
done
exit 0
fi
#
# When execution reaches here, script called with "serve_client" argument, which means
# stdin and stdout are connected to a client. Read the request from the client, provide

View File

@ -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}'`