fix(host_agent): disks behind a RAID controller each keep their own name (#5806)
smartctl reports every disk behind a PERC/MegaRAID controller as /dev/bus/0 with type megaraid,N; the helper named a drive by its path alone, so all of VDNT-Docker02's and Docker03's disks read as one drive "0", each overwriting the last. The slot is now part of the name (bus0-megaraid3), and Steward gives a repeated name an ordinal so two drives never share a series. Agent 1.20.1. fix(ansible): Steward stopping mid-run logs no traceback (#5749) The run's done-callback called exception() on a cancelled task, which raises; it now logs a run cut short by shutdown at INFO. A finished run's in-memory state is dropped by a timer rather than a sleeping task, which shutdown found still pending. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -69,9 +69,20 @@ def judge(d: dict) -> dict:
|
||||
|
||||
|
||||
def drives_of(report) -> list[dict]:
|
||||
"""The report's drives, judged, what needs attention first."""
|
||||
"""The report's drives, judged, what needs attention first. A name seen
|
||||
twice gets an ordinal, so two drives never share one series: agent
|
||||
1.20.0 named every disk behind a RAID controller "0" (#5806)."""
|
||||
drives = report.get("drives") if isinstance(report, dict) else None
|
||||
judged = [judge(d) for d in drives or [] if isinstance(d, dict) and d.get("device")]
|
||||
judged, seen = [], {}
|
||||
for d in drives or []:
|
||||
if not isinstance(d, dict) or not d.get("device"):
|
||||
continue
|
||||
d = judge(d)
|
||||
name = str(d["device"])
|
||||
seen[name] = seen.get(name, 0) + 1
|
||||
if seen[name] > 1:
|
||||
d["device"] = f"{name}#{seen[name]}"
|
||||
judged.append(d)
|
||||
return sorted(judged, key=lambda d: (_ORDER[d["state"]], str(d["device"])))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user