2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-02 00:41:42 +00:00

fix(xcat-core): the provisioning-source check misses a doubled-slash boot payload

wget asks for the root image as //install/..., so the leading slash repeats.
The path filter matched a single leading slash and did not count those
requests. A service node that served only the root image would therefore read
as having served no boot payload.

The filter now accepts a repeated leading slash. The bats cases come from
fix/service-node-ub, where a real Ubuntu service node logged one //install
request beside 272 /install and 8 /tftpboot ones. Both new cases fail with the
single-slash filter.

This brings the file level with fix/service-node-ub, so the two branches no
longer carry different versions of the same check.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-09-30 13:57:49 -03:00
parent bcb4a77f1a
commit e832d26b2c
2 changed files with 35 additions and 11 deletions
@@ -21,7 +21,8 @@
# Run --baseline before provisioning: an earlier flat run leaves management-node requests for the
# same address, and counting the whole log fails a later hierarchical run for them. And only a
# request under /install or /tftpboot is a boot payload: a 404 for /favicon.ico is a request from
# the compute node that carries no payload, and it must not stand for one.
# the compute node that carries no payload, and it must not stand for one. wget asks for the root
# image as //install/..., so the leading slash repeats.
#
# Scope: the PXE ROM exchange hands out xcat/xnba.kpxe over TFTP and httpd never sees it.
# xnba.kpxe is the same binary on both servers, so it decides nothing about the fetch source.
@@ -108,7 +109,7 @@ count_local_requests()
if ($1 != ip && $2 != ip) next
path = ""
for (i = 1; i <= NF; i++) if ($i ~ /^"(GET|HEAD|POST)$/) { path = $(i + 1); break }
if (path ~ /^\/(install|tftpboot)\//) payload++
if (path ~ /^\/+(install|tftpboot)\//) payload++
}
END { print token, "ok", payload + 0, fresh + 0, total + 0 }
' $logs
+32 -9
View File
@@ -198,10 +198,9 @@ seed_logs()
[[ "$output" == *"no httpd access log could be read on $SN"* ]]
}
# The service node is provisioned before the baseline, so on a correct hierarchical run the
# management node serves nothing after it and its log does not grow. Every other case here appends
# a management-node line after the baseline, so none of them reaches this state.
@test "a management node log that does not grow after the baseline still passes" {
# The management node provisions the service node BEFORE this baseline, so it can serve nothing
# after it. That is the hierarchical result, and it was read as a broken log.
@test "a management node that serves nothing after the baseline passes" {
seed_logs
take_baseline
access_line "$CN_IP" 12345678 /tftpboot/xcat/genesis.kernel >>"$SN_LOG"
@@ -211,9 +210,7 @@ seed_logs()
[[ "$output" == *"provisioning source ok"* ]]
}
# The guard the case above relaxes still has a job. An empty log makes "the management node served
# nothing" a property of the file, not a measurement.
@test "an empty management node log fails the check instead of passing it" {
@test "a management node log with no entry at all fails the check instead of reading as silence" {
: >"$MN_LOG"
access_line 192.0.2.30 512 /install/rh/x86_64/ >"$SN_LOG"
take_baseline
@@ -221,8 +218,34 @@ seed_logs()
run_check
[ "$status" -ne 0 ]
[[ "$output" == *"no httpd access log with entries could be read on"* ]]
[[ "$output" != *"provisioning source ok"* ]]
[[ "$output" == *"no httpd access log with entries could be read on mn01"* ]]
}
# The compute node fetches the root image with wget from a URL that carries a double slash, so
# the path in the log reads //install/... and the payload filter did not match it.
@test "a boot payload requested under a doubled slash counts" {
seed_logs
take_baseline
access_line "$CN_IP" 978729607 //install/netboot/ubuntu/x86_64/compute/rootimg.cpio.gz >>"$SN_LOG"
access_line 192.0.2.21 4096 /install/rh/x86_64/ >>"$MN_LOG"
run_check
[ "$status" -eq 0 ]
[[ "$output" == *"provisioning source ok"* ]]
}
@test "a doubled-slash boot payload from the management node reads as a flat provision" {
seed_logs
take_baseline
access_line "$CN_IP" 12345678 /tftpboot/xcat/genesis.kernel >>"$SN_LOG"
{
access_line 192.0.2.21 4096 /install/rh/x86_64/
access_line "$CN_IP" 978729607 //install/netboot/ubuntu/x86_64/compute/rootimg.cpio.gz
} >>"$MN_LOG"
run_check
[ "$status" -ne 0 ]
[[ "$output" == *"this provision was flat"* ]]
}
@test "the Debian per-vhost log format is read as the client address" {