snapshot: handle legacy longhorn fields
This commit is contained in:
parent
2ac95c2154
commit
c5c976e556
@ -772,14 +772,23 @@ def _append_longhorn(lines: list[str], summary: dict[str, Any]) -> None:
|
||||
by_state = longhorn.get("by_state") if isinstance(longhorn.get("by_state"), dict) else {}
|
||||
by_robust = longhorn.get("by_robustness") if isinstance(longhorn.get("by_robustness"), dict) else {}
|
||||
if total is not None:
|
||||
lines.append(
|
||||
"longhorn: total={total}, attached={attached}, detached={detached}, degraded={degraded}".format(
|
||||
total=total,
|
||||
attached=attached if attached is not None else 0,
|
||||
detached=detached if detached is not None else 0,
|
||||
degraded=degraded if degraded is not None else 0,
|
||||
if attached is None and detached is None and degraded is None:
|
||||
unhealthy = longhorn.get("unhealthy_count")
|
||||
lines.append(
|
||||
"longhorn: total={total}, unhealthy={unhealthy}".format(
|
||||
total=total,
|
||||
unhealthy=unhealthy if unhealthy is not None else 0,
|
||||
)
|
||||
)
|
||||
else:
|
||||
lines.append(
|
||||
"longhorn: total={total}, attached={attached}, detached={detached}, degraded={degraded}".format(
|
||||
total=total,
|
||||
attached=attached if attached is not None else 0,
|
||||
detached=detached if detached is not None else 0,
|
||||
degraded=degraded if degraded is not None else 0,
|
||||
)
|
||||
)
|
||||
)
|
||||
if by_state:
|
||||
lines.append("longhorn_state: " + _format_kv_map(by_state))
|
||||
if by_robust:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user