From cd1c5414d6e4597b0263408c9154e64715817c88 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 10 Oct 2013 11:25:36 -0400 Subject: [PATCH] defect 3819 --- xCAT-server/lib/xcat/plugins/updatenode.pm | 32 +++++++++++++-- xCAT/postscripts/xcatdsklspost | 47 ++++++++++++++++++---- 2 files changed, 69 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 5ea27a64b..119c59a3d 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -1251,6 +1251,12 @@ sub updatenoderunps } else { $nfsv4 = "no"; } + my $flowcontrol = 0; + my @fc = + xCAT::TableUtils->get_site_attribute("useflowcontrol"); + if ($fc[0] && ($fc[0] =~ /1|Yes|yes|YES|Y|y/)) { + $flowcontrol = 1; + } # if running postscript report status here, if requested. if ((defined($request->{status})) && ($request->{status} eq "yes")) { $::REPORTSTATUS="Y"; @@ -1296,7 +1302,8 @@ sub updatenoderunps } my $args1; # Note order of parameters to xcatdsklspost - #is important and cannot be changed + #is important and cannot be changed and calls in this routine and updatenodesoftware + # should be kept the same. my $runpscmd; if ($::SETSERVER){ @@ -1306,6 +1313,11 @@ sub updatenoderunps $runpscmd = "$installdir/postscripts/xcatdsklspost $mode -m $snkey '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c" } + # add flowcontrol flag + if ($flowcontrol == 1){ + $runpscmd .= " -F"; + } + # add verbose flag if ($::VERBOSE){ $runpscmd .= " -V"; @@ -1663,6 +1675,7 @@ sub updatenodesoftware my $tftpdir = xCAT::TableUtils->getTftpDir(); my $localhostname = hostname(); my $rsp; + my $nfsv4 = "no"; # AIX only but set to keep the xcatdsklspost call the same for -F and -S # Determine when to report status, do not report it here if -P is to run if ((defined($request->{status})) && ($request->{status} eq "yes")) { # if status requested if ($request->{rerunps} && $request->{rerunps}->[0] eq "yes") { # (-P) running postscripts @@ -1671,6 +1684,12 @@ sub updatenodesoftware $::REPORTSTATUS="Y"; } } + my $flowcontrol = 0; + my @fc = + xCAT::TableUtils->get_site_attribute("useflowcontrol"); + if ($fc[0] && ($fc[0] =~ /1|Yes|yes|YES|Y|y/)) { + $flowcontrol = 1; + } # this drives getdata to report status complete for software updatees $::TYPECALL ="S"; @@ -1696,6 +1715,9 @@ sub updatenodesoftware # it's possible that the nodes could have diff server names # do all the nodes for a particular server at once + # Note order of parameters to xcatdsklspost + #is important and cannot be changed and calls in this routine and updatenoderunps + # should be kept the same. foreach my $snkey (keys %servernodes) { my $nodestring = join(',', @{$servernodes{$snkey}}); @@ -1704,7 +1726,7 @@ sub updatenodesoftware if ($::SETSERVER) { $cmd = - "$installdir/postscripts/xcatdsklspost 2 -M $snkey 'ospkgs,otherpkgs' --tftp $tftpdir" ; + "$installdir/postscripts/xcatdsklspost 2 -M $snkey 'ospkgs,otherpkgs' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c" ; @@ -1712,7 +1734,11 @@ sub updatenodesoftware else { $cmd = - "$installdir/postscripts/xcatdsklspost 2 -m $snkey 'ospkgs,otherpkgs' --tftp $tftpdir"; + "$installdir/postscripts/xcatdsklspost 2 -m $snkey 'ospkgs,otherpkgs' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c"; + } + # add flowcontrol flag + if ($flowcontrol == 1){ + $cmd .= " -F"; } # add verbose flag if ($::VERBOSE){ diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 1bce0ef3b..c6ea61131 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -177,6 +177,14 @@ else if [ ${12} = "-V" ]; then export VERBOSE=1 fi + if [ ${12} = "-F" ]; then + export USEFLOWCONTROL=1 + fi + fi + if [ $ARGNUM -gt 12 ]; then + if [ ${13} = "-V" ]; then + export VERBOSE=1 + fi fi ;; 3|4|6) MODE=$1;; @@ -192,6 +200,12 @@ if [ -n "$XCATDEBUG" ]; then fi fi #echo "xcatpost = $xcatpost" + +useflowcontrol=0 +if [ $USEFLOWCONTROL = "1" ]; then + useflowcontrol=1 +fi + # If on AIX node if [ ! `uname` = Linux ]; then @@ -207,6 +221,7 @@ if [ ! `uname` = Linux ]; then umount /xcatmnt rmdir /xcatmnt logger -t xCAT -p local4.err "Running xcataixpost $*" + # note not supporting -F or -V on AIX echo "/$xcatpost/xcataixpost $1 $2 $3 '"$4"' $5 $6 $7 $8 $9 ${10} ${11}" exec /$xcatpost/xcataixpost $1 $2 $3 "$4" $5 $6 $7 $8 $9 ${10} ${11} exit @@ -474,25 +489,43 @@ fi # We need to call getpostscript.awk . if [ ! -x /$xcatpost/mypostscript ]; then - # first contact daemon xcatflowrequest 3001 - logger -t xCAT -p local4.info "xcatdsklspost: xcatflowrequest $SIP 3001" -/$xcatpost/xcatflowrequest $SIP 3001 + if [ $useflowcontrol = "1" ]; then + # first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "xcatdsklspost:sending xcatflowrequest $SIP 3001" + /$xcatpost/xcatflowrequest $SIP 3001 + fi /$xcatpost/getpostscript.awk | egrep '' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /$xcatpost/mypostscript; + + if [ $useflowcontrol = "1" ]; then + logger -t xCAT -p local4.info "xcatdsklspost: received response /$xcatpost/xcatflowrequest $master 3001" + fi + MYCONT=`grep MASTER /$xcatpost/mypostscript` MAX_RETRIES=10 RETRY=0 while [ -z "$MYCONT" ]; do + # not using flow control , need to sleep + if [ $useflowcontrol = "0" ]; then + let SLI=$RANDOM%10 + let SLI=SLI+10 + sleep $SLI + fi + RETRY=$(($RETRY+1)) if [ $RETRY -eq $MAX_RETRIES ] then break fi - # contact daemon xcatflowrequest 3001 - logger -t xCAT -p local4.info "xcatdsklspost: xcatflowrequest $SIP 3001" - /$xcatpost/xcatflowrequest $SIP 3001 - + if [ $useflowcontrol = "1" ]; then + # contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "xcatdsklspost: sending xcatflowrequest $SIP 3001" + /$xcatpost/xcatflowrequest $SIP 3001 + fi /$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /$xcatpost/mypostscript; + if [ $useflowcontrol = "1" ]; then + logger -t xCAT -p local4.info "xcatdsklspost: received response /$xcatpost/xcatflowrequest $master 3001" + fi MYCONT=`grep MASTER /$xcatpost/mypostscript` if [ ! -z "$MYCONT" ]; then break;