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_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 {}
|
by_robust = longhorn.get("by_robustness") if isinstance(longhorn.get("by_robustness"), dict) else {}
|
||||||
if total is not None:
|
if total is not None:
|
||||||
lines.append(
|
if attached is None and detached is None and degraded is None:
|
||||||
"longhorn: total={total}, attached={attached}, detached={detached}, degraded={degraded}".format(
|
unhealthy = longhorn.get("unhealthy_count")
|
||||||
total=total,
|
lines.append(
|
||||||
attached=attached if attached is not None else 0,
|
"longhorn: total={total}, unhealthy={unhealthy}".format(
|
||||||
detached=detached if detached is not None else 0,
|
total=total,
|
||||||
degraded=degraded if degraded is not None else 0,
|
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:
|
if by_state:
|
||||||
lines.append("longhorn_state: " + _format_kv_map(by_state))
|
lines.append("longhorn_state: " + _format_kv_map(by_state))
|
||||||
if by_robust:
|
if by_robust:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user