2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-05-17 19:57:18 +00:00

fix: retry on HTTP 503 from OpenBMC REST API instead of failing

OpenBMC BMCs intermittently return 503 Service Unavailable when the
REST service is busy or recovering. xCAT reported the error immediately,
requiring the user to manually retry. A second attempt usually succeeds.

Retry the same request up to 3 times with a 3-second wait on 503.
If all retries fail, report the error as before. The existing 504
handling for bmcreboot is preserved.

Ref: #4264
This commit is contained in:
Vinícius Ferrão
2026-05-06 18:50:53 -03:00
parent ca6bafd723
commit 1bca57fa2a
+6
View File
@@ -2991,6 +2991,12 @@ sub deal_with_response {
}
if ($response->status_line eq $::RESPONSE_SERVICE_UNAVAILABLE) {
$node_info{$node}{_503_retries} = ($node_info{$node}{_503_retries} || 0) + 1;
if ($node_info{$node}{_503_retries} <= 3) {
$node_info{$node}{cur_status} =~ s/_RESPONSE$/_REQUEST/;
$node_wait{$node} = time() + 3;
return;
}
$error = $::RESPONSE_SERVICE_UNAVAILABLE;
} elsif ($response->status_line eq $::RESPONSE_METHOD_NOT_ALLOWED) {
if ($node_info{$node}{cur_status} eq "REVENTLOG_RESOLVED_RESPONSE") {