mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 17:23:08 +00:00
fix issue [Customer]initrd stuck in loop and fails to get rootimg.gz for stateless image. #921 @github;use /install/postscripts/updateflag.awk as the script to report status in diskless and diskful provision
This commit is contained in:
parent
705c119d0f
commit
05c90d4c47
@ -23,33 +23,19 @@ fi
|
||||
AWK=`find / -name awk | head -1`
|
||||
#old awk /mounts/instsys/bin/awk -f
|
||||
|
||||
cat >/tmp/updateflag.awk <<EOF
|
||||
#!$AWK -f
|
||||
|
||||
BEGIN {
|
||||
xcatdport = #TABLE:site:key=xcatiport:value#
|
||||
xcatdhost = "#XCATVAR:XCATMASTER#"
|
||||
XCATDPORT=#TABLE:site:key=xcatiport:value#
|
||||
XCATDHOST="#XCATVAR:XCATMASTER#"
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatdport
|
||||
|
||||
while(1) {
|
||||
if((ns |& getline) > 0)
|
||||
print \$0
|
||||
|
||||
if(\$0 == "ready")
|
||||
print "next" |& ns
|
||||
if(\$0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
||||
(cat >/tmp/updateflag.awk << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/updateflag.awk#
|
||||
EOF
|
||||
) >/tmp/updateflag.awk
|
||||
|
||||
chmod 755 /tmp/updateflag.awk
|
||||
/tmp/updateflag.awk
|
||||
|
||||
/tmp/updateflag.awk $XCATDHOST $XCATDPORT
|
||||
|
||||
export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic#
|
||||
if [ "$PRINIC" == "mac" ]
|
||||
then
|
||||
|
@ -28,6 +28,12 @@ if [[ $TFTPDIR != /* ]]; then
|
||||
TFTPDIR="/"$TFTPDIR
|
||||
fi
|
||||
|
||||
|
||||
(cat << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/updateflag.awk#
|
||||
EOF
|
||||
) >/tmp/updateflag
|
||||
|
||||
cd /tmp
|
||||
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
||||
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
|
||||
@ -38,7 +44,7 @@ sleep $RAND
|
||||
# Stop if no openssl to help the next bit
|
||||
if [ ! -x /usr/bin/openssl ]; then
|
||||
msgutil_r "$MASTER_IP" "debug" "/usr/bin/openssl does not exist, halt ..." "/var/log/xcat/xcat.log"
|
||||
updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
sleep 36500d
|
||||
fi
|
||||
|
||||
@ -75,14 +81,14 @@ fi
|
||||
# Stop if no wget to help the next bit
|
||||
if [ ! -x /usr/bin/wget ]; then
|
||||
msgutil_r "$MASTER_IP" "debug" "/usr/bin/wget does not exist, halt ..." "/var/log/xcat/xcat.log"
|
||||
updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
sleep 36500d
|
||||
fi
|
||||
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -e robots=off -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 20 -T 60 http://$MASTER_IP$INSTALLDIR/postscripts/ -P /xcatpost
|
||||
if [ "$?" != "0" ]; then
|
||||
msgutil_r "$MASTER_IP" "debug" "failed to download postscripts from http://$MASTER_IP$INSTALLDIR/postscripts/, halt ..." "/var/log/xcat/xcat.log"
|
||||
updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
sleep 36500d
|
||||
fi
|
||||
chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'`
|
||||
@ -126,7 +132,7 @@ if [ ! -x /xcatpost/mypostscript ]; then
|
||||
# Stop if no getpostscript.awk to help the next bit
|
||||
if [ ! -x /xcatpost/getpostscript.awk ]; then
|
||||
msgutil_r "$MASTER_IP" "debug" "/xcatpost/getpostscript.awk does not exist, halt ..." "/var/log/xcat/xcat.log"
|
||||
updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
sleep 36500d
|
||||
fi
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript
|
||||
@ -227,7 +233,7 @@ fi
|
||||
chmod +x /xcatpost/mypostscript
|
||||
if [ ! -x /xcatpost/mypostscript ]; then
|
||||
msgutil_r "$MASTER_IP" "debug" "generate mypostscript file failure, halt ..." "/var/log/xcat/xcat.log"
|
||||
updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
sleep 36500d
|
||||
else
|
||||
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
|
||||
|
@ -19,32 +19,15 @@ fi
|
||||
AWK=`find / -name awk | tail -1`
|
||||
#old awk /mounts/instsys/bin/awk -f
|
||||
|
||||
cat >/tmp/bar.awk <<EOF
|
||||
#!$AWK -f
|
||||
|
||||
BEGIN {
|
||||
XCATDPORT=#TABLE:site:key=xcatiport:value#
|
||||
XCATDHOST="#XCATVAR:XCATMASTER#"
|
||||
|
||||
xcatiport = "#TABLE:site:key=xcatiport:value#"
|
||||
xcatdhost = "#XCATVAR:XCATMASTER#"
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
print ARGV[1]
|
||||
print "xCAT_xcatd" |& ns
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
if(\$0 == "ready")
|
||||
print ARGV[1] |& ns
|
||||
if(\$0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
||||
(
|
||||
cat << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/updateflag.awk#
|
||||
EOF
|
||||
) > /tmp/bar.awk
|
||||
|
||||
|
||||
if [ ! -c /dev/vcs ]; then
|
||||
@ -123,12 +106,12 @@ chmod 755 /tmp/foo.awk
|
||||
chmod 755 /tmp/bar.awk
|
||||
|
||||
|
||||
/tmp/bar.awk "installmonitor" &
|
||||
/tmp/bar.awk $XCATDHOST $XCATDPORT "installmonitor" &
|
||||
|
||||
NODESTATUS=#TABLEBLANKOKAY:site:key=nodestatus:value#
|
||||
|
||||
if [ -z "$NODESTATUS" ] || [ "$NODESTATUS" != "0" -a "$NODESTATUS" != "N" -a "$NODESTATUS" != "n" ]; then
|
||||
/tmp/bar.awk "installstatus installing" &
|
||||
/tmp/bar.awk $XCATDHOST $XCATDPORT "installstatus installing" &
|
||||
fi
|
||||
|
||||
/tmp/foo.awk >/tmp/foo.log 2>&1 &
|
||||
|
@ -38,25 +38,3 @@ declare -F msgutil &>/dev/null || function msgutil {
|
||||
msgutil_r "" "$@"
|
||||
}
|
||||
|
||||
declare -F updateflag &>/dev/null || function updateflag {
|
||||
awk -v master="$1" -v port="$2" -v flag="$3" 'BEGIN{
|
||||
ns = "/inet/tcp/0/" master "/" port
|
||||
while(1) {
|
||||
if((ns |& getline) > 0)
|
||||
print $0 | "logger -t xcat -p local4.info"
|
||||
else {
|
||||
print "Retrying flag update" | "logger -t xcat -p local4.info"
|
||||
close(ns)
|
||||
system("sleep 10")
|
||||
}
|
||||
|
||||
if($0 == "ready")
|
||||
print flag |& ns
|
||||
if($0 == "done")
|
||||
break
|
||||
}
|
||||
close(ns)
|
||||
exit 0
|
||||
}'
|
||||
return 0
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
#!/bin/awk -f
|
||||
#script to feedback the node provision status to xcatd
|
||||
BEGIN {
|
||||
|
||||
xcatdhost = ARGV[1]
|
||||
xcatiport = ARGV[2]
|
||||
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
print "xCAT_xcatd" |& ns
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
if($0 == "ready")
|
||||
print ARGV[3] |& ns
|
||||
if($0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
#!/bin/awk -f
|
||||
#script to feedback the node provision status to xcatd
|
||||
BEGIN {
|
||||
|
||||
xcatdhost = ARGV[1]
|
||||
xcatiport = ARGV[2]
|
||||
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
print "xCAT_xcatd" |& ns
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
if($0 == "ready")
|
||||
print ARGV[3] |& ns
|
||||
if($0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
@ -940,8 +940,8 @@ sub mkinitrd_dracut {
|
||||
$perm = (stat("$fullpath/$dracutdir/install.statelite"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/install");
|
||||
|
||||
cp("$fullpath/$dracutdir/xcat-updateflag",$dracutmpath);
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-updateflag"))[2];
|
||||
cp("$installroot/postscripts/updateflag.awk","$dracutmpath/xcat-updateflag");
|
||||
$perm = (stat("$installroot/postscripts/updateflag.awk"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-updateflag");
|
||||
|
||||
cp("$fullpath/$dracutdir/xcat-prepivot.sh",$dracutmpath);
|
||||
@ -972,8 +972,8 @@ sub mkinitrd_dracut {
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-cmdline.sh"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-cmdline.sh");
|
||||
|
||||
cp("$fullpath/$dracutdir/xcat-updateflag",$dracutmpath);
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-updateflag"))[2];
|
||||
cp("$installroot/postscripts/updateflag.awk","$dracutmpath/xcat-updateflag");
|
||||
$perm = (stat("$installroot/postscripts/updateflag.awk"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-updateflag");
|
||||
|
||||
if ($prinic) {
|
||||
|
@ -1,24 +0,0 @@
|
||||
#!/bin/awk -f
|
||||
#script to feedback the node provision status to xcatd
|
||||
BEGIN {
|
||||
|
||||
xcatdhost = ARGV[1]
|
||||
xcatiport = ARGV[2]
|
||||
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
print "xCAT_xcatd" |& ns
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
if($0 == "ready")
|
||||
print ARGV[3] |& ns
|
||||
if($0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
@ -1010,8 +1010,8 @@ sub mkinitrd_dracut {
|
||||
$perm = (stat("$fullpath/$dracutdir/install.statelite"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/install");
|
||||
|
||||
cp("$fullpath/$dracutdir/xcat-updateflag",$dracutmpath);
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-updateflag"))[2];
|
||||
cp("$installroot/postscripts/updateflag.awk","$dracutmpath/xcat-updateflag");
|
||||
$perm = (stat("$installroot/postscripts/updateflag.awk"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-updateflag");
|
||||
|
||||
cp("$fullpath/$dracutdir/xcat-prepivot.sh",$dracutmpath);
|
||||
@ -1042,8 +1042,8 @@ sub mkinitrd_dracut {
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-cmdline.sh"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-cmdline.sh");
|
||||
|
||||
cp("$fullpath/$dracutdir/xcat-updateflag",$dracutmpath);
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-updateflag"))[2];
|
||||
cp("$installroot/postscripts/updateflag.awk","$dracutmpath/xcat-updateflag");
|
||||
$perm = (stat("$installroot/postscripts/updateflag.awk"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-updateflag");
|
||||
if ($prinic) {
|
||||
my $optspec;
|
||||
|
Loading…
x
Reference in New Issue
Block a user