2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-21 09:52:17 +00:00
Files
xcat-core/xCAT-genesis-scripts/usr/bin/updateflag.awk
T
Daniel Hilst a12d31ced5 fix(xcat-core): an IPv6 master gives a Genesis node no credentials
A node discovered by Genesis on an IPv6-only cluster gets no credentials and
reports no state. The credential callback never answers and the install state
never reaches xcatd, so discovery stops with nothing in the log that names an
address family.

The Genesis copies of the two awk helpers were never given the IPv6 branch
that the copies under xCAT/postscripts carry. allowcred.awk hardcoded
"/inet/tcp/300/0/0", so it ignored XCAT_CREDENTIAL_CALLBACK_PORT and opened a
listener that accepts no IPv6 connection. updateflag.awk built "/inet/" from
the raw argument, so a bracketed IPv6 literal reached gawk with its brackets
and resolved to nothing. Neither build script copies these files, so the two
copies are independent and the first never followed the second.

Both Genesis copies now carry the postscripts logic. updateflag.awk keeps
logger and writes no file: Genesis has no /var/log/xcat directory, rsyslog
sends everything to /var/log/xcat.genesis, and gawk is fatal when it cannot
open a redirect.

ipv6_genesis_awk_inet6.bats captures this. Four of its six cases fail on the
previous copies.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-11-05 09:20:22 -03:00

47 lines
1.2 KiB
Awk
Executable File

#!/usr/bin/awk -f
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#
# The Genesis copy of xCAT/postscripts/updateflag.awk. It writes no file: Genesis has no
# /var/log/xcat directory, rsyslog sends everything to /var/log/xcat.genesis, and gawk is
# fatal when it cannot open a redirect.
BEGIN {
xcatdhost = ARGV[1]
xcatdport = ARGV[2]
flag = ARGV[3]
if (!flag) flag = "next"
if (xcatdhost ~ /^\[.*\]$/) {
sub(/^\[/, "", xcatdhost)
sub(/\]$/, "", xcatdhost)
}
netfamily = index(xcatdhost, ":") ? "inet6" : "inet"
ns = "/" netfamily "/tcp/0/" xcatdhost "/" xcatdport
loop = 0
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")
loop = loop + 1
}
if($0 == "ready")
print flag |& ns
if($0 == "done")
break
if(loop > 10) {
print "flag update failed" | "logger -t xcat -p local4.info"
break
}
}
close(ns)
exit 0
}