Handle vSphere vSAN collection errors per cluster instead of per vCenter #25435
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.48) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 532 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.376
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #25435"
general
weight: 0.35
HadhemiDD
What does this PR do?
Makes vSAN metric collection tolerate a failure on a single cluster.
get_vsan_metricsloops over every vSAN-enabled cluster and accumulates results into local lists. Nothing inside the loop caught errors, so an exception from one cluster unwound the whole function and discarded every result already gathered. The only handler was a single broadexcept Exceptionwrapping the entire collection incollect_vsan_metrics, which logs a warning. One unhealthy cluster therefore cost the whole vCenter its vSAN metrics on every run.@smart_retrycompounded the problem instead of relieving it. It callssmart_connect, which runsconnect.Disconnecton the previous session, then re-invokes the function with the same arguments. Those arguments include the cluster managed objects, which remain bound to the now logged-out session, so the retry failed immediately on the firstcluster_reference.nameproperty fetch withNotAuthenticated. This is specific toget_vsan_metrics: every other@smart_retrymethod re-readsself._conn, so reconnecting actually helps them. Because the original exception is only logged at DEBUG, the warning users actually saw was the retry'sNotAuthenticatedagainst whichever cluster happened to be first in the list, not the real cause.Changes:
_get_cluster_vsan_metricsand wrap the call in a try/except. A failing cluster is skipped with a warning naming the cluster and the real error; the remaining clusters are still collected.@smart_retryfromget_vsan_metrics, since a retry there cannot succeed.cluster_display_name, which falls back to the managed object id when readingnamefails.nameis a property fetch against vCenter, so it raises when the session is gone — without the fallback the warning handler itself would raise and we would be back to losing the run.No metric, tag, or config change: the metrics emitted for a healthy cluster are identical.
One caveat worth calling out for review. The escalation also reports an
AttributeError: groupIdon vCenter 9.0.2, which suggestsQueryClusterHealthreturns a different payload shape there. This PR makes that failure visible and contained — the cluster is skipped with a clear log line rather than taking the vCenter down with it — but it does not make vSAN collection work on 9.x. Establishing the 9.x response shape needs a real 9.0.2 vCenter and is left as follow-up.Motivation
Reported in AGENT-17268. A customer lost all vSAN metrics across a vCenter because one decommissioned cluster had no vSAN stats primary:
The
NotAuthenticatedondomain-c3489is the retry failing against a different cluster — the first in the list — which is why the actualmasternotfoundcause was invisible at default log level. The customer only resolved it by removing the cluster from vCenter.Tests were written first and cover the three observable failures: a cluster whose
QueryClusterHealthorQueryVsanPerfraises, a cluster returning a health group withoutgroupId, and a cluster whosenameis unreadable. Each asserts the other clusters still report and that the real error reaches the warning log.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged🤖 Generated with Claude Code