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:
@@ -199,9 +199,21 @@ def _int(v):
|
||||
return v if isinstance(v, int) and not isinstance(v, bool) else None
|
||||
|
||||
|
||||
def drive_summary(name: str, status, data) -> dict:
|
||||
def drive_name(name: str, kind) -> str:
|
||||
"""A drive's name, unique on its host. Disks behind a RAID controller
|
||||
share one path (/dev/bus/0) and differ only by the slot in their type
|
||||
(megaraid,3; cciss,0), so the slot is part of the name (#5806)."""
|
||||
base = os.path.basename(name)
|
||||
if name.startswith("/dev/bus/"):
|
||||
base = "bus" + base
|
||||
if isinstance(kind, str) and "," in kind:
|
||||
base += "-" + re.sub(r"[^A-Za-z0-9]", "", kind.split("+")[-1])
|
||||
return base
|
||||
|
||||
|
||||
def drive_summary(name: str, status, data, kind=None) -> dict:
|
||||
"""The few figures Steward reads from one drive's `smartctl -a` JSON."""
|
||||
out = {"device": os.path.basename(name)}
|
||||
out = {"device": drive_name(name, kind)}
|
||||
if not isinstance(data, dict) or status is None or status & _SMARTCTL_UNREAD:
|
||||
messages = ((data.get("smartctl") or {}).get("messages") or []) if isinstance(data, dict) else []
|
||||
text = "; ".join(str(m.get("string", "")) for m in messages if isinstance(m, dict))
|
||||
@@ -267,7 +279,7 @@ def do_drives() -> dict:
|
||||
continue
|
||||
args = ["-a", name] if not isinstance(kind, str) else ["-a", "-d", kind, name]
|
||||
status, data = smartctl_json(args)
|
||||
drives.append(drive_summary(name, status, data))
|
||||
drives.append(drive_summary(name, status, data, kind))
|
||||
return {**base, "drives": drives}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user